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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Dynamic Access Token From Power BI - multi-factor authentication MFA

Dear All,

 

Please give me how to get access token from Power BI Desktop. I have a code for get accesstoken

 

 

let
body = "grant_type=password&resource=https://analysis.windows.net/powerbi/api&client_id=*******&username=*******&password=*****",
Data = Json.Document(Web.Contents("https://login.microsoftonline.com/c4d8a220-a9ec-4572-8c77-ab36a3ecdbae/oauth2/token",[Headers=[#"Content-Type"="application/x-www-form-urlencoded"],Content=Text.ToBinary(body)])),
access_token = Data[access_token]
in
access_token

 

 

I already create Power BI app registration from Power BI Services and I sure fill correct client_id, username, password. But when I get the PowerBI Desktop show code (400): Bad Request. Tell me "

Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access ". How can I do this?
 
Many thank.


,  

1 ACCEPTED SOLUTION

Hi @Anonymous ,

It is related to your Azure AD settings, not power bi.

 

The request requires the user to do multi-factor authentication and then send this new token back to Web API 1 and complete the on-behalf-of flow. MFA was enabled by triggering a rule if some action (e.g. sudden location change) was treated as "risky activity". For an account there is a "moved to a new location" flag that can get set, automatically triggering the need for MFA, even if it was initially off.

 

Please check the conditional access locations in Azure AD and check if your AAD admin can clear the flag. Disable MFA for the account or configure conditional access to give access to "Global Admin" role.

 

Here are the suggestions in Azure portal:

1.Login as a tenant admin to https://portal.azure.com
2.Open the registration for your app in the
3.Go to Settings then Required Permissions
4.Press the Grant Permissions button

 

Note: If you are not a tenant admin, you cannot give admin consent

 

Please refer:

  1. Error AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access 
  2. Multi-factor Authentication for Power BI – O365 

 

Best Regards,
Community Support Team _ Yingjie Li
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

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Not full sure, But may be related to Azure AD configuration

refer

https://community.powerbi.com/t5/Developer/Error-AADSTS50076-while-trying-to-login-on-App-owns-data-sample/td-p/257339

https://stackoverflow.com/questions/63938132/embed-powerbi-with-authentication-error-aadsts50076

https://github.com/microsoft/Partner-Center-PowerShell/issues/259

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Dear @amitchandak ,

 

The first thank for your support. 

But I use the Power BI Desktop. I refer here https://www.youtube.com/watch?v=N8qYRSqRz84&t=432s 

I don't able permision for conntact with admin azure to disable MFA for my account. The Power BI Desktop cannot support MFA for get token, right?

 

Thanks

Hi @Anonymous ,

It is related to your Azure AD settings, not power bi.

 

The request requires the user to do multi-factor authentication and then send this new token back to Web API 1 and complete the on-behalf-of flow. MFA was enabled by triggering a rule if some action (e.g. sudden location change) was treated as "risky activity". For an account there is a "moved to a new location" flag that can get set, automatically triggering the need for MFA, even if it was initially off.

 

Please check the conditional access locations in Azure AD and check if your AAD admin can clear the flag. Disable MFA for the account or configure conditional access to give access to "Global Admin" role.

 

Here are the suggestions in Azure portal:

1.Login as a tenant admin to https://portal.azure.com
2.Open the registration for your app in the
3.Go to Settings then Required Permissions
4.Press the Grant Permissions button

 

Note: If you are not a tenant admin, you cannot give admin consent

 

Please refer:

  1. Error AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access 
  2. Multi-factor Authentication for Power BI – O365 

 

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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.