[英]I want to be able to schedule a shutdown and restart of a VM on azure using Powershell
I have a VM machine that i would like to shutdown/power off at a certain time and then restart at a certain time. 我有一台VM机器,我想在特定时间关闭/关闭电源,然后在特定时间重新启动。 I have tried this in task scheduler and obviously i can shutdown at a given time but cant then set the restart time
我已经在任务计划程序中尝试过了,显然我可以在给定的时间关闭,但是不能设置重启时间
I would like the VM machine to shutdown at 10pm and restart at 5am and run a task scheduler task i have that restarts key services (that side of it works) 我希望VM机器在晚上10点关闭并在凌晨5点重新启动,并运行一个任务计划程序任务,该任务可以重新启动关键服务(该端的工作原理)
I have played around with automation tasks within azure but run into a variety of RMLogin issues 我曾在天蓝色内玩过自动化任务,但遇到了各种RMLogin问题
i just want the simplest way to schedule this 我只想要最简单的方法来安排这个
there is no auto-startup as far as I'm aware, so you'd have to use some sort of Automation. 据我所知,没有自动启动功能,因此您必须使用某种自动化功能。 There is an official solution from Microsoft .
Microsoft提供了一个官方解决方案 。 Which is somewhat overkill, but should work (never tried it, tbh).
这有点矫kill过正,但是应该可以工作(从来没有尝试过,TBH)。 There are various other scripts online that work with Azure Automation.
在线上还有各种其他脚本可与Azure自动化一起使用。 They are easily searchable ( like so ).
它们很容易搜索( 像这样 )。
If you go to my blog you can also find an example script that does the same, and an example of a runbook that you can trigger manually to start\\stop vms 如果您转至我的博客,还可以找到执行相同操作的示例脚本,以及可以手动触发以启动/停止vms的运行手册示例
I would assume you would have gone through the below mentioned suggestion, The automation book https://docs.microsoft.com/en-us/azure/automation/automation-solution-vm-management is the way to achieve this. 我假设您会通过以下建议,自动化书https://docs.microsoft.com/zh-cn/azure/automation/automation-solution-vm-management是实现此目的的方法。 You can achieve auto shutdown via the portal but not restart and start.
您可以通过门户网站实现自动关闭,但不能重新启动和启动。
Please check this links that talks about Start and Shut down role of the VM through REST API. 请检查此链接,该链接讨论通过REST API的虚拟机的启动和关闭角色。 You can wire up the end point with Azure Function, Puppet, or Chef to automate this process
您可以使用Azure Function,Puppet或Chef连接端点以自动执行此过程
VM - Start/Shut down Role(s): https://docs.microsoft.com/en-us/previous-versions/azure/reference/jj157189(v=azure.100) VM-启动/关闭角色: https ://docs.microsoft.com/zh-cn/previous-versions/azure/reference/jj157189( v=azure.100)
If anything doesn't work for you I would suggest to leave your feedback. 如果对您不起作用,我建议您留下您的反馈意见。 So to simply answer your question, no, there is not a more simple way to achieve this.
因此,简单地回答您的问题,不,没有更简单的方法可以实现此目的。
If you want, you can add your feedback for this feature suggestion here https://feedback.azure.com/forums/34192--general-feedback 如果需要,您可以在此处添加对此功能建议的反馈https://feedback.azure.com/forums/34192--general-feedback
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.