Issue while accessing Azure Policy REST API in Power BI - Getting Error: Access to the resource is forbidden

Jil Kachhia 0 Reputation points
2024-05-22T16:17:53.7866667+00:00

I am trying to access Azure Policy Compliance data from Azure Policy REST API to Power BI. To access the Azure API into Power BI, I have registered an application in Entra ID and generated Client ID and Client Secret. In the App Permission, I have selected Azure Service Management and added delegated permission "user_impersonation" and Admin consent is granted. The app created in entra id havs given "Global Reader" role.

Using the above information, I have generated access token and applied it in the header of the API request from Power BI. I am using Web connector option in Power BI. When I am trying to connect, I am getting an error "Access to the resource is forbidden".

Any leads will be appreciated.

Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
816 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Monalla-MSFT 12,596 Reputation points
    2024-06-04T12:27:17.4566667+00:00

    @Jil Kachhia - Welcome to Microsoft Q&A and thanks for reaching out to us.

    The "Access to the resource is forbidden" error typically indicates that the access token you are using does not have the necessary permissions to access the Azure Policy Compliance data. Please check below for some troubleshooting steps that can help resolve the issue.

    1. Ensure that the Azure AD application you registered has the necessary permissions to access the Azure Policy Compliance data. Specifically, the application needs the "Reader" role on the subscription or resource group that contains the Azure Policy Compliance data.
    2. Ensure that the API request you are making is correctly formatted and includes the necessary headers and parameters. Specifically, the request needs to include the access token in the "Authorization" header and the correct API endpoint URL.
    3. Ensure that the Azure Policy Compliance data you are trying to access is correctly configured and accessible by REST API.

    Hope this helps. and please feel free to reach out if you have any further questions.


    Please don't forget to "Accept as Answer" and click "Yes" if the above response is helpful, so it can be beneficial to the community.

    0 comments No comments