Skip to content

Commit

Permalink
Dump out correlation id without verbose logging for resource deployme…
Browse files Browse the repository at this point in the history
…nt (#23626)

Co-authored-by: Ben Broderick Phillips <[email protected]>
  • Loading branch information
azure-sdk and benbp authored Oct 31, 2022
1 parent 00bd2a9 commit 3db4b37
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -723,29 +723,27 @@ try {
Log $msg

$deployment = Retry {
$lastDebugPreference = $DebugPreference
try {
if ($CI) {
$DebugPreference = 'Continue'
}
New-AzResourceGroupDeployment -Name $BaseName -ResourceGroupName $resourceGroup.ResourceGroupName -TemplateFile $templateFile.jsonFilePath -TemplateParameterObject $templateFileParameters -Force:$Force
} catch {
Write-Output @'
New-AzResourceGroupDeployment `
-Name $BaseName `
-ResourceGroupName $resourceGroup.ResourceGroupName `
-TemplateFile $templateFile.jsonFilePath `
-TemplateParameterObject $templateFileParameters `
-Force:$Force
}

if ($deployment.ProvisioningState -ne 'Succeeded') {
Write-Host "Deployment '$($deployment.DeploymentName)' has state '$($deployment.ProvisioningState)' with CorrelationId '$($deployment.CorrelationId)'. Exiting..."
Write-Host @'
#####################################################
# For help debugging live test provisioning issues, #
# see http://aka.ms/azsdk/engsys/live-test-help, #
# see http://aka.ms/azsdk/engsys/live-test-help #
#####################################################
'@
throw
} finally {
$DebugPreference = $lastDebugPreference
}
exit 1
}

if ($deployment.ProvisioningState -eq 'Succeeded') {
# New-AzResourceGroupDeployment would've written an error and stopped the pipeline by default anyway.
Write-Verbose "Successfully deployed template '$($templateFile.jsonFilePath)' to resource group '$($resourceGroup.ResourceGroupName)'"
}
Write-Host "Deployment '$($deployment.DeploymentName)' has CorrelationId '$($deployment.CorrelationId)'"
Write-Host "Successfully deployed template '$($templateFile.jsonFilePath)' to resource group '$($resourceGroup.ResourceGroupName)'"

$deploymentOutputs = SetDeploymentOutputs $serviceName $context $deployment $templateFile

Expand Down

0 comments on commit 3db4b37

Please sign in to comment.