【发布时间】:2017-03-28 12:38:27
【问题描述】:
我正在尝试使用以下模板在 ARM 模板中获取 Azure 订阅名称
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"variables": {
"subscriptionName": "[subscription().displayName]"
},
"resources": [ ],
"outputs": {
"exampleOutput": {
"value": "[variables('subscriptionName')]",
"type" : "object"
}
}
}
使用以下 powershell 命令运行上述模板
New-AzureRmResourceGroupDeployment -Name MyTest -ResourceGroupName EnvDev -TemplateFile C:\Users\xyz\test.json
但出现以下错误
New-AzureRmResourceGroupDeployment : 2:04:11 PM - {
"code": "DeploymentOutputEvaluationFailed",
"message": "Unable to evaluate template outputs: 'exampleOutput'. Please see error details and deployment operations. Please see https://aka.ms/arm-debug for usage details.",
"details": [
{
"code": "DeploymentOutputEvaluationFailed",
"target": "exampleOutput",
"message": "The template output 'exampleOutput' is not valid: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.."
}
]}
At line:1 char:1
+ New-AzureRmResourceGroupDeployment -Name SentienceTest -ResourceGroup ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
如何在 ARM 模板中获取订阅名称,在该模板下部署订阅?
有人知道这里有什么问题吗?
【问题讨论】:
标签: azure automation azure-resource-manager