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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Fabric Update Carousel

Fabric Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.