我们可以通过Visual Studio部署Azure自动化帐户和Runbook吗

时间:2019-05-08 10:33:44

标签: visual-studio azure

我正在开发一个与Azure通信的MVC应用程序。为此,我必须通过Visual Studio部署一些Azure组件。我已经使用从Market place下载的Azure逻辑应用程序工具通过visual studio部署了逻辑应用程序。现在,我需要部署计划的运行手册。我们是否可以通过Visual Studio部署自动化帐户和Runbook?

我已经检查了Visual Studio安装程序和Visual Studio市场。我找不到相关的来源。

1 个答案:

答案 0 :(得分:0)

您可以创建“ Azure资源组”项目,并使用ARM模板使用Visual Studio创建/部署自动化帐户和运行手册。

请参阅下面的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"
            }
          }
        }
      ]
    }
  ]
}

希望这会有所帮助。