2016-11-14 31 views
0

私は、次のテンプレートAzureのサブスクリプション名に

New-AzureRmResourceGroupDeployment -Name MyTest -ResourceGroupName EnvDev -TemplateFile C:\Users\xyz\test.json

しかし、次の取得次のPowerShellコマンドを使用してテンプレート上に実行

{ 
    "$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" 
    } 
    } 
} 

を使用してARMテンプレートにAzureのサブスクリプション名を取得しようとしていますエラー

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テンプレートでサブスクリプション名を取得するにはどうすればよいですか?

ここで何が間違っているのですか?あなたの操作の誤りに判断

答えて

1

、私はあなたが次のことを試してくださいお勧めします:

"outputs": { 
    "exampleOutput": { 
     "value": "[variables('subscriptionName')]", 
     "type" : "string" 
    } 
    } 

だから、文字列に「タイプ」に変更します。

関連する問題