Not able to Provision Azure Virtual Desktop using Rest APIs
Dear Microsoft Community,
I am trying to build a POC for AVD(Azure Virtual Desktop) Provisioning using REST APIs.
I learned, for Provisioning a AVD, we need to complete few steps.
- Create Security Group (for Users, Administrators)
- Create Resource Group
- Create Virtual Network
- Create Sub Network
- Create Network Interface
- Create HostPool
- Create Session Host (Virtual Machine) in the Hostpool
- Create Hostpool Application Group
- Create Hostpool Work Space
- Add Security Groups to HostPool Application Group
- Add Resource Group IAM Roles (user, admin) to Security Group
Using Microsoft Azure RestAPIs I am able to complete 1st to 6th step.
When I am running the 7th step (For Create Session Host (Virtual Machine) in the Hostpool) the API status is Success but Session Host (VM) is not creating in the HostPool
Did any one worked on this kind of POC ?
I have followed below links to find the right API for Session Host (VM) creation in the Hostpool but could not get success.
I appreciate your response.
1 answer
-
Anonymous
Hi siddalinga,
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
It sounds like youβre encountering an issue with creating a Session Host (Virtual Machine) in the HostPool using Azure Virtual Desktop (AVD) REST APIs. To troubleshoot this issue, there are a few steps:
Make sure that the API permissions are correctly set up. The service principal or managed identity youβre using must have the necessary permissions to create resources in the specified resource group and subscription.
Double-check the API request payload for any missing or incorrect parameters. Ensure that all required fields are correctly populated.
Verify that you have not exceeded any quotas or limits for your subscription, such as the number of virtual machines or cores.
If an answer has been helpful, please consider accept the answer and "Upvote" to help increase visibility of this question for other members of the Microsoft Q&A community.
-
Anonymous
Hi siddalinga,
Just checking in to see if you had a chance to review my comment on your question. Please let us know if it was helpful and feel free to reach out if you have any further queries.
If you found the information useful, please click "Accept Answer" and "Upvote" on the post to let us know.
Thank You.
-
Anonymous
Hi siddalinga,
I wanted to check if you had the opportunity to review the information which was provided in my previous posted comment.
If it was helpful, please click "Accept Answer" and "Upvote" on his post to let us know.
Thank You.
-
siddalinga 0 Reputation points
Hi Sai Krishna, thank you very much for responding me.
API is able to create the Resource group, Virtual Network, Sub Network and HostPool but not Host session in the Hostpool.
I have tried running the below API. I am getting 201 as response code.
Here are the API details.
PUT:
Payload Body:
{
"properties": {
"friendlyName": "InitialConfiguration", "vmTags": { "Department": "myDepartment", "Team": "myTeam" }, "vmLocation": "centralindia", "vmResourceGroup": "AVD_RG", "vmNamePrefix": "westus2-vm", "availabilityZones": [ 1, 3 ], "networkInfo": { "subnetId": "/subscriptions/c8acbda6-91cb-4d19-a9eb-e7b49dc3502c/resourceGroups/AVD_RG/providers/Microsoft.Network/virtualNetworks/AVD_VNet/subnets/AVD_SNet" }, "vmSizeId": "Standard_D2s_v3", "diskInfo": { "type": "Standard_LRS" }, "customConfigurationScriptUrl": "https://storageaccountname.blob.core.windows.net/blobcontainer/file", "imageInfo": { "type": "Marketplace", "marketplaceInfo": { "offer": "Windows-10", "publisher": "MicrosoftWindowsDesktop", "sku": "19h2-ent", "exactVersion": "2019.0.20190115" }, "customInfo": { "resourceId": "/subscriptions/c8acbda6-91cb-4d19-a9eb-e7b49dc3502c/resourceGroups/AVD_RG/providers/Microsoft.Compute/images/imageName" } }, "domainInfo": { "joinType": "AzureActiveDirectory", "activeDirectoryInfo": { "domainCredentials": { "usernameKeyVaultSecretUri": "https://avdvault29thoct.vault.azure.net/secrets/itadminuser/afd48f655d324161b3588df659d795ab", "passwordKeyVaultSecretUri": "https://avdvault29thoct.vault.azure.net/secrets/itadmin/21fd17bced6a44e6b383d1a09d5a7f50" }, "ouPath": "OU=testOU,DC=domain,DC=Domain,DC=com", "domainName": "wvdarmtest1.net" }, "azureActiveDirectoryInfo": { "mdmProviderGuid": "bdefabc0-95b4-48b3-b645-8a753a63c4fa" } }, "securityInfo": { "type": "TrustedLaunch", "secureBootEnabled": true, "vTpmEnabled": true }, "vmAdminCredentials": { "usernameKeyVaultSecretUri": "https://avdvault29thoct.vault.azure.net/secrets/itadminuser/afd48f655d324161b3588df659d795ab", "passwordKeyVaultSecretUri": "https://avdvault29thoct.vault.azure.net/secrets/itadmin/21fd17bced6a44e6b383d1a09d5a7f50" }, "bootDiagnosticsInfo": { "enabled": true, "storageUri": "https://myStorageAccountName.blob.core.windows.net" }}
}
--
I have attached the Response screenshot.
Please let me know where I am doing wrong.
-
siddalinga 0 Reputation points
-
Anonymous
Hi siddalinga,
It looks like your request to create the session host was accepted, indicated by the 201 Created status code. The presence of the azure-asyncoperation URL in the response header means the operation is asynchronous, so youβll need to monitor this URL to track the status of the session host creation.
To check the status, send a GET request to the azure-asyncoperation URL. The response will show whether the operation is InProgress, Succeeded, or Failed. Keep polling until you see a Succeeded status. If itβs Failed, review the error details provided in the response to understand the issue.
For further reference, here are relevant Microsoft documents:
Session Host Configurations - Create Or Update
Track asynchronous Azure operationsIf an answer has been helpful, please consider accept the answer and "Upvote" to help increase visibility of this question for other members of the Microsoft Q&A community.
Sign in to comment -
