azureblog.co.uk
← cd ~/roles
// roles/azure · compute

Desktop Virtualization Power On Off ContributorAzure built-in role

Provide permission to the Azure Virtual Desktop Resource Provider to start and stop virtual machines.

Role ID40c5ff49-9181-41f8-ae61-143b0e78555e
CategoryCompute
Actions37
Data actions0

What it can do

PermissionWhat it allows
Microsoft.Authorization/*/readAny read operation on anything under Microsoft.Authorization
Microsoft.AzureStackHCI/operations/readGets operations
Microsoft.AzureStackHCI/virtualMachineInstances/readGets/Lists virtual machine instance resource
Microsoft.AzureStackHCI/virtualMachineInstances/restart/actionRestarts virtual machine instance resource
Microsoft.AzureStackHCI/virtualMachineInstances/start/actionStarts virtual machine instance resource
Microsoft.AzureStackHCI/virtualMachineInstances/stop/actionStops virtual machine instance resource
Microsoft.Compute/virtualMachines/deallocate/actionPowers off the virtual machine and releases the compute resources
Microsoft.Compute/virtualMachines/instanceView/readGets the detailed runtime status of the virtual machine and its resources
Microsoft.Compute/virtualMachines/powerOff/actionPowers off the virtual machine. Note that the virtual machine will continue to be billed.
Microsoft.Compute/virtualMachines/readGet the properties of a virtual machine
Microsoft.Compute/virtualMachines/restart/actionRestarts the virtual machine
Microsoft.Compute/virtualMachines/start/actionStarts the virtual machine
Microsoft.ComputeSchedule/locations/virtualMachinesCancelOperations/actionvirtualMachinesCancelOperations: cancelOperations for a virtual machine
Microsoft.ComputeSchedule/locations/virtualMachinesExecuteDeallocate/actionVirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it.
Microsoft.ComputeSchedule/locations/virtualMachinesExecuteHibernate/actionVirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it.
Microsoft.ComputeSchedule/locations/virtualMachinesExecuteStart/actionVirtualMachinesExecuteStart: Execute start operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it.
Microsoft.ComputeSchedule/locations/virtualMachinesGetOperationErrors/actionVirtualMachinesGetOperationErrors: Get error details on operation errors (like transient errors encountered, additional logs) if they exist.
Microsoft.ComputeSchedule/locations/virtualMachinesGetOperationStatus/actionVirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines
Microsoft.ComputeSchedule/locations/virtualMachinesSubmitDeallocate/actionVirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual machines at datetime in future.
Microsoft.ComputeSchedule/locations/virtualMachinesSubmitHibernate/actionVirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines at datetime in future.
Microsoft.ComputeSchedule/locations/virtualMachinesSubmitStart/actionVirtualMachinesSubmitStart: Schedule start operation for a batch of virtual machines at datetime in future.
Microsoft.ComputeSchedule/register/actionRegister the subscription for Microsoft.ComputeSchedule
Microsoft.DesktopVirtualization/hostpools/readRead hostpools
Microsoft.DesktopVirtualization/hostpools/sessionhosts/readRead hostpools/sessionhosts
Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/deleteDelete hostpools/sessionhosts/usersessions
Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/readRead hostpools/sessionhosts/usersessions
Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/sendMessage/actionSend message to user session
Microsoft.DesktopVirtualization/hostpools/sessionhosts/writeWrite hostpools/sessionhosts
Microsoft.DesktopVirtualization/hostpools/writeWrite hostpools
Microsoft.HybridCompute/locations/operationresults/readReads the status of an operation on Microsoft.HybridCompute Resource Provider
Microsoft.HybridCompute/locations/operationstatus/readReads the status of an operation on Microsoft.HybridCompute Resource Provider
Microsoft.HybridCompute/machines/readRead any Azure Arc machines
Microsoft.HybridCompute/operations/readRead all Operations for Azure Arc for Servers
Microsoft.Insights/alertRules/*Every operation under Microsoft.Insights/alertRules
Microsoft.Insights/eventtypes/values/readRead Activity Log events
Microsoft.Resources/deployments/*Every operation under Microsoft.Resources/deployments
Microsoft.Resources/subscriptions/resourceGroups/readGets or lists resource groups.

Assign it

Scope it as tightly as you can: a resource or resource group rather than the whole subscription.

azure cli
az role assignment create \
  --assignee "jane.doe@contoso.com" \
  --role "Desktop Virtualization Power On Off Contributor" \
  --scope "/subscriptions/<subscription id>/resourceGroups/<resource group>"
powershell3 lines
New-AzRoleAssignment -SignInName "jane.doe@contoso.com" `
  -RoleDefinitionName "Desktop Virtualization Power On Off Contributor" `
  -Scope "/subscriptions/<subscription id>/resourceGroups/<resource group>"
bicep7 lines
resource assignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
  name: guid(resourceGroup().id, principalId, '40c5ff49-9181-41f8-ae61-143b0e78555e')
  properties: {
    roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '40c5ff49-9181-41f8-ae61-143b0e78555e')
    principalId: principalId
  }
}

Who already has it?

kql · azure resource graph
authorizationresources
| where type == "microsoft.authorization/roleassignments"
| where tostring(properties.roleDefinitionId) endswith "40c5ff49-9181-41f8-ae61-143b0e78555e"
| project principalId = tostring(properties.principalId), principalType = tostring(properties.principalType), scope = tostring(properties.scope)

Other compute roles

Find the smallest role for a task →