How to get citations as a clickable url in Azure AI foundry model

Ayush Mishra 60 Reputation points
2025-11-11T07:15:16.88+00:00

I wanted chat Response citations from my model to be a clickable url instead of referring it to the document.

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-11-11T07:15:59.44+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To get citations as clickable URLs in Azure AI Foundry models, you can utilize the url property of the citation information in the chat completion response. This property holds the URL of the citation, which can be formatted as a clickable link in your application or interface.

    When constructing your chat response, ensure that you include the url field for each citation. This way, when the response is rendered, the URLs will be clickable, allowing users to access the referenced documents directly.

    Make sure to handle the rendering of these URLs appropriately in your front-end code to ensure they appear as clickable links.


    References:

    0 comments No comments

  2. Nikhil Jha (Accenture International Limited) 4,150 Reputation points Microsoft External Staff Moderator
    2025-11-13T08:44:16.88+00:00

    Hi Ayush Mishra,
    This is the default behavior of the "Deploy to Web App" template. It's designed to show documents in a side panel for quick review within the app, rather than navigating the user away.

    To change this to standard web link behavior. you will need to make a minor code implementation to the frontend of the web app that Azure created for you.

    Recommended workaround steps:

    1)Even though you deployed with "no-code," all the code is running on your App Service and you have full access to it. The easiest way to edit it is to download it. Download the entire wwwroot folder. This is your web app's code.
    Alternatively, you can use the "App Service Editor (Preview)" under "Development Tools" to browse and edit the files directly in your browser, but downloading is safer for a backup.

    2)The code for your chat app is based on a standard template. You need to find the specific file that renders the citation links.

    1. In the code you downloaded, navigate to the frontend folder. This is usually in a subfolder like frontend or static.
    2. You are looking for the file that renders the chat message. It's often a JavaScript/TypeScript file, like Citation.tsx, ChatHistory.tsx, or ChatMessage.js (the exact name may vary slightly).
    3. Open that file in a code editor (like VS Code or even Notepad).
    4. Search for the HTML <a> (anchor) tag that creates the citation link. It will look something like this:
         <a onClick={() => handleCitationClick(citation.url)}>
             {citation.filename}
         </a>
      
      1. The key part is the onClick handler. This is what tells the app to open the side panel.
      2. You need to replace that code with a standard HTML link that opens in a new tab. Change it to this:
              <a href={citation.url} target="_blank" rel="noopener noreferrer">
                  {citation.filename}
              </a>
        

    3)Redeploy Your Changes

    After you've saved your file, you need to upload the new version back to your App Service.

    1. If you used FTP, just re-upload the single file you changed (or the entire wwwroot folder) back to your App Service, overwriting the old one.
    2. If you are using the in-browser App Service Editor, just click "Save".
    3. Your App Service will automatically restart (this may take 30-60 seconds).

    Helpful references:

    https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/use-web-app
    https://github.com/microsoft/sample-app-aoai-chatGPT


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.