引用其他资源组中的现有Azure自动化帐户

时间:2017-07-09 03:10:29

标签: azure arm-template

我需要使用ARM模板中的现有Azure自动化帐户来创建新的编译作业。当自动化帐户位于我部署的同一资源组中时,我知道如何执行此操作,但是当它是不同资源组中的现有自动化帐户时,我无法弄明白。

例如:

父模板(资源)



{
  "name": "dscCompile",
  "type": "Microsoft.Resources/deployments",
  "apiVersion": "2016-09-01",
  "dependsOn": [
    "[resourceId('Microsoft.Resources/deployments', 'newGuid')]"
  ],
  "properties": {
    "mode": "Incremental",
    "templateLink": {
      "uri": "[variables('templates').dsc]",
      "contentVersion": "1.0.0.0"
    },
    "parameters": {
      "compile-settings": {
        "value": {
          "configurationData": "[concat('{\"AllNodes\": [{\"NodeName\":\"*\",\"PSDscAllowPlainTextPassword\":true,\"RetryIntervalSec\":30,\"RetryCount\":20},{\"Nodename\":\"localhost\",\"domainName\":\"', parameters('extn-settings').domain, '\",\"adminCreds\":\"', parameters('adminPassword'), '\",\"Role\":\"DC\"}]}')]",
          "configurationName": "createPDC",
          "location": "Australia Southeast",
          "name": "[reference('newGuid').outputs.guid.value)]"
        }
      },                    
      "tag-values": {
        "value": "[parameters('tag-values')]"
      }
    }
 }




儿童模板



$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "compile-settings": {
            "type": "object",
            "metadata": {
                "description": "These are settings for a DSC Compile"
            }
        },
        "tag-values": {
            "type": "object",
            "metadata": {
                "description": "These are the Tag values"
            }
        }
    },
    "resources": [
        {
            "name": "[parameters('compile-settings').jobGuid]",
            "type": "Microsoft.Automation/automationAccounts/compilationjobs",
            "apiVersion": "2015-10-31",
            "location": "[parameters('compile-settings').location]",
            "tags": "[parameters('tag-values')]",
            "dependsOn": [],
            "properties": {
                "configuration": {
                    "name": "[parameters('compile-settings').configurationName]"
                },
                "parameters": {
                    "ConfigurationData": "[parameters('compile-settings').ConfigurationData]"
                }
            },
            "resources": []
        }       
    ],
    "outputs": {}
}




提前致谢!

1 个答案:

答案 0 :(得分:2)

好的,所以直到最近才能实现这一点,你可以用CSS escaping online完成。

基本上,您在模板(也称为嵌套\子模板)中创建模板并选择一个不同的资源组(使用该模板的$(."' . $row['vid_class'] . '").click(function() //If you are using class 属性。别无其他。

$(#"' . $row['vid_class'] . '").click(function() //If you are using id