In this post, we will look at how to get a bearer token using Postman for connecting to Azure resources.
First, let’s open Postman and create a new collection, then a new Request:
Next, let’s create our request.
The URL we will hit is in the format https://login.microsoftonline.com/{tenantid}/oauth2/token. To find your Azure tenant id, go to https://portal.azure.com and search for Azure Active Directory:
Your tenant id is here:
Now add that to the Postman URL, so your request looks like this:
Next, go to the Body tab and select x-www-form-urlencoded:
We will now add some key/value pairs.
First the key is grant_type and value is client_credentials:
Next, we will need a client id. In Azure, select App Registrations:
Register an app, something like below:
Now we have an Application (client) id:
Create a key for client_id and copy the value from above:
Now let’s add a client secret:
We see the value and secret id:
Now, provide the resource. We can see API Permissions this app has access to by going to API Permissions. We see this API has a permission to https://graph.microsoft.com:
We can add other permissions by clicking on Add a permission:
Some other resources include:
- https://auth.msft.communication.azure.com (Azure Communication Services)
- https://aadrm.com/ (Azure Rights Management Services)
- https://aadrm.com/ (Azure Service Management)
- https://admin.services.crm.dynamics.com/ (Dynamics CRM)
- https://admin.services.crm.dynamics.com/ (Flow Service)
- https://manage.office.com/ (Office 365 Management APIs)
- https://manage.office.com/ (Power BI Service)
Our request should now look like below. Click Send, and we see we get the Bearer token in the response:
I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.
IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.
THANK YOU, AND LET'S KEEP LEARNING TOGETHER.
CARL
Hello Carl,
Whats the Redirect URL provided on app registration. Could you explain