Azure Service tags REST API Authentication

Nahim Medellin 1 Reputation point
2022-02-03T19:11:29.31+00:00

Hi, I am trying to make a code that consumes via GET this Microsoft API but I get an AuthenticationFailed error when trying to use the GET by itself. However, when I access the documentation (https://learn.microsoft.com/en-us/rest/api/virtualnetwork/service-tags/) and click on the Try it button,

171075-image.png

I am prompted to sign in and then I am given a token

171094-image.png

If I hard code that token into my request header it successfully returns the info I need, so I know my HTTP request is not the problem, the problem is I do not know how to get that token from within my Python script. I have read so much documentation but all of it is oriented to APIs one has made within Azure, but I did not make this API since it is Microsoft's so I do not have the info I need to follow that documentation.

Anyone has any idea how to approach this? I am running out of options.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Authenticator
0 comments No comments
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.