Microsoft Azure User Session API

The User Session API from Microsoft Azure, for user session.

GitHub OpenAPI

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 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions List user sessions across a host pool · Microsoft Azure Get Subscriptions Subscriptionid Resourcegroups… #
Ask an LLM
“Who is currently signed in anywhere in my Azure Virtual Desktop host pool?”
“Can I filter the host pool's user sessions, for example by user principal name?”
Tell an agent
List user sessions in host pool {hostPoolName}.
List host pool {hostPoolName} user sessions matching filter {filter}.
GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId} Get a virtual desktop user session · Microsoft Azure Get Subscriptions Subscriptionid Resourcegroups… #
Ask an LLM
“What is the state of a specific user's session on a session host?”
“Can I look up one Azure Virtual Desktop session by its id?”
Tell an agent
Get user session {userSessionId} on session host {sessionHostName} in host pool {hostPoolName}.
Show the details of session {userSessionId} on host {sessionHostName}, pool {hostPoolName}.
DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId} Log off and remove a virtual desktop user session · Microsoft Azure Delete Subscriptions Subscriptionid Resourcegroups… #
Ask an LLM
“How do I sign a user out and remove their session from a session host?”
“Can I force-remove a stuck Azure Virtual Desktop session?”
Tell an agent destructive · confirm first
Remove user session {userSessionId} from session host {sessionHostName} in host pool {hostPoolName}.
Force-remove session {userSessionId} on host {sessionHostName}, pool {hostPoolName}, with force set to {force}.
GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions List user sessions on one session host · Microsoft Azure Get Subscriptions Subscriptionid Resourcegroups… #
Ask an LLM
“Which users are connected to a particular session host right now?”
“Can I page through the sessions on a single virtual desktop host?”
Tell an agent
List user sessions on session host {sessionHostName} in host pool {hostPoolName}.
Show {pageSize} sessions per page on host {sessionHostName} of pool {hostPoolName}.
POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect Disconnect a virtual desktop user session · Microsoft Azure Post Subscriptions Subscriptionid Resourcegroups… #
Ask an LLM
“How do I disconnect a user from their virtual desktop without logging them off?”
“Can I drop a user's remote connection but keep their session running?”
Tell an agent
Disconnect user session {userSessionId} on session host {sessionHostName} in host pool {hostPoolName}.
Drop the connection for session {userSessionId} on host {sessionHostName}, pool {hostPoolName}.
POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage Send a message to a virtual desktop user · Microsoft Azure Post Subscriptions Subscriptionid Resourcegroups… #
Ask an LLM
“How do I warn a signed-in user that their session host is going down for maintenance?”
“Can I pop up a message with a title in someone's virtual desktop session?”
Tell an agent
Send message {messageBody} to user session {userSessionId} on host {sessionHostName} in pool {hostPoolName}.
Notify session {userSessionId} on {sessionHostName}, pool {hostPoolName}, with title {messageTitle} and text {messageBody}.

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-user-session-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-user-session-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  version: 2023-11-01-preview
  title: Microsoft Azure Desktop Virtualization API Client User…
servers:
- url: https://management.azure.com
tags:
- name: User Session
paths:
  ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions
  : get:
      tags:
      - User Session
      operationId: microsoftAzureUsersessionsListbyhostpool
      description: List userSessions.
      x-ms-examples:
        UserSession_ListByHostPool:
          $ref: ./examples/UserSession_ListByHostPool.json
      parameters:
      - $ref: ../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/ResourceGroupNameParameter
      - $ref: '#/components/parameters/HostPoolNameParameter'
      - name: $filter
        in: query
        required: false
        description: OData filter expression. Valid properties for filtering are userprincipalname and sessionstate.
        schema:
          type: string
      - name: pageSize
        in: query
        required: false
        description: Number of items per page.
        schema:
          type: integer
          format: int32
      - name: isDescending
        in: query
        required: false
        description: Indicates whether the collection is descending.
        schema:
          type: boolean
      - name: initialSkip
        in: query
        required: false
        description: Initial number of items to skip.
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Successfully retrieved user sessions in host pool.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserSessionList'
        default:
          description: Automation error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      x-ms-pageable:
        nextLinkName: nextLink
      summary: Microsoft Azure Get Subscriptions Subscriptionid Resourcegroups…
  ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}
  : get:
      tags:
      - User Session
      operationId: microsoftAzureUsersessionsGet
      description: Get a userSession.
      x-ms-examples:
        UserSession_Get:
          $ref: ./examples/UserSession_Get.json
      parameters:
      - $ref: ../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/ResourceGroupNameParameter
      - $ref: '#/components/parameters/HostPoolNameParameter'
      - $ref: '#/components/parameters/SessionHostNameParameter'
      - $ref: '#/components/parameters/UserSessionIdParameter'
      responses:
        '200':
          description: Successfully retrieved user session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserSession'
        default:
          description: Automation error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      summary: Microsoft Azure Get Subscriptions Subscriptionid Resourcegroups…
    delete:
      tags:
      - User Session
      operationId: microsoftAzureUsersessionsDelete
      description: Remove a userSession.
      x-ms-examples:
        UserSession_Delete:
          $ref: ./examples/UserSession_Delete.json
      parameters:
      - $ref: ../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/ResourceGroupNameParameter
      - $ref: '#/components/parameters/HostPoolNameParameter'
      - $ref: '#/components/parameters/SessionHostNameParameter'
      - $ref: '#/components/parameters/UserSessionIdParameter'
      - name: force
        in: query
        required: false
        description: Force flag to login off userSession.
        schema:
          type: boolean
      responses:
        '200':
          description: Successfully removed user session.
        '204':
          description: User session does not exist.
        default:
          description: Automation error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      summary: Microsoft Azure Delete Subscriptions Subscriptionid Resourcegroups…
  ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions
  : get:
      tags:
      - User Session
      operationId: microsoftAzureUsersessionsList
      description: List userSessions.
      x-ms-examples:
        UserSession_List:
          $ref: ./examples/UserSession_List.json
      parameters:
      - $ref: ../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/ResourceGroupNameParameter
      - $ref: '#/components/parameters/HostPoolNameParameter'
      - $ref: '#/components/parameters/SessionHostNameParameter'
      - name: pageSize
        in: query
        required: false
        description: Number of items per page.
        schema:
          type: integer
          format: int32
      - name: isDescending
        in: query
        required: false
        description: Indicates whether the collection is descending.
        schema:
          type: boolean
      - name: initialSkip
        in: query
        required: false
        description: Initial number of items to skip.
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Successfully retrieved user sessions in session host.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserSessionList'
        default:
          description: Automation error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      x-ms-pageable:
        nextLinkName: nextLink
      summary: Microsoft Azure Get Subscriptions Subscriptionid Resourcegroups…
  ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect
  : post:
      tags:
      - User Session
      operationId: microsoftAzureUsersessionsDisconnect
      description: Disconnect a userSession.
      x-ms-examples:
        UserSession_Disconnect_Post:
          $ref: ./examples/UserSession_Disconnect_Post.json
      parameters:
      - $ref: ../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/ResourceGroupNameParameter
      - $ref: '#/components/parameters/HostPoolNameParameter'
      - $ref: '#/components/parameters/SessionHostNameParameter'
      - $ref: '#/components/parameters/UserSessionIdParameter'
      responses:
        '200':
          description: Successfully disconnected user session.
        default:
          description: Automation error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      summary: Microsoft Azure Post Subscriptions Subscriptionid Resourcegroups…
  ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage
  : post:
      tags:
      - User Session
      operationId: microsoftAzureUsersessionsSendmessage
      description: Send a message to a user.
      x-ms-examples:
        UserSession_SendMessage_Post:
          $ref: ./examples/UserSession_SendMessage_Post.json
      parameters:
      - $ref: ../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/parameters/ResourceGroupNameParameter
      - $ref: '#/components/parameters/HostPoolNameParameter'
      - $ref: '#/components/parameters/SessionHostNameParameter'
      - $ref: '#/components/parameters/UserSessionIdParameter'
      responses:
        '200':
          description: Successfully sent message to user session.
        default:
          description: Automation error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      summary: Microsoft Azure Post Subscriptions Subscriptionid Resourcegroups…
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessage'
        description: Object containing message includes title and message body
