【发布时间】:2017-07-09 03:10:28
【问题描述】:
我需要使用 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": {}
}
提前致谢!
【问题讨论】:
-
那么编译作业的代码在哪里呢?我真的不明白你想要达到什么目的。入职不会以任何方式引用资源组。所以它不需要。
-
抱歉 - 我发布了一些我不认识的代码。我已经更正了 - 对此感到抱歉。
-
顺便说一句,你能给我一个链接到如何使用模板开始编译作业的示例吗? (带参数),谢谢!
-
我看到了,但我说的是你传入的编译设置对象(你可以用虚假的值替换值,但如果是复杂对象,请保留结构)跨度>
标签: azure arm-template