Unauthorized error using Purview API: "Not authorized to access account" (403 Forbidden)

Drew Duckworth 61 Reputation points
2022-09-08T04:14:47.563+00:00

Hi. I'm using Postman to query the Purview REST API. Some operations work fine, e.g. beginning with GET https://management.azure.com where the bearer token comes from the https://management.core.windows.net resource. However operations which begin with GET https://xxx.purview.azure.com (i.e. the atlas endpoint) where the bearer token comes from the https://purview.azure.net resource all fail, typically with an 'Unauthorized' (403 Forbidden) error: "Not authorized to access account". Examples of those failing operations are Get All Type Definitions and Get Detailed Glossary.

I've followed the tutorial closely, but can't see where I'm going wrong.
I've also added the required roles to the service principal to the Purview root collection:

  • Collection admin
  • Data source admin
  • Data curator
  • Data reader

The get accounts operation also fails, but with a different error: "The client 'xxx' with object id 'xxx' does not have authorization to perform action 'Microsoft.Purview/accounts/read' over scope '/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Purview/accounts/xxx' or the scope is invalid. If access was recently granted, please refresh your credentials."

I'm at a bit of a loss as to how to proceed. Both examples I found are to do with assigning permissions in Purview:

With thanks, Drew

Microsoft Purview
Microsoft Purview
A Microsoft data governance service that helps manage and govern on-premises, multicloud, and software-as-a-service data. Previously known as Azure Purview.
930 questions
0 comments No comments
{count} votes

Accepted answer
  1. KranthiPakala-MSFT 46,422 Reputation points Microsoft Employee
    2022-09-09T00:27:23.153+00:00

    Hello @Drew Duckworth ,

    Thanks for the question and using MS Q&A platform.

    Seems like you have already provided the necessary permissions to the Service Principal as mentioned in the public doc: Set up authentication using service principal
    Could you please make sure that you are using the correct secret value for your client_id field, I have seen users confusing between secret value and secret id hence wanted to highlight that.

    239264-image.png

    Another thing I would suggest you double check is to make sure if you have provided the Purview API permissions to your registered application. If not could you please apply those permissions and see if that helps to resolve the issue.

    239206-image.png

    Regarding the below error message, as per my analysis, it is a deprecated role as per below, but I will continue to investigate more on this and will share my findings. In the meantime, could you please verify the above.

    239291-image.png

    239215-image.png

    keep us posted how it goes.

    Thank you

    1 person found this answer helpful.

5 additional answers

Sort by: Most helpful
  1. Drew Duckworth 61 Reputation points
    2022-11-02T04:22:44.667+00:00

    I worked through the support ticket with Microsoft SMEs, and found that the issue was with the permissions. I had granted the Purview Service Principal access to the appropriate roles in Purview, e.g. Collection admin. But I needed to grant those permissions to the app registration instead (i.e. the other Service Principal). This isn't clear in the doco (https://learn.microsoft.com/en-us/azure/purview/tutorial-using-rest-apis) for those of us unfamiliar with the ecosystem.

    Thanks for your assistance with this.
    Regards, Drew

    2 people found this answer helpful.

  2. srikrishnan balasubramanian 0 Reputation points
    2023-06-15T23:58:41.48+00:00

    hi Drew Duckworth , We are facing similar issue. May I know what exactly u mean by this statement "But I needed to grant those permissions to the app registration instead (i.e. the other Service Principal)."


  3. Cayir Aydar, Aysegul 0 Reputation points
    2023-07-27T14:22:44.7366667+00:00

    @Drew Duckworth, could you solve this issue. I am facing same thing.

    0 comments No comments

  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more