From b7ff91a658ff7d5baf2eca385eb6e6c969420a12 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Thu, 27 Oct 2022 14:21:03 -0400 Subject: [PATCH] Dump out correlation id without verbose logging for resource deployment --- .../TestResources/New-TestResources.ps1 | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index 25d8060cc116..8fdcaad7f794 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -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