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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
fantomas
Frequent Visitor

Access token to call Fabric API

Hello,

I need to use Fabric API to run notebook. I have created app registration for this purpose. I get the token but when I use it to call Fabric API, a get error 

{"requestId":"852e1ecc-6970-4d4e-bea7-9baeb5d177df","errorCode":"Unauthorized","message":"The caller is not authenticated to access this resource"}.
 
from azure.identity import ClientSecretCredential
tenant_id = 'xxx'
client_id = 'xxx'
client_secret = 'xxx'
client_secret_credential_class = ClientSecretCredential(tenant_id=tenant_idclient_id=client_idclient_secret=client_secret)
access_token_class = client_secret_credential_class.get_token(scope)
token_string = access_token_class.token

. . . then I use it to get workspaces

responserequests.Response = requests.get(url=urlheaders=get_headers())
fantomas_0-1715862389920.png

 

Where could be problem? What do I wrong?

Thanks

7 REPLIES 7
fantomas
Frequent Visitor

Hello,

sorry for my late answer. I hadn't enough time to study the links but I belive it will help me. I think that I can accept your recommended materials as solution. In case of other question I would open new topic. Thanks very much.

Anonymous
Not applicable

Hi @fantomas ,

Glad to know that your query got resolved. Please continue using Fabric Community on your further queries.

Hi,

excuse me, the recommended links didn't help me.

I need to communicate with Fabric RestAPI. I did it using this description https://learn.microsoft.com/en-us/rest/api/fabric/articles/get-started/fabric-api-quickstart

Then I was facing problems described in original question ("The caller is not authenticated to access this resource").

Why get I this error? What do I wrong? Can you help me with this?

Thanks

Anonymous
Not applicable

Hi @fantomas ,

Apologize for the issue you are facing. The best course of action is to open a support ticket and have our support team take a closer look at it.

 

Please reach out to our support team so they can do a more thorough investigation on why this it is happening: Link 

 

After creating a Support ticket please provide the ticket number as it would help us to track for more information.

 

Hope this helps. Please let us know if you have any other queries.

Anonymous
Not applicable

Hi @fantomas ,

Closing this as it is a duplicate thread of - Solved: Access token to call Fabric API - Microsoft Fabric Community

Thank you

Anonymous
Not applicable

Hi @fantomas ,

Thanks for using Fabric Community.
Can you please below links to get some insights -
Using FabricRestClient To Make Fabric REST API Calls
Fabric REST API — Data pipelines. This post outlines the various Fabric… | by Aitor Murguzur | Apr, ...

Hope this helps. Do let me know incase of further queries.

Anonymous
Not applicable

Hello @fantomas ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet .
In case if you have any resolution please do share that same with the community as it can be helpful to others .
Otherwise, will respond back with the more details and we will try to help .
Thanks

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

JanFabricDE_carousel

Fabric Monthly Update - January 2025

Explore the power of Python Notebooks in Fabric!

JanFabricDW_carousel

Fabric Monthly Update - January 2025

Unlock the latest Fabric Data Warehouse upgrades!

JanFabricDF_carousel

Fabric Monthly Update - January 2025

Take your data replication to the next level with Fabric's latest updates!