Forum Discussion
Graph api, keep getting "Access to the resource is forbidden"
- 1 year ago
HI Anonymous ,
Thanks for the follow-up.
You can refer to the following links for guidance on configuring Azure Key Vault for use within the Power BI Service:
Bring your own encryption keys for Power BI - Power BI | Microsoft LearnHow to access Azure KeyVault from Power BI Query t... - Microsoft Fabric Community
Re: How to access Azure KeyVault from Power BI Que... - Microsoft Fabric Community
Hope this helps. Please reach out for further assistance.
Please consider marking the helpful reply as Accepted Solution and giving kudos to assist others with similar issues.
Hi Anonymous ,
Thanks for your question in Microsoft Fabric Community.
Power BI does not support authenticating to Microsoft Graph API using only user credentials (username and password), particularly in the context of scheduled refresh in the Power BI Service.
This is because Microsoft Graph requires authentication using OAuth 2.0, and all flows depend on a registered Azure AD application. Whether you're using delegated permissions (on behalf of a user) or application permissions (for service-level access), the presence of an App ID is required to issue an access token.
In Power BI Desktop, you might see prompts for user credentials when connecting via OData feed (e.g. https://graph.microsoft.com/v1.0/users). However, this delegated approach does not work when you publish the report to Power BI Service, as the service cannot impersonate a signed-in user or manage delegated tokens. As a result, you encounter the "Access to the resource is forbidden" error.
The supported and secure approach is to register an application in Azure AD, assign the necessary Microsoft Graph API permissions (such as User.Read.All), and authenticate using an App ID and either a client secret or certificate. This method is compatible with Power BI’s scheduled refresh model.
To avoid hardcoding secrets, you can store credentials securely in Azure Key Vault and reference them in Power BI Dataflows, which offers a cleaner and more secure setup. As tharunkumarRTK suggested, using a custom connector is also a valid path if you need more control over the API calls or token handling.
Here are some similar and useful resources:
Solved: Service Principal authentication (for Graph API) w... - Microsoft Fabric Community
Authentication and authorization basics - Microsoft Graph | Microsoft Learn
Choose a Microsoft Graph authentication provider - Microsoft Graph | Microsoft Learn
Hope this helps. Please reach out for further assistance.
If this post helps, then please consider to give a kudos and Accept as the solution to help the other members find it more quickly.
Thank you.
Thanks v-veshwara-msft
As I already have the the approach of an application in Azure AD, assign the necessary Microsoft Graph API permissions (such as User.Read.All), and authenticate using an App ID with the client secret what I need to solve then as you and tharunkumarRTK suggest is to sue Azure Key Vault.
You mention:
"To avoid hardcoding secrets, you can store credentials securely in Azure Key Vault and reference them in Power BI Dataflows, which offers a cleaner and more secure setup"
I'm not sure how to do this, I'm using powerbi M to code this and not sure how to get the credential from vault secret. Any example I can follow?
Thanks Ahead of time...
- v-veshwara-msft1 year ago
Community Support
HI Anonymous ,
Thanks for the follow-up.
You can refer to the following links for guidance on configuring Azure Key Vault for use within the Power BI Service:
Bring your own encryption keys for Power BI - Power BI | Microsoft LearnHow to access Azure KeyVault from Power BI Query t... - Microsoft Fabric Community
Re: How to access Azure KeyVault from Power BI Que... - Microsoft Fabric Community
Hope this helps. Please reach out for further assistance.
Please consider marking the helpful reply as Accepted Solution and giving kudos to assist others with similar issues.