Microsoft Entra ID (formerly Azure AD) Service Principals.token Lifetime Policy API

The servicePrincipals.tokenLifetimePolicy API from Microsoft Entra ID (formerly Azure AD) — 4 operation(s) for serviceprincipals.tokenlifetimepolicy.

Business capability
Identity & Access Management BC-620.20

Operations 6

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 /servicePrincipals/{servicePrincipal-id}/tokenLifetimePolicies List token lifetime policies on a service principal · List assigned tokenLifetimePolicies #
Ask an LLM
“Which token lifetime policy is assigned to an enterprise app's service principal?”
“Can I read the full token lifetime policy object applied to a service principal?”
Tell an agent
List the token lifetime policies assigned to service principal {sp}, with full details.
Show the token lifetime policy settings on service principal {sp}.
DELETE /servicePrincipals/{servicePrincipal-id}/tokenLifetimePolicies/{tokenLifetimePolicy-id}/$ref Unassign a token lifetime policy by id · Remove tokenLifetimePolicies #
Ask an LLM
“How do I remove a specific token lifetime policy from a service principal?”
“Can I unassign a token lifetime policy by putting its id in the URL path?”
Tell an agent destructive · confirm first
Remove token lifetime policy {policy} from service principal {sp}.
Unassign policy {policy} from service principal {sp} using its path id.
GET /servicePrincipals/{servicePrincipal-id}/tokenLifetimePolicies/$count Count token lifetime policies on a service principal · Get the number of the resource #
Ask an LLM
“Does this service principal have a token lifetime policy, going by the count?”
“What's the number of token lifetime policies assigned to a service principal?”
Tell an agent
Count the token lifetime policies on service principal {sp}.
Tell me how many token lifetime policies service principal {sp} has.
GET /servicePrincipals/{servicePrincipal-id}/tokenLifetimePolicies/$ref List token lifetime policy references · List assigned tokenLifetimePolicies #
Ask an LLM
“Can I get just the reference link of a service principal's token lifetime policy?”
“Which token lifetime policy id is linked to a service principal, without the full object?”
Tell an agent
List the token lifetime policy references ($ref) on service principal {sp}.
Return only the @odata.id link of the token policy on service principal {sp}.
POST /servicePrincipals/{servicePrincipal-id}/tokenLifetimePolicies/$ref Assign a token lifetime policy to a service principal · Add tokenLifetimePolicy #
Ask an LLM
“How do I apply a token lifetime policy to a service principal?”
“Can I assign more than one token lifetime policy to the same service principal?”
Tell an agent
Assign token lifetime policy {policy_ref} to service principal {sp}.
Link the policy at {policy_ref} to service principal {sp} to control its token lifetimes.
DELETE /servicePrincipals/{servicePrincipal-id}/tokenLifetimePolicies/$ref Unassign a token lifetime policy by reference query · Remove tokenLifetimePolicies #
Ask an LLM
“Can I remove a token lifetime policy from a service principal by passing its @id as a query parameter?”
“What is the collection-level way to detach a token lifetime policy?”
Tell an agent destructive · confirm first
Remove the policy referenced by {policy_ref} from service principal {sp} via the @id query.
Detach {policy_ref} from service principal {sp} using the tokenLifetimePolicies $ref collection.

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/azure-ad:azure-ad-serviceprincipals-tokenlifetimepolicy-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

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. See our Privacy Policy and Terms.

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

OpenAPI Specification

azure-ad-serviceprincipals-tokenlifetimepolicy-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Applications Service Principals.token Lifetime Policy API
  version: v1.0
servers:
- url: https://graph.microsoft.com/v1.0/
  description: Core
