I found a few issues while testing out the code that I wanted to share:
- It should be "Patch" instead of "Put" for: Invoke-RestMethod "$app_url/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroupName/$HostPoolName/auto-scale" -Method Patch -Headers $headers -Body $AutoScaleConfigBody
- You need to grant user access administrator or owner to the Resource Group otherwise the user assignments will not work. You could alternatively add it to the App Group but that requires permissions the app doesn't have anyways.
- Resource Group Name, Host Pool Name, and Desktop Image Name cannot have spaces in them, the code documented implies that it can.
I found a few issues while testing out the code that I wanted to share: