User Sessions - List By Host Pool

List userSessions.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions?api-version=2025-10-10
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions?api-version=2025-10-10&$filter={$filter}&pageSize={pageSize}&isDescending={isDescending}&initialSkip={initialSkip}

URI Parameters

Name In Required Type Description
hostPoolName
path True

string

minLength: 3
maxLength: 64
pattern: ^[A-Za-z0-9@.\-_ ]*$

The name of the host pool within the specified resource group

resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

$filter
query

string

OData filter expression. Valid properties for filtering are userprincipalname and sessionstate.

initialSkip
query

integer (int32)

Initial number of items to skip.

isDescending
query

boolean

Indicates whether the collection is descending.

pageSize
query

integer (int32)

Number of items per page.

Responses

Name Type Description
200 OK

UserSessionList

Successfully retrieved user sessions in host pool.

Other Status Codes

CloudError

Automation error response describing why the operation failed.

Examples

UserSession_ListByHostPool

Sample request

GET https://management.azure.com/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/userSessions?api-version=2025-10-10&$filter=userPrincipalName eq 'user1@microsoft.com' and state eq 'active'&pageSize=10&isDescending=True&initialSkip=0

Sample response

{
  "value": [
    {
      "name": "1",
      "id": "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost1.microsoft.com/userSessions/1",
      "type": "Microsoft.DesktopVirtualization/hostPools/sessionHosts/userSessions",
      "systemData": {
        "createdBy": null,
        "createdByType": null,
        "createdAt": "2020-01-01T17:18:19.1234567Z",
        "lastModifiedBy": null,
        "lastModifiedByType": null,
        "lastModifiedAt": null
      },
      "properties": {
        "objectId": "7877fb31-4bde-49fd-9df3-c046e0ec5325",
        "userPrincipalName": "user1@microsoft.com",
        "applicationType": "Desktop",
        "sessionState": "Active",
        "activeDirectoryUserName": "WVDARM\\user1",
        "createTime": "2008-09-22T14:01:54.9571247Z"
      }
    },
    {
      "name": "2",
      "id": "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost1.microsoft.com/userSessions/2",
      "type": "Microsoft.DesktopVirtualization/hostPools/sessionHosts/userSessions",
      "systemData": {
        "createdBy": null,
        "createdByType": null,
        "createdAt": "2020-01-01T17:18:19.1234567Z",
        "lastModifiedBy": null,
        "lastModifiedByType": null,
        "lastModifiedAt": null
      },
      "properties": {
        "objectId": "7877fb31-4bde-49fd-9df3-c046e0ec5325",
        "userPrincipalName": "user1@microsoft.com",
        "applicationType": "Desktop",
        "sessionState": "Active",
        "activeDirectoryUserName": "WVDARM\\user1",
        "createTime": "2008-09-22T14:01:54.9571247Z"
      }
    }
  ]
}

Definitions

Name Description
ApplicationType

Application type of application.

CloudError

Cloud error object.

CloudErrorProperties

Cloud error object properties.

createdByType

The type of identity that created the resource.

SessionState

State of user session.

systemData

Metadata pertaining to creation and last modification of the resource.

UserSession

Represents a UserSession definition.

UserSessionList

UserSessionList

ApplicationType

Application type of application.

Value Description
RemoteApp
Desktop

CloudError

Cloud error object.

Name Type Description
error

CloudErrorProperties

Cloud error object properties.

CloudErrorProperties

Cloud error object properties.

Name Type Description
code

string

Error code

message

string

Error message indicating why the operation failed.

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

SessionState

State of user session.

Value Description
Unknown
Active
Disconnected
Pending
LogOff
UserProfileDiskMounted

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.

UserSession

Represents a UserSession definition.

Name Type Description
id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

name

string

The name of the resource

properties.activeDirectoryUserName

string

The active directory user name.

properties.applicationType

ApplicationType

Application type of application.

properties.createTime

string (date-time)

The timestamp of the user session create.

properties.objectId

string

ObjectId of user session. (internal use)

properties.sessionState

SessionState

State of user session.

properties.userPrincipalName

string

The user principal name.

systemData

systemData

Metadata pertaining to creation and last modification of the resource.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

UserSessionList

UserSessionList

Name Type Description
nextLink

string

Link to the next page of results.

value

UserSession[]

List of UserSession definitions.