Last thursday WVD (Windows Virtual Desktop) Spring Update went into Public preview, Christiaan Brinkhoff and Freek Berson both wrote a good blog about that. You can open Freek’s blog from here, and Christiaan’s blog from here. Integration of WVD in the Azure portal was one of the most wanted features which has finally arrived. So from now on it’s possible to do the entire configuration of WVD from the Azure portal itself, which was previously only possible via Powershell. Dean Cefola released a nice overview of the WVD capabilities from the Azure portal together with some background information. Check out the video here! Now lets see how to use Windows Virtual Desktop at REST 😉
WVD ARM Template and REST API support
WVD is moving to the ARM model and one of the advantages is that we are able to configure WVD using ARM templates. Also the ones who prefer to use the REST API to configure their favorite Azure resources are lucky. You can now take advantage of the DesktopVirtualization providers to query or configure your WVD environment. I’m in a team that’s developing a highly automated Microsoft 365 and WVD solution called Smarter365 (If you want to use a highly standardized Microsoft 365 and/or WVD environment, ping me!) and I am very happy with this update of WVD. While we wait for the official documentation from Microsoft I like to share my personal findings on how you can use the WVD REST API!
Postman and Azure Management API
In order to test the WVD (and all Azure API’s) I like to use the Postman application. If you don’t have a App registration in place yet, you need to create one. Check out this blog from Pawel Liebich. Pawel explains in detail how you create an App registration and shows you how to obtain a bearer token. In your target Azure subscription assign the correct role to your App registration (Before creating the bearer token). Copy and paste your bearer token in the Authorization area in Postman (screenshot below).
WVD REST API examples
In the section below you will find some examples, but It’s good to understand that the settings I am using in the JSON snippets are not reflecting a real WVD configuration. Check the official WVD documentation, to discover the settings that will fulfill your needs. The full WVD REST API documentation will appear there in the future as well. (I will update this blog when the REST API is in place). If you follow the examples below, you will:
- Create a hostpool.
- Create a desktop group and attach it to the created hostpool;
- Create a workspace and attach te desktop group to the workspace.
Please replace SUBSCRIPTIONID and RESOURCEGROUP with your own values! Additional you can also use your own names!
#1: WVD hostpools
Example: Create hostpool
URL:
PUT https://management.azure.com/subscriptions/SUBSCRIPTIONID/resourceGroups/RESOURCEGROUP/providers/Microsoft.DesktopVirtualization/hostpools/Smarter 365 Hostpool?api-version=2019-01-23-preview
Request body:
{ "name": "Smarter 365 Hostpool", "type": "Microsoft.DesktopVirtualization/hostpools", "location": "eastus", "tags": {}, "kind": null, "properties": { "friendlyName": null, "description": "Smarter 365 hostpool located in EastUs", "hostPoolType": "Shared", "personalDesktopAssignmentType": null, "customRdpProperty": "", "maxSessionLimit": 200, "loadBalancerType": "BreadthFirst", "validationEnvironment": null, "ring": null, "vmTemplate": null } }
URL: https://management.azure.com/subscriptions/SUBSCRIPTIONID/resourceGroups/RESOURCEGROUP/
providers/Microsoft.DesktopVirtualization/hostpools/HOSTPOOLNAME?api-version=2019-01-23-preview
Methods: GET, PUT, DELETE
Remark: Use PUT to create and/or update your hostpool
#2 Application / desktop groups
Example: Create desktop group AND attach to hostpool
URL:
PUT https://management.azure.com/subscriptions/SUBSCRIPTIONID/resourceGroups/RESOURCEGROUP/providers/Microsoft.DesktopVirtualization/applicationgroups/Smarter 365 Full desktop?api-version=2019-01-23-preview
Request body:
{ "name": "Smarter 365 Full desktop", "type": "Microsoft.DesktopVirtualization/applicationgroups", "location": "eastus", "tags": {}, "kind": "Desktop", "properties": { "hostPoolArmPath": "/subscriptions/SUBSCRIPTIONID/resourcegroups/RESOURCEGROUP/providers/Microsoft.DesktopVirtualization/hostpools/Smarter 365 Hostpool", "workspaceArmPath": null, "description": "", "friendlyName": "", "applicationGroupType": "Desktop" } }
URL: https://management.azure.com/subscriptions/SUBSCRIPTIONID/resourceGroups/RESOURCEGROUP/ providers/Microsoft.DesktopVirtualization/applicationgroups/APPGROUPNAME?api-version=2019-01-23-preview
Methods: GET, PUT, DELETE
Remark: Use PUT to create and/or update your application group.
#3 WVD Workspace
Example: Create workspace AND attach application group
URL:
PUT https://management.azure.com/subscriptions/SUBSCRIPTIONID/resourceGroups/RESOURCEGROUP/providers/Microsoft.DesktopVirtualization/workspaces/Smarter 365 Workspace?api-version=2019-01-23-preview
Request body:
{ "name": "Smarter 365 Workspace", "type": "Microsoft.DesktopVirtualization/workspaces", "location": "eastus", "tags": {}, "kind": null, "properties": { "description": "", "friendlyName": "Smarter 365 Workspace", "applicationGroupReferences": [ "/subscriptions/SUBSCRIPTIONID/resourcegroups/RESOURCEGROUP/providers/Microsoft.DesktopVirtualization/applicationgroups/Smarter 365 Full desktop" ] } }
URL: https://management.azure.com/subscriptions/SUBSCRIPTIONID/resourceGroups/RESOURCEGROUP/
providers/Microsoft.DesktopVirtualization/workspaces/WORKSPACENAME?api-version=2019-01-23-preview
Methods: GET, PUT, DELETE
Remark: Use PUT to create and/or update your workspace
Summary
Using the Azure Management API’s is so much fun, and now we are able to use REST API calls to query my favorite Azure service: Windows Virtual Desktop. I hope you enjoyed this blogpost and that you are able to get started to query your own WVD environments. I you have questions please drop a message at the bottom of this page or send us a e-mail: info@microsoft365.nl
2 reacties
Hi MANFRED DE LAAT,
I have read your post about WVD and it is wonderful and do helpful. Now, I have setup it all these resources in Azure for windows virtual desktop. However, I cannot assign users to the application groups through API rest, only I did it by Azure Portal. Do you know how can I do it with Postman?
Thanks in advance I look forward to hearing from you soon.
Regards,
Edwin Figueroa.
how to add Vmtemplate isntead of null