cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
lo92fr Frequent Visitor
Frequent Visitor

Error calling rest api manangement.azure.com from powerbi.com (fail automatic refresh)

Hello,

 

I've get a try to access azure subscription and ressource information using calls to management.azure.com API. Mainly call to 

https://management.azure.com/subscriptions?api-version=2016-06-01

https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2019-04-01

 

My call is using Bearer information for authentification. Calls look like for example:

 

Source = Json.Document(Web.Contents("https://management.azure.com/" & "subscriptions" & "?api-version=2016-06-01",
[Headers=[#"Authorization"="Bearer " & Bearer1 & ""]])),

 

 

Where Bearer1 is a custom functions which look like this:

let
    body = "resource=https://management.azure.com&grant_type=client_credentials&client_id=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx&client_secret=mySecret",
    Source = Json.Document(Web.Contents("https://login.microsoftonline.com/cegidgroup.onmicrosoft.com/oauth2/token", [Content=Text.ToBinary(body)])),
    access_token = Source[access_token]
in
    access_token

 

Everything is working suceffuly in my power bi desktop. I can obtains the access token, and suceffuly refresh my datasource.

 

But when I publish to powerbi.com, the datasource fail to refresh.

If I go in parameters settings to verify the authentification informations, when I do a connection test on my datasource, I obtains this message:

 

Échec de la mise à jour des informations d'identification de la source de données : The credentials provided for the Web source are invalid. (Source at https://management.azure.com/subscriptions.)Masquer les détails

ID d'activité:df428928-fd75-4bc3-9cec-895bf4dfa5a8
ID de demande:f3ee4b45-1c57-a98f-c1b8-2665fadc31fb
Code d'état:400
Heure:Sat Oct 19 2019 10:10:26 GMT+0200 (heure d’été d’Europe centrale)
Version du service:13.0.11109.192
Version du client:1910.2.021
URI du cluster:https://wabi-north-europe-redirect.analysis.windows.net/

 

It seems that the test connection database doesn't pass the Headers information, and so the Bearer.

Do you know of any workaround to this ?

 

A simple solution would be to check the checkbox "ignore connection test".

But if I do this, it seems that I'm unable to refresh the datasource automatically.

 

Thanks,

       Laurent.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
lo92fr Frequent Visitor
Frequent Visitor

Re: Error calling rest api manangement.azure.com from powerbi.com (fail automatic refresh)

Hello Joey, Thanks for your help, but I finnaly manage to solve this error. What I have done is just rewrite my datasource to made the bearer request and the main request in the same functions. After this, it's now work ok. Thanks, Laurent.

View solution in original post

2 REPLIES 2
v-joesh-msft Established Member
Established Member

Re: Error calling rest api manangement.azure.com from powerbi.com (fail automatic refresh)

Hi @lo92fr ,

This issue seems to have different reasons. The following post has similar questions to you and provides some solutions, hope to be helpful:

https://community.powerbi.com/t5/Issues/Failed-to-update-data-source-credentials/idi-p/135313

https://community.powerbi.com/t5/Service/Failed-to-update-data-source-credentials/td-p/479063

https://community.powerbi.com/t5/Issues/Web-API-data-source-refresh-issue/idi-p/395836

Best Regards,

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

lo92fr Frequent Visitor
Frequent Visitor

Re: Error calling rest api manangement.azure.com from powerbi.com (fail automatic refresh)

Hello Joey, Thanks for your help, but I finnaly manage to solve this error. What I have done is just rewrite my datasource to made the bearer request and the main request in the same functions. After this, it's now work ok. Thanks, Laurent.

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 277 members 2,511 guests
Please welcome our newest community members: