Quickly Generate API Access Token value from Azure in Postman Tool​

Quickly 2 Ways Generate Azure Access Token Using Postman Tool Step By Step

No comments

Loading

In this article, we will learn how to generate an Azure Access Token using Postman tool step by step along with the common troubleshooting techniques.

Introduction – Generate Azure Access Token Using Postman Tool

When working with Azure services and Microsoft Graph API, you often need to authenticate API requests using an OAuth 2.0 access token. One of the easiest ways to generate this token is through the Postman tool. In this guide, we will walk you through the step-by-step process of generating an Azure access token using Postman.

Prerequisites

Before getting started, ensure that you have the following:

  • An Azure Active Directory (Azure AD) account.
  • An Azure App Registration (if not created, follow the steps below).
  • The Postman tool installed on your system.
  • Required API permissions granted in Azure App Registration.

Step 1: Register an Application in Azure Active Directory

To generate an access token, you need to register an application in Azure AD.

1. Go to Azure AD App Registration

  1. Log in to the Azure Portal.
  2. Navigate to Azure Active Directory > App Registrations.
  3. Click New Registration.
  4. Provide the following details:
    • Name: Postman API Access (or any meaningful name).
    • Supported Account Types: Choose Single Tenant (default) or Multi-Tenant as per your requirement.
    • Click Register.

2. Get Client ID and Tenant ID

  1. Once registered, go to the Overview section.
  2. Copy Application (client) ID and Directory (tenant) ID – you will need these in Postman.

3. Add API Permissions

  1. In the App Registration, go to API Permissions.
  2. Click Add a permission > Microsoft Graph (or any required API).
  3. Choose Delegated permissions (for user authentication) or Application permissions (for app-only access).
  4. Click Add permissions.
  5. Click Grant admin consent to approve the permissions.

4. Generate Client Secret

  1. Navigate to Certificates & Secrets.
  2. Click New Client Secret.
  3. Provide a description and set an expiration period.
  4. Click Add and copy the generated Client Secret (save it securely, as you won’t see it again).

Refer to this article for the detailed steps on how to create a new app registration in Azure Portal: App Registration in Azure: Quickly How Do I Register an Application Step by Step?

Step 2: Generate an Access Token in Postman

Now that we have the Azure App Registration ready, let’s configure Postman to obtain an access token.

1. Open Postman and Create a New Request

  1. Open Postman and click New Request.
  2. Set the request type to POST.
  3. In the URL field, enter the token endpoint:
    https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token

    Replace {tenant_id} with your Directory (tenant) ID from Azure.

2. Configure the Request Body

  1. Go to the Body tab.
  2. Select x-www-form-urlencoded.
  3. Add the following key-value pairs:
    Key Value
    grant_type client_credentials
    client_id {your_client_id}
    client_secret {your_client_secret}
    scope https://graph.microsoft.com/.default (or your required API scope)

3. Send the Request

  1. Click Send.
  2. If successful, you will receive a response containing the access token:
    {
        "token_type": "Bearer",
        "expires_in": 3600,
        "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIn..."
    }
  3. Copy the access token – you will use it to authenticate API requests.

Alternate approach: Generate an Access Token in Postman Without the POST method

This approach is simpler than the above one.

Authorization Set up

Log in to your Postman tool.

Create a sample new GET request (we will not send the request; this is needed just to get into the right navigation).

Click on the “Authorization” tab.

Select the “Auth Type” as “OAUth 2.0.”.

Authorization in postman tool for API Testing
Authorization in postman tool for API Testing

Configure New Token

If you scroll down a little, you will get a section called “Configure New Token.”.

Configure new token in Postman tool
Configure new token in Postman tool

Where pass the below parameters:

  • Token Name: Any valid name
  • Grant type: Select as “Client Credentials.”
  • Access Token URL: Access token URL Get it from the above section I have mentioned.
  • Client ID: Get it from your app registration in Azure.
  • Client Secret: Get it from your app registration in Azure.
  • Scope: Get it from the above key-value pair table.

After this configuration, you need to further scroll down where you will see this button “Get new access token“; click on this.

Get new access token in Postman tool
Get new access token in Postman tool

Once you click on the “Get new Access Token” button, you will get the below authentication complete status message, like this dialog box will automatically close in a few seconds.

Authentication completion status
Authentication completion status

Then, you can see your access token as shown below:

Manage access tokens in Postman tool
Manage access tokens in Postman tool

Click on the “Use Token” button to use this access token in your subsequent API call from the Postman tool. Now, you can use this access token in your code for your application integration and Graph API call. The access token will look like below with the token type like “Bearer.”

Generate Azure Access Token Using Postman Tool Demo
Generate Azure Access Token Using Postman Tool Demo

Notes:

  • You can enable this toggle for the auto-refresh token—your expired token will be auto-refreshed before sending a request.
  • To debug your access token, whether it has come from the right app from your Azure portal, use this tool: Access Token Debugger Tool

Step 3: Use the Access Token in API Calls

Once you have the access token, you can use it to call Microsoft Graph API or other Azure services.

1. Create a New API Request in Postman

  1. Open Postman and create a new request.
  2. Set the request type to GET.
  3. Enter the API endpoint URL (e.g., to get SharePoint sites):
    https://graph.microsoft.com/v1.0/sites
  4. Go to the Headers section and add:
    Key Value
    Authorization Bearer {your_access_token}

2. Send the Request and Verify Response

  1. Click Send.
  2. If authenticated correctly, you will receive the API response with data.

Troubleshooting Common Errors

1. Access Denied (scp or roles claim missing error)

  • Ensure you have granted admin consent to API permissions.
  • Use the correct scope value when requesting the token.

2. Invalid Token Signature (SecurityTokenInvalidSignature error)

  • Verify that you are using the correct client secret.
  • Ensure the token request is hitting the correct Azure tenant ID.

3. Empty API Response (value: [] in response)

  • Ensure that the signed-in user or app has access to the requested API resources.
  • Use $select query parameters to specify required fields.

Conclusion

Thus, in this article, we have learned how to generate an Azure access token using the Postman tool with the two approaches.

In this guide, we covered how to generate an Azure access token using Postman step by step. This token allows you to authenticate and interact with Microsoft Graph API, SharePoint Online, and other Azure services securely. By following this process, you can seamlessly integrate Azure authentication into your workflows.

Do you have any questions or issues? Let me know in the comments below!

YouTube Video Demo:

About Post Author


Discover more from Global SharePoint

Subscribe to get the latest posts sent to your email.

Do you have a better solution or question on this topic? Please leave a comment