Automatic start / stop of VM (Windows 10) in Azure

Michal Sumega 1 Reputation point
2021-03-31T16:34:51.027+00:00

Hello all,

First of all, I'm just a beginner with Azure...

I have a Windows 10 VM running in Azure that has a company app installed on it. Users use that app only few days a month - rest of the time it is not required to be up and running. What would be the best solution to achive the below?

  1. for shutting down the VM - I can use "Auto-shutdown" feature under the VM. So this is fine
  2. how to achive that a VM will start when a user wants to connect to it? ... a while ago, I've seen a feature called "Start VM on Connect" that was in public preview for WVD. Is this a way to go? Is that feature already released?

thanks

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,088 questions
Azure Virtual Desktop
Azure Virtual Desktop
A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
1,853 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Andreas Baumgarten 124K Reputation points MVP Volunteer Moderator
    2021-03-31T21:54:02.87+00:00

    Hi @Michal Sumega ,

    Using PowerShell to start a VM ion Azure is possible:
    https://learn.microsoft.com/en-us/powershell/module/az.compute/start-azvm?view=azps-5.7.0

    Before you need to login to Azure:
    https://learn.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azps-5.7.0

    And the user needs the permission to start the VM.
    https://stackoverflow.com/questions/23668154/allow-users-to-start-stop-particular-azure-vms/49925159

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    1 person found this answer helpful.
    0 comments No comments

  2. kobulloc-MSFT 26,811 Reputation points Microsoft Employee Moderator
    2021-03-31T19:30:12.27+00:00

    Hello, and welcome to Azure!

    Specific to your scenario where you have a group of users who use an app only a few days a month, you may want to look into Azure DevTest Labs. It's designed to allow a group of people the ability to self service a configured VM (or set of VMs). With DevTest Labs you can:

    • Set auto startup schedules
    • Set auto shutdown schedules
    • Automatically disconnect when a machine is idle for X minutes
    • Shut down X minutes after a user disconnects
    • Shut down X minutes if a user does not connect

    More information about Azure DevTest Labs:

    It's possible to do much of this with a standard VM as well however outside of Auto-shutdown (which is an easy feature to both toggle and set), setup can be more involved. The Start/Stop VMs during off-hours documentation walks you through that process:

    https://learn.microsoft.com/en-us/azure/automation/automation-solution-vm-management

    As far as Windows Virtual Desktop is concerned, Start VM on connect is currently in preview (I haven't seen anything in the current documentation about this, just blogs and preview announcements):

    https://techcommunity.microsoft.com/t5/video-hub/ops110-windows-virtual-desktop-wvd-roadmap-deep-dive/m-p/2177436


  3. Michal Sumega 1 Reputation point
    2021-03-31T21:42:19.263+00:00

    thank you for info...

    I've gone through the links, but looks like there is no option to start VM automaticaly when users tries to connect (except that WVD feature that is in preview). It is just scheduled start. Shutting down a VM seems to be quite easy though...

    maybe... is there any powershell script that could be placed on a user's destkop that he would run to start the VM when required? And for shutting the VM down, using Auto-shutdown should be fine for me.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.