security:
- azureaadv2: []
tags:
- name: servicePrincipals.tokenLifetimePolicy
paths:
  /servicePrincipals/{servicePrincipal-id}/tokenLifetimePolicies:
    get:
      tags:
      - servicePrincipals.tokenLifetimePolicy
      summary: List assigned tokenLifetimePolicies
      description: List the tokenLifetimePolicy objects that are assigned to a servicePrincipal. Only one object is returned in the collection because only one tokenLifetimePolicy can be assigned to a service principal.
      externalDocs:
        description: Find more info here
        url: https://learn.microsoft.com/graph/api/serviceprincipal-list-tokenlifetimepolicies?view=graph-rest-1.0
      operationId: servicePrincipal_ListTokenLifetimePolicy
      parameters:
      - name: servicePrincipal-id
        in: path
        description: The unique identifier of servicePrincipal
        required: true
        style: simple
        schema:
          type: string
        x-ms-docs-key-type: servicePrincipal
      - $ref: '#/components/parameters/top'
      - $ref: '#/components/parameters/skip'
      - $ref: '#/components/parameters/search'
      - $ref: '#/components/parameters/filter'
      - $ref: '#/components/parameters/count'
      - name: $orderby
        in: query
        description: Order items by property values
        style: form
        explode: false
        schema:
          uniqueItems: true
          type: array
          items:
            type: string
      - name: $select
        in: query
        description: Select properties to be returned
        style: form
        explode: false
        schema:
          uniqueItems: true
          type: array
          items:
            type: string
      - name: $expand
        in: query
        description: Expand related entities
        style: form
        explode: false
        schema:
          uniqueItems: true
          type: array
          items:
            type: string
      responses:
        2XX:
          $ref: '#/components/responses/microsoft.graph.tokenLifetimePolicyCollectionResponse'
        default:
          $ref: '#/components/responses/error'
      x-ms-pageable:
        nextLinkName: '@odata.nextLink'
        operationName: listMore
      x-ms-docs-operation-type: operation
  /servicePrincipals/{servicePrincipal-id}/tokenLifetimePolicies/{tokenLifetimePolicy-id}/$ref:
    delete:
      tags:
      - servicePrincipals.tokenLifetimePolicy
      summary: Remove tokenLifetimePolicies
      description: Remove a tokenLifetimePolicy object from a service principal.
      externalDocs:
        description: Find more info here
        url: https://learn.microsoft.com/graph/api/serviceprincipal-delete-tokenlifetimepolicies?view=graph-rest-1.0
      operationId: servicePrincipal.tokenLifetimePolicy_DeleteTokenLifetimePolicyGraphBPreRef
      parameters:
      - name: servicePrincipal-id
        in: path
        description: The unique identifier of servicePrincipal
        required: true
        style: simple
        schema:
          type: string
        x-ms-docs-key-type: servicePrincipal
      - name: tokenLifetimePolicy-id
        in: path
        description: The unique identifier of tokenLifetimePolicy
        required: true
        style: simple
        schema:
          type: string
        x-ms-docs-key-type: tokenLifetimePolicy
      - name: If-Match
        in: header
        description: ETag
        style: simple
        schema:
          type: string
      responses:
        2XX:
          description: Success
        default:
          $ref: '#/components/responses/error'
      x-ms-docs-operation-type: operation
  /servicePrincipals/{servicePrincipal-id}/tokenLifetimePolicies/$count:
    get:
      tags:
      - servicePrincipals.tokenLifetimePolicy
      summary: Get the number of the resource
      operationId: servicePrincipal.tokenLifetimePolicy_GetCount
      parameters:
      - name: servicePrincipal-id
        in: path
        description: The unique identifier of servicePrincipal
        required: true
        style: simple
        schema:
          type: string
        x-ms-docs-key-type: servicePrincipal
      - $ref: '#/components/parameters/search'
      - $ref: '#/components/parameters/filter'
      responses:
        2XX:
          $ref: '#/components/responses/ODataCountResponse'
        default:
          $ref: '#/components/responses/error'
  /servicePrincipals/{servicePrincipal-id}/tokenLifetimePolicies/$ref:
    get:
      tags:
      - servicePrincipals.tokenLifetimePolicy
      summary: List assigned tokenLifetimePolicies
      description: List the tokenLifetimePolicy objects that are assigned to a servicePrincipal. Only one object is returned in the collection because only one tokenLifetimePolicy can be assigned to a service principal.
      externalDocs:
        description: Find more info here
        url: https://learn.microsoft.com/graph/api/serviceprincipal-list-tokenlifetimepolicies?view=graph-rest-1.0
      operationId: servicePrincipal_ListTokenLifetimePolicyGraphBPreRef
      parameters:
      - name: servicePrincipal-id
        in: path
        description: The unique identifier of servicePrincipal
        required: true
        style: simple
        schema:
          type: string
        x-ms-docs-key-type: servicePrincipal
      - $ref: '#/components/parameters/top'
      - $ref: '#/components/parameters/skip'
      - $ref: '#/components/parameters/search'
      - $ref: '#/components/parameters/filter'
      - $ref: '#/components/parameters/count'
      - name: $orderby
        in: query
        description: Order items by property values
        style: form
        explode: false
        schema:
          uniqueItems: true
          type: array
          items:
            type: string
      responses:
        2XX:
          $ref: '#/components/responses/StringCollectionResponse'
        default:
          $ref: '#/components/responses/error'
      x-ms-pageable:
        nextLinkName: '@odata.nextLink'
        operationName: listMore
      x-ms-docs-operation-type: operation
    post:
      tags:
      - servicePrincipals.tokenLifetimePolicy
      summary: Add tokenLifetimePolicy
      description: Assign a tokenLifetimePolicy to a servicePrincipal. You can have multiple tokenLifetimePolicy policies in a tenant but can assign only one tokenLifetimePolicy per service principal.
      externalDocs:
        description: Find more info here
        url: https://learn.microsoft.com/graph/api/serviceprincipal-post-tokenlifetimepolicies?view=graph-rest-1.0
      operationId: servicePrincipal_CreateTokenLifetimePolicyGraphBPreRef
      parameters:
      - name: servicePrincipal-id
        in: path
        description: The unique identifier of servicePrincipal
        required: true
        style: simple
        schema:
          type: string
        x-ms-docs-key-type: servicePrincipal
      requestBody:
        $ref: '#/components/requestBodies/refPostBody'
      responses:
        2XX:
          description: Success
        default:
          $ref: '#/components/responses/error'
      x-ms-docs-operation-type: operation
    delete:
      tags:
      - servicePrincipals.tokenLifetimePolicy
      summary: Remove tokenLifetimePolicies
      description: Remove a tokenLifetimePolicy object from a service principal.
      externalDocs:
        description: Find more info here
        url: https://learn.microsoft.com/graph/api/serviceprincipal-delete-tokenlifetimepolicies?view=graph-rest-1.0
      operationId: servicePrincipal_DeleteTokenLifetimePolicyGraphBPreRef
      parameters:
      - name: servicePrincipal-id
        in: path
        description: The unique identifier of servicePrincipal
        required: true
        style: simple
        schema:
          type: string
        x-ms-docs-key-type: servicePrincipal
      - name: If-Match
        in: header
        description: ETag
        style: simple
        schema:
          type: string
      - name: '@id'
        in: query
        description: The delete Uri
        required: true
        style: form
        explode: false
        schema:
          type: string
      responses:
        2XX:
          description: Success
        default:
          $ref: '#/components/responses/error'
      x-ms-docs-operation-type: operation
