Session Host Managements - Create Or Update

Create or update a SessionHostManagement.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default?api-version=2026-04-01-preview

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.

Request Body

Name Required Type Description
properties.scheduledDateTimeZone True

string

Time zone for sessionHostManagement operations as defined in https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set if useLocalTime is true.

properties.update True

HostPoolUpdateConfigurationProperties

Parameters for a hostpool update.

properties.failedSessionHostCleanupPolicy

FailedSessionHostCleanupPolicySHC

The policy that should be applied when the Session Host provisioning operation fails.

properties.provisioning

SessionHostProvisioningConfigurationProperties

Parameters that apply when session hosts are provisioned.

Responses

Name Type Description
200 OK

SessionHostManagement

Resource 'SessionHostManagement' update operation succeeded

201 Created

SessionHostManagement

Resource 'SessionHostManagement' create operation succeeded

Other Status Codes

ErrorResponse

An unexpected error response.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

SessionHostManagements_Create

Sample request

PUT https://management.azure.com/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHostManagements/default?api-version=2026-04-01-preview

{
  "properties": {
    "scheduledDateTimeZone": "Alaskan Standard Time",
    "update": {
      "deleteOriginalVm": true,
      "maxVmsRemoved": 4,
      "logOffDelayMinutes": 10,
      "logOffMessage": "logging off for hostpool update"
    }
  }
}

Sample response

{
  "name": "default",
  "id": "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHostManagements/default",
  "type": "Microsoft.DesktopVirtualization/hostPools/sessionHostManagements",
  "systemData": {
    "createdBy": "user1",
    "createdByType": "User",
    "createdAt": "2020-01-01T17:18:19.1234567Z",
    "lastModifiedBy": "user2",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2020-01-02T17:18:19.1234567Z"
  },
  "properties": {
    "scheduledDateTimeZone": "Alaskan Standard Time",
    "update": {
      "deleteOriginalVm": true,
      "maxVmsRemoved": 4,
      "logOffDelayMinutes": 10,
      "logOffMessage": "logging off for hostpool update"
    }
  }
}
{
  "name": "default",
  "id": "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHostManagements/default",
  "type": "Microsoft.DesktopVirtualization/hostPools/sessionHostManagements",
  "systemData": {
    "createdBy": "user1",
    "createdByType": "User",
    "createdAt": "2020-01-01T17:18:19.1234567Z",
    "lastModifiedBy": "user2",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2020-01-02T17:18:19.1234567Z"
  },
  "properties": {
    "scheduledDateTimeZone": "Alaskan Standard Time",
    "update": {
      "deleteOriginalVm": true,
      "maxVmsRemoved": 4,
      "logOffDelayMinutes": 10,
      "logOffMessage": "logging off for hostpool update"
    }
  }
}

Definitions

Name Description
CanaryPolicy

Policy on whether a Canary VM(a single VM to validate the configuration) should be provisioned during a session host provisioning operation.

createdByType

The type of identity that created the resource.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

FailedSessionHostCleanupPolicySHC

The policy that should be applied when the Session Host provisioning operation fails.

HostPoolUpdateConfigurationProperties

The configurations of a hostpool update.

SessionHostManagement

Schema for SessionHostManagement properties.

SessionHostProvisioningConfigurationProperties

The configuration for session host provisioning operations.

systemData

Metadata pertaining to creation and last modification of the resource.

CanaryPolicy

Policy on whether a Canary VM(a single VM to validate the configuration) should be provisioned during a session host provisioning operation.

Value Description
Auto

Decided by service whether to provision Canary VM.

Never

Never provision Canary VM.

Always

Always provision Canary VM.

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

FailedSessionHostCleanupPolicySHC

The policy that should be applied when the Session Host provisioning operation fails.

Value Description
KeepAll

Keep All.

KeepOne

Keep One.

KeepNone

Keep None.

HostPoolUpdateConfigurationProperties

The configurations of a hostpool update.

Name Type Description
deleteOriginalVm

boolean

Whether not to save original disk. False by default.

logOffDelayMinutes

integer (int32)

Grace period before logging off users in minutes.

logOffMessage

string

maxLength: 260

Log off message sent to user for logoff. Default value is an empty string.

maxVmsRemoved

integer (int32)

minimum: 1

The maximum number of virtual machines to be removed during hostpool update.

SessionHostManagement

Schema for SessionHostManagement properties.

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.failedSessionHostCleanupPolicy

FailedSessionHostCleanupPolicySHC

The policy that should be applied when the Session Host provisioning operation fails.

properties.provisioning

SessionHostProvisioningConfigurationProperties

Parameters that apply when session hosts are provisioned.

properties.scheduledDateTimeZone

string

Time zone for sessionHostManagement operations as defined in https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set if useLocalTime is true.

properties.update

HostPoolUpdateConfigurationProperties

Parameters for a hostpool update.

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

type

string

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

SessionHostProvisioningConfigurationProperties

The configuration for session host provisioning operations.

Name Type Description
canaryPolicy

CanaryPolicy

Policy on whether a Canary VM(a single VM to validate the configuration) should be provisioned during a session host provisioning operation.

instanceCount

integer (int32)

minimum: 1

The number of session hosts to exist in the Host Pool.

setDrainMode

boolean

Whether the session host should be set in drain mode following provisioning.

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.