Moving from the service principal to a managed identity for AVD features
Partner · Neutral partner: Nerdio
By Mirko Peters ·
To move an Azure Virtual Desktop host pool from the service principal to a managed identity, assign the identity, grant each feature's role, check the feature, then remove the service principal's role.
To move a host pool from the Azure Virtual Desktop service principal to a managed identity, assign the identity to the host pool, grant that identity the role each feature needs, confirm the feature still works, and remove the service principal's role assignment last. This article gives that sequence with the portal and PowerShell steps Learn publishes.
Key points
- Assign the identity and roles first, verify, and remove the service principal's role last. A subscription-level service principal assignment serves every pool, so remove it only after all have one.
- Assigning the identity needs Host Pool Contributor on the pool (plus Managed Identity Operator if user-assigned). Granting roles needs roleAssignments/write, as in Owner or User Access Administrator.
- Learn's PowerShell for a host pool identity uses New-AzWvdHostPool with the existing values and only IdentityType changed, and Get-AzWvdHostPool with Format-Table Name, IdentityType checks the result.
- App Attach with Azure Files and Entra-joined session hosts cannot use a managed identity, so leave its service principal assignment in place.
- The identity acts in place of the service principal for session host creation and update. For autoscale and Start VM on Connect Learn does not say, so remove the service principal role and test.
Learn describes the concept and the individual tasks on separate pages; this order is our own, built from those pages. For which features can use an identity and which roles they need, see the explainer "Managed identity in Azure Virtual Desktop: autoscale, Start VM on Connect and session host configuration". Learn's What's new announced general availability of host pool managed identity support in September 2026 and says that host pools with a session host configuration will require one "in a future service update".
Before you start
You need three permissions, which often sit with different people.
- To assign an identity to the host pool: the Desktop Virtualization Host Pool Contributor role at the host pool scope or higher. For a user-assigned identity you also need Managed Identity Operator at the identity's scope or higher.
- To grant roles to the identity:
Microsoft.Authorization/roleAssignments/writeon the target scope. Learn names Owner and User Access Administrator as roles that include it. - To remove the old assignment:
Microsoft.Authorization/roleAssignments/delete, which Learn's removal page gives as part of Role Based Access Control Administrator.
Step 1: inventory what the service principal holds
Our approach: open Access control (IAM) at each scope that might carry a role for the service principal, and select the Role assignments tab. Look for entries named Azure Virtual Desktop or Windows Virtual Desktop. Learn warns that two entries can share a name, for example after using both Azure Virtual Desktop classic and the Azure Resource Manager version, and says to tell them apart by application ID. The one that matters for host pool features has application ID 9cdead84-a844-4324-93f2-b2e6bb768d07. In Microsoft Entra ID, search the tenant for that ID and note the object ID, which is unique to your tenant. You need it later to remove the right assignment.
Write down, for each assignment, the role, the scope and the host pools it covers. The roles you expect are Desktop Virtualization Power On Off Contributor (autoscale), Desktop Virtualization Power On Contributor (Start VM on Connect) and, for dynamic autoscale, Desktop Virtualization Virtual Machine Contributor. Then mark each host pool with the features it uses. A host pool that uses App Attach with Azure Files and Entra-joined session hosts keeps its service principal assignment for that feature, because Learn lists App Attach as not able to use a managed identity.
Step 2: assign an identity to the host pool
In the Azure portal:
- Search for Azure Virtual Desktop, select Host pools, and open the host pool.
- Select Identity.
- Tick Assign a Managed Identity, then choose System assigned managed identity or User assigned managed identity.
- For a user-assigned identity, pick the Subscription and the existing identity.
- Select Save.
In Azure PowerShell, Learn's pattern reads the current pool first, then runs New-AzWvdHostPool with the same values and only the identity type changed:
$existingHostPool = Get-AzWvdHostPool -Name '<HostPoolName>' -ResourceGroupName '<ResourceGroupName>'
$parameters = @{
Name = $existingHostPool.Name
ResourceGroupName = $existingHostPool.ResourceGroupName
Location = $existingHostPool.Location
HostPoolType = $existingHostPool.HostPoolType
LoadBalancerType = $existingHostPool.LoadBalancerType
PreferredAppGroupType = $existingHostPool.PreferredAppGroupType
IdentityType = 'SystemAssigned'
}
New-AzWvdHostPool @parameters
Learn says that because the pool exists, this changes only the IdentityType property. Verify with Get-AzWvdHostPool piped to Format-Table Name, IdentityType; the expected output shows SystemAssigned. For a user-assigned identity, Learn adds IdentityType = 'UserAssigned' and IdentityUserAssignedIdentity = @{$managedIdentity.Id = @{}}, with the identity object taken from Get-AzUserAssignedIdentity. One stumbling block: the explanatory text of that step says "only changing the IdentityType to 'SystemAssigned'", while the code block uses 'UserAssigned'. Use the code. The cmdlet reference in Az PowerShell 16.5.0 lists -IdentityType as "either system assigned, or none" and does not list -IdentityUserAssignedIdentity in its syntax, so check Get-Help New-AzWvdHostPool -Parameter Identity in your installed version, or use the portal steps, before you rely on the user-assigned block. As a precaution of our own, save the output of Get-AzWvdHostPool before the change so you can compare it afterwards.
Step 3: grant the identity its roles
Learn's service principal page points to the general Azure RBAC articles for managed identities. In the portal:
- Open Access control (IAM) at the scope the feature needs and select Add, then Add role assignment.
- On the Role tab, choose the role, for example Desktop Virtualization Power On Off Contributor.
- On the Members tab, select Managed identity, then Select members.
- In the Select managed identities pane, choose user-assigned or system-assigned and pick the identity. For a system-assigned identity, Learn's Azure Local steps select Hostpool in the Managed Identity drop-down and then the pool's identity, and the RBAC page says system-assigned identities can be selected by Azure service instance.
- Select Review + assign.
In PowerShell, Learn's Azure Local example reads $hostPool.IdentityPrincipalId and passes it to New-AzRoleAssignment -ObjectId; the page does not state the identity type. Our reading is that the property holds the object ID of the pool's system-assigned identity. Combining that with the subscription-scope form from Learn's RBAC page gives, for a system-assigned identity:
$hostPool = Get-AzWvdHostPool -Name '<HostPoolName>' -ResourceGroupName '<ResourceGroupName>'
New-AzRoleAssignment -ObjectId $hostPool.IdentityPrincipalId `
-RoleDefinitionName "Desktop Virtualization Power On Off Contributor" `
-Scope "/subscriptions/<SubscriptionId>"
Use the scope that the feature page names. For autoscale, Learn says the Azure subscription, and a lower scope "prevents autoscale from working properly". For Start VM on Connect, the scope must contain the host pool and its session host VMs. For session host creation and update, the identity needs Desktop Virtualization Virtual Machine Contributor on the resource group or subscription of the session hosts, and the Key Vault Secrets User role on the key vault that holds the local administrator and domain join secrets. Azure Local session hosts additionally need Reader on their resource group.
For a user-assigned identity, Learn's RBAC PowerShell page says to use the identity's object ID, which you can get with Get-AzADServicePrincipal; the same call works for a system-assigned identity. Our reading: a user-assigned identity attached to several pools needs the role assigned once, at a scope that covers all of those pools, while a system-assigned identity needs it for each pool.
Step 4: verify each feature
Test one pool at a time, while the service principal still holds its role. For autoscale, in Insights open the Autoscale tab, or query the WVDAutoscaleEvaluationPooled table where ResultType != "Succeeded" after a schedule phase has run. Learn gives that table for pooled host pools only, and it needs the category Autoscale logs for pooled host pools in the host pool's diagnostic settings. For Start VM on Connect, Learn says a pooled host pool powers on a VM only when none are turned on, and at most once every five minutes, and that connecting by IP address or name does not start a VM. Our suggested test therefore depends on the pool type: in a personal pool, deallocate the assigned session host; in a pooled test pool, deallocate every session host. Then connect with Windows App or the Remote Desktop app. For session host update, run it on a test host pool first, as Learn recommends for any update. Learn also says to disable autoscale on a host pool before you start a session host update and keep it disabled until the update finishes, because a scaling plan that is enabled during an update can make the update fail with a runtime error.
This step has a limit for autoscale and Start VM on Connect. Their Learn pages name "a managed identity assigned to your host pool or the Azure Virtual Desktop service principal" without saying which one is used while both hold the role, so a passing test with both assignments in place does not by itself show that the managed identity works. For session host creation and update, the deployment page says the assigned identity acts in place of the service principal, so the same test is more informative there.
Step 5: remove the service principal assignment
Given that limit, our suggested test for autoscale and Start VM on Connect is to remove the old assignment and test again. Two conditions come first. Learn is not consistent for dynamic autoscale: the prerequisites on the scaling plan page name a managed identity or the service principal, while its permissions subsection names only the service principal for both roles. Keep the service principal assignment for any pool that uses dynamic autoscale until you have tested without it. And Learn's known issue says session host update must use a managed identity to use a key vault with private network access, so confirm the identity has its Key Vault role before you remove anything that session host update relies on.
- Confirm that every host pool in the scope has an identity with the needed role. A subscription-level service principal assignment covers all host pools in the subscription, so removing it early breaks every pool that has no identity yet.
- Open Access control (IAM) at the scope where the role was assigned and select the Role assignments tab.
- Tick the row for the Azure Virtual Desktop service principal (check the object ID you noted) and the role, and select Remove, then Yes. If you see a message that inherited role assignments cannot be removed, open IAM at the scope where it was assigned, which the Scope column shows next to (Inherited).
- Repeat the feature tests from step 4.
In PowerShell, Remove-AzRoleAssignment -ObjectId <ServicePrincipalObjectId> -RoleDefinitionName "<Role>" -Scope "/subscriptions/<SubscriptionId>" does the same; Learn says that if you get "The provided information does not map to a role assignment", add the scope or resource group parameter.
To roll back, re-create the assignment with the commands on Learn's service principal page, such as New-AzRoleAssignment with -ApplicationId "9cdead84-a844-4324-93f2-b2e6bb768d07" and the subscription scope.
Stumbling blocks
- Key vault access policy. Learn says the Get secret access policy is not supported if you chose a system-assigned identity during pool creation; use Azure RBAC.
- Removing the identity versus deleting the pool. Learn says removing a system-assigned identity from a host pool deletes it, while removing a user-assigned identity only ends the association. Our reading: deleting the pool follows the same split, since Learn's overview ties a system-assigned identity to its parent resource's lifecycle.
- Preview wording. Some Learn pages still carry preview wording for enhanced host pool management, which Microsoft announced as generally available in July 2026; check the current page before relying on a limit.
Sources
- Microsoft Learn: Configure managed identity in Azure Virtual Desktop
- Microsoft Learn: Managed identities for Azure resources
- Microsoft Learn: New-AzWvdHostPool
- Microsoft Learn: Assign Azure RBAC roles or Microsoft Entra roles to the Azure Virtual Desktop service principals
- Microsoft Learn: What's new in Azure Virtual Desktop
- Microsoft Learn: Create and assign an autoscale scaling plan
- Microsoft Learn: Configure Start VM on Connect
- Microsoft Learn: Deploy Azure Virtual Desktop
- Microsoft Learn: Session host update
- Microsoft Learn: Monitor Autoscale operations with Insights
- Microsoft Learn: Assign Azure roles using the Azure portal
- Microsoft Learn: Assign Azure roles using Azure PowerShell
- Microsoft Learn: Remove Azure role assignments
- Tech Community: Enhanced host pool management for Azure Virtual Desktop is now generally available
FAQ
Can I keep the service principal role assignments while I test the managed identity?
Yes. For autoscale and Start VM on Connect, Learn lists both identities as options and does not say that adding an identity removes the service principal assignment. The catch is that it also does not say which one these features use while both hold the role, so a feature that keeps working does not show which identity it used; see steps 4 and 5 for our suggested test. For session host creation and update, the deployment page says the assigned identity acts in place of the service principal.
What do I need to be allowed to do before I start?
Desktop Virtualization Host Pool Contributor at the host pool scope or higher to assign the identity, Managed Identity Operator at the identity's scope or higher for a user-assigned identity, and Microsoft.Authorization/roleAssignments/write on the scope to grant its roles.
How do I undo the change?
Re-create the service principal's role assignment using Learn's service principal page, which shows the Azure PowerShell and Azure CLI commands with the application ID 9cdead84-a844-4324-93f2-b2e6bb768d07. To remove the identity from a host pool, clear the Assign a Managed Identity box on the Identity page and save.