【发布时间】:2020-08-20 09:17:17
【问题描述】:
我有下面给出的示例 ARM 模板。字段订阅、资源组和位置在部署时提供给用户的第一部分 ARM 模板,之后提供参数部分。资源组是 Azure ARM 本身提供的下拉字段,我需要在其中提供任何一个资源组作为列表中存在的默认资源组。这怎么可能?
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"writePermission": {
"defaultValue": "No",
"allowedValues": [
"No",
"Yes"
],
"type": "String",
"metadata": {
"description": "the permission type"
}
}
},
"variables": {
"location": "[resourceGroup().location]",
"templateUri": "[deployment().properties.templateLink.uri]"
},
"resources": [
],
"outputs": {
"result": {
"type": "String",
"value": "[variables('templateUri')]"
}
}
}
这就是模板的渲染方式。
预期的解决方案: 而不是资源组中的空白值,它应该预先填充资源组下拉列表中的第一个字段。
【问题讨论】:
-
如果这是可能的,我会感到惊讶
-
就像我们为用户提供的带有选项的参数提供默认值一样,我们可以为 ARM 基本块做同样的事情吗? @Paolo
-
问题是 subscription 和 resource group 是由 Azure 管理的。你可以做这样的事情stackoverflow.com/questions/48183581/… 作为一个黑客
标签: azure arm-template