Microsoft Azure Get Token API

The Get Token API from Microsoft Azure, for get token.

GitHub OpenAPI

Operations 1

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /identity/oauth2/token Get a managed identity access token · Microsoft Azure Get Identity Oauth2 Token #
Ask an LLM
“How does code on an Azure VM get an Azure AD token from its managed identity?”
“Can I pick a specific user-assigned identity by client id when requesting a token?”
Tell an agent
Get a managed identity token for resource {resource} with Metadata set to {metadata}.
Request a token for {resource} using the user-assigned identity with client id {client_id}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/microsoft-azure:microsoft-azure-get-token-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

microsoft-azure-get-token-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Microsoft Azure InstanceMetadataClient Get Token API
  description: The Azure Instance Metadata Client
  version: '2020-09-01'
servers:
- url: http://169.254.169.254/metadata
- url: https://169.254.169.254/metadata
tags:
- name: Get Token
paths:
  /identity/oauth2/token:
    get:
      tags:
      - Get Token
      description: Get a Token from Azure AD
      operationId: microsoftAzureIdentityGettoken
      security:
      - {}
      - basic_auth: []
      parameters:
      - $ref: '#/components/parameters/MetadataParameter'
      - name: resource
        in: query
        description: This is the urlencoded identifier URI of the sink resource for the requested Azure AD token. The resulting token contains the corresponding aud for this resource.
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/ApiVersionParameter'
      - name: client_id
        in: query
        description: This identifies, by Azure AD client id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with object_id and msi_res_id.
        required: false
        schema:
          type: string
      - name: object_id
        in: query
        description: This identifies, by Azure AD object id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and msi_res_id.
        required: false
        schema:
          type: string
      - name: msi_res_id
        in: query
        description: This identifies, by urlencoded ARM resource id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and object_id.
        required: false
        schema:
          type: string
      - name: authority
        in: query
        description: This indicates the authority to request AAD tokens from. Defaults to the known authority of the identity to be used.
        required: false
        schema:
          type: string
      - name: bypass_cache
        in: query
        description: If provided, the value must be 'true'. This indicates to the server that the token must be retrieved from Azure AD and cannot be retrieved from an internal cache.
        required: false
        x-ms-enum:
          name: BypassCache
          modelAsString: true
        schema:
          type: string
          enum:
          - 'true'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentityTokenResponse'
        default:
          headers:
            Www-Authenticate:
              description: This is the response header containing a challenge for the Basic scheme with a realm value
              schema:
                type: string
          description: Error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentityErrorResponse'
      x-ms-examples:
        Get Identity Token for the VM:
          $ref: ./examples/GetIdentityToken.json
      summary: Microsoft Azure Get Identity Oauth2 Token
components:
  parameters:
    ApiVersionParameter:
      name: api-version
      in: query
      description: This is the API version to use.
      required: true
      x-ms-enum:
        name: ApiVersion
        modelAsString: true
      schema:
        type: string
        enum:
        - '2018-10-01'
    MetadataParameter:
      name: Metadata
      in: header
      description: This must be set to 'true'.
      required: true
      x-ms-parameter-location: method
      schema:
        type: string
        enum:
        - 'true'
  schemas:
    IdentityErrorResponse:
      type: object
      description: This is the response from an Identity operation in the case an error occurs.
      properties:
        error:
          type: string
          description: Error code
          enum:
          - invalid_request
          - unauthorized_client
          - access_denied
          - unsupported_response_type
          - invalid_scope
          - server_error
          - service_unavailable
          - bad_request
          - forbidden
          - not_found
          - method_not_allowed
          - too_many_requests
          x-ms-enum:
            name: Error
            modelAsString: true
        error_description:
          type: string
          description: Error message indicating why the operation failed.
    IdentityTokenResponse:
      type: object
      description: This is the response from the Identity_GetToken operation.
      properties:
        access_token:
          type: string
          description: This is the requested access token. The app can use this token to authenticate to the sink resource.
        expires_in:
          type: string
          description: This is how long the access token is valid (in seconds).
        expires_on:
          type: string
          description: This is the time when the access token expires. The date is represented as the number of seconds from 1970-01-01T0:0:0Z UTC until the expiration time. This value is used to determine the lifetime of cached tokens.
        ext_expires_in:
          type: string
          description: This indicates the extended lifetime of the token (in seconds).
        not_before:
          type: string
          description: This is the time when the access token becomes effective. The date is represented as the number of seconds from 1970-01-01T0:0:0Z UTC until the expiration time.
        resource:
          type: string
          description: This is the app ID URI of the sink resource.
        token_type:
          type: string
          description: This indicates the token type value.
        client_id:
          type: string
          description: This is the client_id specified in the request, if any.
        object_id:
          type: string
          description: This is the object_id specified in the request, if any.
        msi_res_id:
          type: string
          description: This is the msi_res_id specified in the request, if any.
  securitySchemes:
    basic_auth:
      type: http
      scheme: basic
      description: A Basic authentication flow
x-provenance:
  method: harvested
  publisher: Microsoft Azure
  source: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/imds/data-plane/Microsoft.InstanceMetadataService/stable/2019-02-01/imds.json
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)