Forum Discussion
MWLjdb
Nov 10, 2021Brass Contributor
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?
- Difference for me using Piethein's excellent instructions was the change of resource from 'https://management.core.windows.net/' (getting that "Invalid token audience" error) to 'https://purview.azure.net'.
- Mario_BustosCopper Contributor
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.
- GuillaumeBerthierBrass Contributoryes I'm getting the same error, did you find out what was the problem ?
- MWLjdbBrass 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.
- GuillaumeBerthierBrass 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 "}}