Start and Stop Azure Virtual Machine

只谈情不闲聊 提交于 2019-12-24 10:38:37

问题


I need to start / stop a Azure virtual machine, but I don't know how I can do this. I don't know anything about Azure or Azure scripts.


回答1:


You have several options.

The first one is by using the Azure Portal. Click on your VM and at the bottom you should see a button to stop the virtual machine. Starting it again works the same way.

The second option is to use PowerShell. John McCabe has posted a simple script on his blog to do this. The most important functions are Start-AzureVM and Stop-AzureVM.

If you want to automate this from a developer perspective (which needs a little bit more work than the PowerShell solution) is by using the Azure Management Libraries. Brady Gaster wrote a great post about it.

The fourth option is to use Microsoft Azure Automation. There you create runbooks for common tasks. In the samples are scripts already included which can start and stop a VM.




回答2:


within the Azure portal (I would recommend using the new portal), go into the VM you need, on the dashboard you will see a Stop and Start button, or you can choose to Restart the VM. Hope this helps.




回答3:


You can also create a Timer-triggered Azure Function to start/stop your VM. I've provided the steps here:

Azure Function role like permissions to Stop Azure Virtual Machines

Instead of creating HTTP-triggered Functions, just use Timer-triggered functions instead and edit the PowerShell script content to hardcode the vmname and resourcegroup.



来源:https://stackoverflow.com/questions/26414738/start-and-stop-azure-virtual-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!