您可以创建一个“Azure 资源组”项目并使用 ARM 模板来创建/部署自动化帐户和使用 Visual Studio 的 Runbook。
请参考下面的 json,它可以在 azuredeploy.json 中更新以创建/部署自动化帐户和运行手册。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "2.0.0.0",
"parameters": {
"accountName": {
"type": "String"
},
"location": {
"type": "String"
},
"samplePowerShellRunbookName": {
"type": "String"
},
"samplePowerShellRunbookDescription": {
"type": "String"
},
"samplePowerShellRunbookContentUri": {
"type": "String"
}
},
"resources": [
{
"type": "Microsoft.Automation/automationAccounts",
"apiVersion": "2015-01-01-preview",
"name": "[parameters('accountName')]",
"location": "[parameters('location')]",
"dependsOn": [],
"tags": {},
"properties": {
"sku": {
"name": "Basic"
}
},
"resources": [
{
"type": "runbooks",
"apiVersion": "2015-01-01-preview",
"name": "[parameters('samplePowerShellRunbookName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
],
"tags": {},
"properties": {
"runbookType": "PowerShell",
"logProgress": "false",
"logVerbose": "false",
"description": "[parameters('samplePowerShellRunbookDescription')]",
"publishContentLink": {
"uri": "[parameters('samplePowerShellRunbookContentUri')]",
"version": "1.0.0.0"
}
}
}
]
}
]
}
希望这会有所帮助。