对 ARM 模板部署有疑问,特别是使用 New-AzureRmResourceGroupDeployment cmdlet 从 Runbook Powershell 工作流调用该部署。我正在尝试使用动态复制循环,因此我在模板中使用以下格式化参数:
"aseApAppSettings": {
"type": "object",
"defaultValue": {
"apps": [
{
"name": "app-api-ecom",
"kind": "api"
},
{
"name": "app-ecom",
"kind": "web"
}
]
}
},
然后我基于此创建资源:
{
"type": "Microsoft.Web/sites",
"kind": "[parameters('aseApAppSettings').apps[copyIndex()].kind]",
"name": "[concat(parameters('aseApName'),'sv-',parameters('aseApAppSettings').apps[copyIndex()].name)]",
"apiVersion": "2016-08-01",
"location": "East US 2",
"scale": null,
"properties": {...
},
"copy": {
"name": "svLoop",
"count": "[length(parameters('aseApAppSettings').apps)]"
},
"dependsOn": []
},
通过模板部署部署模板时所有工作
我需要从 Powershell Workflow Runbook 调用此部署,并且很难定义参数
我尝试将其设置为
{"apps":[{"name":"falcon-api-ecom","kind":"api"},{"name":"falcon-ecom","kind":"web"}]}
在测试期间,但失败并显示消息“找不到参数”
所以我尝试使用ConvertFrom-Json
但它会将其发送到我的模板
"CliXml": "<Objs Version=\"1.1.0.1\"
xmlns=\"http://schemas.microsoft.com/powers...
请帮忙,
谢谢
来自 Runbook 的示例
workflow Build-Ase {
param
(
#Environment Parameters
[Parameter(Mandatory = $true)]
[object]
$aseApAppSettings
)
$params = @{
"aseApAppSettings" = $aseApAppSettings;
}
$job = New-AzureRmResourceGroupDeployment -ResourceGroupName $vnetRGName -TemplateUri $templateParameterUri -TemplateParameterObject $params
Write-Output $job