Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Udo_S
Frequent Visitor

How to use an agent from Azure AI Foundry in a Fabric notebook?

Dear all,
We want to use an agent that we created in Azure AI Foundry in a Python notebook in Fabric. Unfortunately, we have no idea how that works fundamentally and how the authentication works in particular.
I am grateful for any help.
Best regards,
Udo

1 ACCEPTED SOLUTION

Hi @v-nmadadi-msft ,


Thank you for the hint.


I was unsure where the error could actually be located. As it turned out yesterday, the error is actually in our Fabric environment.


For historical reasons, our Fabric workspaces are based on a Power BI Premium SKU (P1). This has some limitations compared to the newer Fabric SKU (e.g., F64). Specifically, it lacks exactly those features that are required to use Azure AI Foundry agents from a Python notebook in Fabric.


The medium-term solution is to switch from a Power BI SKU to a Fabric SKU. Technically, this is not complicated, but in our case it is problematic for commercial reasons.

Many thanks to everyone for your support!


Best regards,
Udo

View solution in original post

8 REPLIES 8
Vinodh247
Resolver IV
Resolver IV

Great! Pls drop in here after your tests to see how it goes.

Hi @Vinodh247 ,
Unfortunately, the tests didn't go well. I'm still totally stuck when it comes to authenticating my agent in Fabric.

I tried assigning a contributor role to my Fabric workspace in the Azure portal and I tried CLI authentication. Both didn't work. I don't see any API endpoint for my agent (jut an ID).
AI (Perplexity and ChatGPT) suggest using using environment variables as an alternative, but this only applies to apps and not to agents. 

 

Unfortunately, by now I am quite desperate. I left a reply below with some context, and I hope that someone might come up with a step-by-step guide for my specific problem.

v-nmadadi-msft
Community Support
Community Support

Hi @Udo_S  ,
Thanks for reaching out to the Microsoft fabric community forum.

To get started on how to use Azure AI foundry with Fabric Notebooks, You can refer these articles for more information for the points mentioned by @Vinodh247  who talks about using the REST API endpoint.
Azure AI Projects client library for Python | Microsoft Learn

Quickstart - Create a new Azure AI Foundry Agent Service project - Azure AI Foundry | Microsoft Lear...

Azure AI Projects client library for Python | Microsoft Learn

Other than that approach, to ease things instead of Using Azure AI foundry there is also a feature called Fabric data agent where you can create conversational AI experiences that answer questions about data stored in lakehouses, warehouses, Power BI semantic models, and KQL databases in Fabric itself
Please check this article to know more about it and learn how to create it:
Create a Fabric data agent (preview) - Microsoft Fabric | Microsoft Learn

You can then use Fabric data agent SDK to connect to the agent using your Fabric Notebook, the SDK is designed for code-first users, and it simplifies the creation, management, and utilization of Fabric data agents within Microsoft Fabric notebooks.
Fabric data agent Python SDK (preview) - Microsoft Fabric | Microsoft Learn

If the Azure AI Foundry approach feels too complex, consider using the Fabric Data Agent as a simpler alternative to achieve your requirements.

I hope this information helps. Please do let us know if you have any further queries.
Thank you

Hello @v-nmadadi-msft and @v-nmadadi-msft ,

The permission issue has been resolved, but I still can't fully understand the root of the problem. Perhaps a bit more context from my side will help:

  • I have a Fabric workspace with a Python notebook.
  • I also have a subscription in the Azure Portal, and the Fabric workspace has been assigned the Contributor role on this subscription.
  • Within this subscription, I created a project in Azure AI Foundry, which includes a project endpoint.
  • Finally, I created an agent within this project. This agent has an Agent ID, but I can't find any additional credentials—such as a REST API key or any other form of authentication.

I tried running the following code in my notebook, hoping that authentication would happen automatically since the Fabric workspace has contributor permissions on my Azure subscription:

 

project = AIProjectClient(
    credential=DefaultAzureCredential(),
    endpoint="PROJECT_ENDPOINT")

agent = project.agents.get_agent("AGENT_ID")

 But this doesn't work.

I must admit I'm not a pro when it comes to Azure, therefore I would be very grateful if someone could give me a specific hint about what I need to do — for example, where to find the credentials for the agent's REST API (if that is the correct approach). 

Many thanks in advance!

Best regards,
Udo

 

 

Hi @Udo_S ,
In this Forum you will find people who are good at Power BI and Fabric, as the root cause of the issue is related to Azure AI Foundry, for issues related to it, please raise a question in Azure Community  Azure Community Support | Microsoft Azure to get the best possible help.
Azure community members who are good with Azure AI Foundry will take a look and will provide suggestions.
In the meantime for any other issues related to Fabric please don’t hesitate to raise a post in this forum.

Thank you

Hi @v-nmadadi-msft ,


Thank you for the hint.


I was unsure where the error could actually be located. As it turned out yesterday, the error is actually in our Fabric environment.


For historical reasons, our Fabric workspaces are based on a Power BI Premium SKU (P1). This has some limitations compared to the newer Fabric SKU (e.g., F64). Specifically, it lacks exactly those features that are required to use Azure AI Foundry agents from a Python notebook in Fabric.


The medium-term solution is to switch from a Power BI SKU to a Fabric SKU. Technically, this is not complicated, but in our case it is problematic for commercial reasons.

Many thanks to everyone for your support!


Best regards,
Udo

Vinodh247
Resolver IV
Resolver IV

To use an agent from azure AI foundry in a Fabric notebook you need to interact with the agent’s REST API endpoint, which becomes available once the agent is deployed in azure AI studio. The process fundamentally involves sending an HTTP request from the notebook to the agent’s endpoint with appropriate authentication. You can authenticate in one of two main ways: using an AAD access token or with an API key, depending on how the agent is configured in Azure AI Studio. In Fabric notebooks, authentication using AAD typically involves leveraging the Azure Identity library to generate a token for the cognitive services scope. If your agent is set up with API key authentication, you will need to include the key in the request header. It is important to ensure that your Fabric workspace has been properly configured to access external endpoints if using private networking. Once authentication is set up correctly, your notebook can send messages to the agent and receive intelligent responses as part of your workflow.

 


Please 'Kudos' and 'Accept as Solution' if this answered your query.

Hi @Vinodh247 and @v-nmadadi-msft ,
Thanks for your help!

As it turns out, we are missing permissions for our Azure subscriptions. Once that is corrected, we can conduct further tests.

Best regards,
Udo

Helpful resources

Announcements
Fabric July 2025 Monthly Update Carousel

Fabric Monthly Update - July 2025

Check out the July 2025 Fabric update to learn about new features.

July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.