Month: October 2021

Logging in to Azure as yourself, but from Postman

A simple self-reminding how to

First of all, thank you to @ToonVanhoutte for writing the original post on how to get the bearer token using Fiddler (super sneaky!) and also to @splaxi (Mötz Jensen) who provided the PowerShell solution.

What are you trying to do?

Hopefully you found this post while googling “logging into azure as a user from postman” or “postman azure as user”. Most posts (including my own) are about how to access Azure APIs from Postman using an App Registration.

Sometimes that is not an option, and your account might actually have enough access-rights to get the information you want. The problem is that sometimes, the portal is not up to the task.

Using Postman to log into Azure as yourself

Rumor has it that it is possible to do this, using just postman but I was not able to, but a simple PowerShell script does the trick.

If you run the following script, you will log in and copy the bearer token to the clipboard. Then you paste it into the token textbox in Postman and you are good for about an hour untill your token has expired.

The powershell script

# Install-Module Az.Accounts

# Login as a user
Connect-AzAccount

# Get the token, and store it in the clipboard.
Get-AzAccessToken | Select-Object -ExpandProperty Token | Set-Clipboard

Note that you need to install the Az.Accounts module for this to work.

When you run this script you will get the old Login Window(tm), you login and when the script is done, the bearer is in the clipboard.

Postman

Return to Postman and find the Authorization tab. Select Bearer Token and paste the copied token into the textbox. That is it.