Forum Discussion

MWLjdb's avatar
MWLjdb
Brass Contributor
Nov 10, 2021
Solved

API to Azure Purview

I can successfully generate the bearer token via API to our purview instance, but any time I try any other API call, I get the following.  This includes using the "Try it" button from the API documentation:  

 

{"error":{"code":"Unauthenticated","message":"Invalid token audience https://management.core.windows.net/. Valid audiences: 73c2949e-da2d-457a-9607-fcc665198967,https://purview.azure.net,https://purview.azure.net/"}}

or the following from Postman:

{"error":{"code":"Unauthenticated","message":"Invalid token audience 00000002-0000-0000-c000-000000000000. Valid audiences: 73c2949e-da2d-457a-9607-fcc665198967,https://purview.azure.net,https://purview.azure.net/"}}

 

has anyone ran into this and have an idea of what I might be missing? 

  • Mario_Bustos's avatar
    Mario_Bustos
    Copper Contributor

    MWLjdb 

    Hello everyone.
    I was having this same issue in 2024:

     

    Everytime I tried to get a response from the Purview REST API I was having this message:

    {"error":{"code":"Unauthenticated","message":"Invalid token audience https://management.core.windows.net/. Valid audiences: 73c2949e-da2d-457a-9607-fcc665198967,https://purview.azure.net,https://purview.azure.net/"}}

     

    At first I was filling the "resource" parameter with "https://purview.azure.net" in the token api call: 

    https://login.microsoftonline.com/{{your-tenant-id}}/oauth2/token

     

    The solution I found was filling the "resource" parameter in the token call with 73c2949e-da2d-457a-9607-fcc665198967 which is the value I was getting in the previous response.

     

     

    After this, the token was valid to make calls to the Purview REST API.

     

    • MWLjdb's avatar
      MWLjdb
      Brass Contributor

      GuillaumeBerthier, unfortunately I have not.  Sidetracked to other priorities.  I couldn't even get Microsoft's API "Try Me" in their documentation to work.  I was told to open a ticket, I will when I can get back to Purview.

      • GuillaumeBerthier's avatar
        GuillaumeBerthier
        Brass Contributor

        MWLjdb actually by digging a bit more I found an article (here) from @pietheinstrengholt explaining step by step how to use Azure Purview's API and it worked ! (*)

        ....by the way all of the other articles from Piethein are very interesting (Piethein Strengholt – Medium) , a lot of good materials for Azure Purview, Azure Synapse, Spark, Data Mesh...ect

        (*) not more.... {"error":{"code":"Unauthenticated","message":"Invalid token audience 00000002-0000-0000-c000-000000000000. Valid audiences: 73c2949e-da2d-457a-9607-fcc665198967, https://purview.azure.net "}}

Resources