Forum Discussion
BerndLoehlein
Microsoft
Apr 21, 2021Deallocate VM on user logoff
Recently we've announced the public preview of start VM on connect which will allow your deallocated virtual machines getting started automatically when the assigned user tries to connect. Let us hav...
- Sep 20, 2021
Could you please try to update the custom role used for Start VM on Connect and add Microsoft.Compute/virtualMachines/instanceView/read to it? This should ensure that sessions are removed in the service upon deallocation of the virtual machine.
We've already updated our docs for Start VM on Connect, but could be easily missed by customers already using this feature.
JosLieben
Aug 18, 2022Iron Contributor
We use Azure Virtual Desktop using Azure AD Join (AAD) and Intune (Microsoft Endpoint Manager), so I base64 encoded your sample script and used it in a scheduled task that fires on signoff events.
Here's the code for others who would like to use it:
https://gitlab.com/Lieben/assortedFunctions/-/blob/master/set-AVDDeallocateOnLogoff.ps1
and a short post describing it:
https://www.lieben.nu/liebensraum/2022/08/deallocate-azure-ad-joined-azure-virtual-desktop-vms-when-a-user-logs-off/
Here's the code for others who would like to use it:
https://gitlab.com/Lieben/assortedFunctions/-/blob/master/set-AVDDeallocateOnLogoff.ps1
and a short post describing it:
https://www.lieben.nu/liebensraum/2022/08/deallocate-azure-ad-joined-azure-virtual-desktop-vms-when-a-user-logs-off/