《Windows Azure Platform 系列文章目录》html
以前Automation介绍的内容,是在ASM模式下自动化开关机。git
本章将介绍如何在Automation中,设置开关机脚本,操做Azure ARM VMgithub
1.首先咱们建立一个Azure Automation。图略post
2.建立完毕后,点击凭据,添加评估,输入名称为MyAccounturl
在凭据中,输入咱们登陆Azure Portal: https://portal.azure.cn/ 的用户名和密码。以下图:spa
3.咱们选择RunBook,选择建立Runbook。类型请选择PowerShellorm
4.开机的脚本请参考个人GitHub:htm
https://github.com/leizhang1984/AzureChinaAutomation/blob/master/ARM/StartARMVM.ps1blog
关机脚本:three
https://github.com/leizhang1984/AzureChinaAutomation/blob/master/ARM/StopARMVM.ps1
在脚本中的第一行语句:
$cred = Get-AutomationPSCredential -Name "MyAccount"
这里的MyAccount就是咱们在步骤2中的凭据。