components:
  schemas:
    SendMessage:
      description: Represents message sent to a UserSession.
      type: object
      properties:
        messageTitle:
          type: string
          description: Title of message.
        messageBody:
          type: string
          description: Body of message.
    UserSession:
      type: object
      description: Represents a UserSession definition.
      allOf:
      - $ref: ../../../../../common-types/resource-management/v1/types.json#/definitions/Resource
      properties:
        systemData:
          $ref: ../../../../../common-types/resource-management/v2/types.json#/definitions/systemData
          description: Metadata pertaining to creation and last modification of the resource.
        properties:
          description: Detailed properties for UserSession
          x-ms-client-flatten: true
          $ref: '#/components/schemas/UserSessionProperties'
    CloudErrorProperties:
      description: Cloud error object properties.
      type: object
      properties:
        code:
          description: Error code
          type: string
        message:
          description: Error message indicating why the operation failed.
          type: string
    CloudError:
      description: Cloud error object.
      type: object
      x-ms-external: true
      properties:
        error:
          $ref: '#/components/schemas/CloudErrorProperties'
    UserSessionProperties:
      description: Schema for UserSession properties.
      type: object
      properties:
        objectId:
          type: string
          description: ObjectId of user session. (internal use)
          readOnly: true
        userPrincipalName:
          type: string
          description: The user principal name.
        applicationType:
          enum:
          - RemoteApp
          - Desktop
          x-ms-enum:
            name: ApplicationType
            modelAsString: true
          type: string
          description: Application type of application.
        sessionState:
          enum:
          - Unknown
          - Active
          - Disconnected
          - Pending
          - LogOff
          - UserProfileDiskMounted
          x-ms-enum:
            name: SessionState
            modelAsString: true
          type: string
          description: State of user session.
        activeDirectoryUserName:
          type: string
          description: The active directory user name.
        createTime:
          format: date-time
          type: string
          description: The timestamp of the user session create.
    UserSessionList:
      type: object
      title: UserSessionList
      description: List of UserSession definitions.
      properties:
        value:
          type: array
          description: List of UserSession definitions.
          items:
            $ref: '#/components/schemas/UserSession'
        nextLink:
          type: string
          readOnly: true
          description: Link to the next page of results.
  parameters:
    SessionHostNameParameter:
      name: sessionHostName
      in: path
      required: true
      description: The name of the session host within the specified host pool
      x-ms-parameter-location: method
      schema:
        type: string
        maxLength: 48
        minLength: 3
    UserSessionIdParameter:
      name: userSessionId
      in: path
      required: true
      description: The name of the user session within the specified session host
      x-ms-parameter-location: method
      schema:
        type: string
        maxLength: 24
        minLength: 1
    HostPoolNameParameter:
      name: hostPoolName
      in: path
      required: true
      description: The name of the host pool within the specified resource group
      x-ms-parameter-location: method
      schema:
        type: string
        maxLength: 64
        minLength: 3
  securitySchemes:
    azure_auth:
      type: oauth2
      flows:
        implicit:
          scopes:
            user_impersonation: impersonate your user account
          authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
      description: Azure Active Directory OAuth2 Flow