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

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
Samco23
New Member

Azure Monitor Rest API Authentication Data Factory

Hi All,

I am calling the same API in Power BI desktop and Fabric Data Factory. It works ok with Power BI desktop (and service) but I am facing an authentication error in Data Factory. In desktop and service it is Oauth2but data factory does not have this option so I used basic authentication. I am new to working with APIs and API authentication. 

 

Is there a way to use the same authentication I am using for power bi desktop (just my org username) with data factory? Or I have to create a Service Principal for this API?

 

API: https://management.azure.com/subscriptions/{subscriptionID}/resourceGroups/{resourceGroupID}/provide... CPU&top=100&aggregation=average&api-version=2023-10-01&region={region}&metricNamespace=microsoft.compute/virtualmachines&$filter=Microsoft.ResourceId eq '*'"

 

Data Factory Error:

Rest call failed with client error, status code 401 Unauthorized, please check your activity settings.
Response: {"error":{"code":"AuthenticationFailedInvalidHeader","message":"Authentication failed. The 'Authorization' header is provided in an invalid format."}}

 

I tried getting a token by loging in here but I am getting an error:

https://login.microsoftonline.com/common/oauth2/authorize returns error: The request body must contain the following parameter: 'client_id'

 

Do I have to register theAPP like below or there is an easier way?

Register an App to request authorization tokens and work with APIs - Azure Monitor | Microsoft Learn

 

Thanks,
Sam

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Samco23 ,

I think you firstly need to Navigate to the Azure portal -> Subscription -> add your service principal as a Contributor/Owner role in the subscription like below.

vyilongmsft_0-1721023908565.png

 

Then I think in the linked service, configure it like below, fix them with the values.

vyilongmsft_1-1721024026985.png

 

Finally I test the linked service with a copy activity, it works fine.

vyilongmsft_2-1721024113873.png

 

You can also look at this document for a further study: Register a Microsoft Entra app and create a service principal - Microsoft identity platform | Micros...

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Samco23 ,

I think you firstly need to Navigate to the Azure portal -> Subscription -> add your service principal as a Contributor/Owner role in the subscription like below.

vyilongmsft_0-1721023908565.png

 

Then I think in the linked service, configure it like below, fix them with the values.

vyilongmsft_1-1721024026985.png

 

Finally I test the linked service with a copy activity, it works fine.

vyilongmsft_2-1721024113873.png

 

You can also look at this document for a further study: Register a Microsoft Entra app and create a service principal - Microsoft identity platform | Micros...

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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