Service Permission errors while creating & assigning the scaling plan to hostpool via ARM Template

Copper Contributor

Getting the below error while creating & assigning the scaling plan to hostpool via ARM Template

 

New-AzResourceGroupDeployment : 23:27:51 - The deployment 'HostPool' failed with error(s). Showing 1 out of 1 error(s).
Status Message: ActivityId: 9876398c-2590-4ef3-8b3d-ddfe2f446ddb Error: ≤{"error":{"code":"BadRequest","message":"unable to access host pool with resource id
'AVDPHOSTPOOL-1', please make sure that you have given the Azure Virtual Desktop service permissions to access your resource (https://docs.microsoft.com/en-us/azu
re/virtual-desktop/autoscale-scaling-plan#create-a-custom-rbac-role)","target":"/api/scalingPlans/subscriptions/39ee65b9-0633-492d-a68c-c1cbdead1ff3/resourceGroups/AVDPRG-1/scalingPlans/AVDPSCALPLAN-1"}}≥ (Code:400)
CorrelationId: 40c66cb1-3a16-4516-bcc8-808ef51602e1
At line:1 char:1
+ New-AzResourceGroupDeployment -ResourceGroupName "AVDPRG-1" -Templ ...

 

I am found few article to create custom role for AVD via Powershell. but i am trying to achieve it via ARM template. 

 

Is there a way i can add the custom role permission in the scaling plan ARM template . 

Link : https://docs.microsoft.com/en-us/azure/templates/microsoft.desktopvirtualization/scalingplans?tabs=j...

 

 

 

6 Replies
Spoiler
 

@BalajiRanganathan354 Did you ever get this fixed? I am encountering the same error.

@Fliehigh the avd application requires desktop power on off role on the host pool resource group as well as the resource group containing the session hosts.

Once adding this in it works fine

@Am549  can you provide some more details here? I am stuck on same error.

 

How do grant AVD roles on the host pool?

@Joshua_Matthews I am stuck with the same error. Addin the role Desktop Virtualization Power On Off Contributor on all levels did not help. I created a custom role as the OP suggested... nothing. 

 

What else can I do? 

 

Cheers

MC

@resitservices 

I had the same issue.
There should be one enterprise app called "Windows Virtual Desktop", I assigned Desktop Virtualization Power On Off Contributor to "Windows Virtual Desktop" on the resource level (same resource as your host pool) and it worked for me.

Hope this helps. 

Thank you heaps, you gave me the clue that I was looking for. In my case the app is called "Azure Virtual Desktop" and the end I found the proper documentation here: https://learn.microsoft.com/en-us/azure/virtual-desktop/service-principal-assign-roles?tabs=portal

Thank you Yanbo, I hope this threat helps more people.