In azure devops CI pipelines i am deploying arm template for resource creation .In the release process how do i extract the resources created names from artifact so that i can refer to correct resource for deployment on azure
2
votes
2 Answers
0
votes
You could leverage the outputs
section of an ARM template for this.
These values are recorded in the deployment created which you could fetch, either using the Get-AzResourceGroupDeployment
cmdlet or az group deployment show
command as documented in this section.
0
votes
Assuming that you use New-AzureRmResourceGroupDeployment
cmdlet here is what I do to get the json output.
$jsonOutput = New-AzureRmResourceGroupDeployment -Name $DeploymentName `
-ResourceGroupName $ResourceGroupName `
-TemplateFile $TemplateFileToDeploy `
-TemplateParameterObject $TemplateParameters `
-Force -Verbose `
-ErrorVariable ErrorMessages -DeploymentDebugLogLevel
Thereafter, I use either the $jsonOuput.Outputs
which contain template outputs or the $jsonOutput.Parameters
which in my case contains the resource names
and other stuff.