Azure Automation (7) 执行Azure SQL Job

  《Windows Azure Platform 系列文章目录

  之前Automation介绍的内容,是在ASM模式下自动化开关机。

  本章将介绍如何在Automation中,设置开关机脚本,操作Azure ARM VM

  1.首先我们创建一个Azure Automation。图略

  2.创建完毕后,点击凭据,添加评估,输入名称为MyAccount

  在凭据中,输入我们登录Azure Portal: https://portal.azure.cn/  的用户名和密码。如下图:

  

  3.我们选择RunBook,选择创建Runbook。类型请选择PowerShell

  

  4.开机的脚本请参考我的GitHub:

  https://github.com/leizhang1984/AzureChinaAutomation/blob/master/ARM/StartARMVM.ps1

  关机脚本:

  https://github.com/leizhang1984/AzureChinaAutomation/blob/master/ARM/StopARMVM.ps1

  在脚本中的第一行语句:

  $cred = Get-AutomationPSCredential -Name "MyAccount"

  

  这里的MyAccount就是我们在步骤2中的凭据。

原文地址:https://www.cnblogs.com/threestone/p/11249628.html