Azure Automation Account & Runbooks ARM 模板,uri 问题?

问题描述 投票:0回答:0

我需要使用 ARM 模板和 Azure Devops 管道部署存储自动化帐户和 5 个运行手册。

我创建了 dev.parameters.json。这是文件的内容。

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "comments": "Azure Portal Mentioned - For Python 3.8 (preview) packages use wheel files targeting cp38-amd64",
        "parameters": {
        "automation_account_name": {
            "value": "autoacc-xxxxxxxx-dev"
        },
        "blob_container_name": {
            "value": "python-xxxxxxxxxx-codes"
        },
        "runbook_list_array":{
            "value": ["script1.py","script2.py","script3.py","script4.py","script5.py"]
        },
        "storage_account_name":{
                    "value" : "storxxxxxxxdev"
        }
    }
}

这是我的 ARM 模板 (AutomationAccountTemplate.json)

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "automation_account_name": {
      "defaultValue": null,
      "type": "String"
    },
    "runbook_list_array": {
      "defaultValue": null,
      "type": "array"
    },
    "blob_container_name": {
      "defaultValue": null,
      "type": "String"
    },
    "storage_account_name": {
      "defaultValue": null,
      "type": "String"
    }
  },
  "variables": {
  },
  "resources": [
    {
      "type": "Microsoft.Automation/automationAccounts",
      "apiVersion": "2022-08-08",
      "name": "[parameters('automation_account_name')]",
      "location": "[resourceGroup().location]",
      "identity": {
        "type": "SystemAssigned"
      },
      "properties": {
        "publicNetworkAccess": true,
        "disableLocalAuth": false,
        "sku": {
          "name": "Basic"
        },
        "encryption": {
          "keySource": "Microsoft.Automation",
          "identity": {}
        }
      }
    },
    {
      "type": "Microsoft.Automation/automationAccounts/runbooks",
      "apiVersion": "2022-08-08",
      "location": "[resourceGroup().location]",
      "dependsOn": [
        "[resourceId('Microsoft.Automation/automationAccounts', parameters('automation_account_name'))]"
      ],
      "name": "[concat(parameters('automation_account_name'), '/', parameters('runbook_list_array')[copyIndex('runbookLoop')]   )]",
        "copy": {
            "name": "runbookLoop",
            "count": "[length(parameters('runbook_list_array'))]"
        },
      "properties": {
        "description": "Runbook description",
        "runbookType": "Python3",
        "logVerbose": false,
        "logProgress": false,
        "logActivityTrace": 0,
        "publishContentLink": {
          "uri": "[concat('https://', parameters('storage_account_name'), '.blob.core.windows.net/', parameters('blob_container_name'), '/', parameters('runbook_list_array')[copyIndex('runbookLoop')])]"
        }

      }
    }
  ],
  "outputs": {
    "nameResult": {
      "type": "array",
      "value": "[parameters('runbook_list_array')]"
    }
  }
}

当我运行管道时出现此错误:

我还尝试了“ARM 模板测试工具包”,它给我带来了 URI 问题:

 URIs Should Be Properly Constructed
    [-] URIs Should Be Properly Constructed (13 ms)
        Function 'concat' found within 'uri' Line: 73, Column: 12

我仔细检查了我的 URI 是否正常,或者我是否遗漏了什么?

azure azure-devops azure-resource-manager arm-template azure-automation
© www.soinside.com 2019 - 2024. All rights reserved.