아사 프,
이 불가능하지만 후속 VSTS 작업에 변수를 사용하고자하는 가정은, 여기를 달성하는 단계입니다. 마지막에, output 당신의 변수에 다음과 같은 주 ARM 템플릿 파일에서
:
"outputs": {
"vhdStorageName": {
"type": "string",
"value": "[variables('vhdStorageName')]"
}
}
배포 작업 후,이 PowerShell 스크립트를 실행하여 VSTS task 상황에서 변수를 설정 :
param ([string] $resourceGroupName)
#get the most recent deployment for the resource group
$lastRgDeployment = (Get-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName | Sort Timestamp -Descending | Select -First 1)
if(!$lastRgDeployment)
{
throw "Resource Group Deployment could not be found for '$resourceGroupName'."
}
$deploymentOutputParameters = $lastRgDeployment.Outputs
if(!$deploymentOutputParameters)
{
throw "No output parameters could be found for the last deployment of '$resourceGroupName'."
}
$deploymentOutputParameters.Keys | % { Write-Host ("##vso[task.setvariable variable="+$_+";]"+$deploymentOutputParameters[$_].Value) }
이 스크립트의 경우 배포를 수행 할 Azure 리소스 그룹 이름을 제공해야합니다. 스크립트는 자원 그룹에서 마지막 배포를 가져오고 각 출력을 VSTS 작업 컨텍스트의 변수로 설정합니다.
에 액세스합니다 변수 및 기타 VSTS 변수와 같은 매개 변수로 사용
-myparameter $(vhdStorageName)
아사 프, 당신이 ARM 템플릿 이외의 동일한 문자열을 생성 할 수 하시겠습니까? 또는 시나리오에서 ARM 템플릿의 문자열을 생성하여 출력으로 반환 한 다음 PowerShell 스크립트 또는 VSTS 작업에서 사용할 수 있습니까? –
어느 쪽이든합니다. 내 목표는 vsts 작업에서 그것을 사용하는 것입니다. 같은 방법으로 생성하거나 출력하십시오. –