components:
  responses:
    error:
      description: error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/microsoft.graph.ODataErrors.ODataError'
    StringCollectionResponse:
      description: Retrieved collection
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StringCollectionResponse'
    microsoft.graph.tokenLifetimePolicyCollectionResponse:
      description: Retrieved collection
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/microsoft.graph.tokenLifetimePolicyCollectionResponse'
    ODataCountResponse:
      description: The count of the resource
      content:
        text/plain:
          schema:
            $ref: '#/components/schemas/ODataCountResponse'
  schemas:
    microsoft.graph.ODataErrors.InnerError:
      type: object
      additionalProperties:
        type: object
      description: The structure of this object is service-specific
    StringCollectionResponse:
      title: Collection of string
      type: object
      properties:
        value:
          type: array
          items:
            type: string
        '@odata.nextLink':
          type:
          - string
          - 'null'
      additionalProperties:
        type: object
    microsoft.graph.ODataErrors.MainError:
      required:
      - code
      - message
      type: object
      properties:
        code:
          type: string
        message:
          type: string
          x-ms-primary-error-message: true
        target:
          type:
          - string
          - 'null'
        details:
          type: array
          items:
            $ref: '#/components/schemas/microsoft.graph.ODataErrors.ErrorDetails'
        innerError:
          $ref: '#/components/schemas/microsoft.graph.ODataErrors.InnerError'
      additionalProperties:
        type: object
    microsoft.graph.tokenLifetimePolicyCollectionResponse:
      title: Collection of tokenLifetimePolicy
      type: object
      properties:
        value:
          type: array
          items:
            $ref: '#/components/schemas/microsoft.graph.tokenLifetimePolicy'
        '@odata.nextLink':
          type:
          - string
          - 'null'
      additionalProperties:
        type: object
    microsoft.graph.policyBase:
      allOf:
      - $ref: '#/components/schemas/microsoft.graph.directoryObject'
      - title: policyBase
        type: object
        properties:
          description:
            type:
            - string
            - 'null'
            description: Description for this policy. Required.
          displayName:
            type:
            - string
            - 'null'
            description: Display name for this policy. Required.
        additionalProperties:
          type: object
    microsoft.graph.tokenLifetimePolicy:
      allOf:
      - $ref: '#/components/schemas/microsoft.graph.stsPolicy'
      - title: tokenLifetimePolicy
        type: object
        additionalProperties:
          type: object
    microsoft.graph.directoryObject:
      allOf:
      - $ref: '#/components/schemas/microsoft.graph.entity'
      - title: directoryObject
        type: object
        properties:
          deletedDateTime:
            pattern: ^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$
            type:
            - string
            - 'null'
            description: Date and time when this object was deleted. Always null when the object hasn't been deleted.
            format: date-time
        additionalProperties:
          type: object
    ReferenceCreate:
      type: object
      properties:
        '@odata.id':
          type: string
      additionalProperties:
        type: object
    microsoft.graph.ODataErrors.ODataError:
      required:
      - error
      type: object
      properties:
        error:
          $ref: '#/components/schemas/microsoft.graph.ODataErrors.MainError'
      additionalProperties:
        type: object
    microsoft.graph.stsPolicy:
      allOf:
      - $ref: '#/components/schemas/microsoft.graph.policyBase'
      - title: stsPolicy
        type: object
        properties:
          definition:
            type: array
            items:
              type: string
            description: A string collection containing a JSON string that defines the rules and settings for a policy. The syntax for the definition differs for each derived policy type. Required.
          isOrganizationDefault:
            type:
            - boolean
            - 'null'
            description: If set to true, activates this policy. There can be many policies for the same policy type, but only one can be activated as the organization default. Optional, default value is false.
          appliesTo:
            type: array
            items:
              $ref: '#/components/schemas/microsoft.graph.directoryObject'
            x-ms-navigationProperty: true
        additionalProperties:
          type: object
    microsoft.graph.ODataErrors.ErrorDetails:
      required:
      - code
      - message
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        target:
          type:
          - string
          - 'null'
      additionalProperties:
        type: object
    microsoft.graph.entity:
      title: entity
      type: object
      properties:
        id:
          type: string
          description: The unique identifier for an entity. Read-only.
      additionalProperties:
        type: object
    ODataCountResponse:
      type: integer
      format: int32
  parameters:
    skip:
      name: $skip
      in: query
      description: Skip the first n items
      style: form
      explode: false
      schema:
        minimum: 0
        type: integer
    top:
      name: $top
      in: query
      description: Show only the first n items
      style: form
      explode: false
      schema:
        minimum: 0
        type: integer
      example: 50
    filter:
      name: $filter
      in: query
      description: Filter items by property values
      style: form
      explode: false
      schema:
        type: string
    search:
      name: $search
      in: query
      description: Search items by search phrases
      style: form
      explode: false
      schema:
        type: string
    count:
      name: $count
      in: query
      description: Include count of items
      style: form
      explode: false
      schema:
        type: boolean
  requestBodies:
    refPostBody:
      description: New navigation property ref value
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ReferenceCreate'
      required: true
  securitySchemes:
    azureaadv2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://login.microsoftonline.com/common/oauth2/v2.0/authorize
          tokenUrl: https://login.microsoftonline.com/common/oauth2/v2.0/token
          scopes: {}