Skip to content

Commit

Permalink
Improved exception handling in Bicep deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Helder Pinto committed May 24, 2024
1 parent 507fe12 commit 6ce3318
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/optimization-engine/Deploy-AzureOptimizationEngine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,11 @@ if ("Y", "y" -contains $continueInput) {
Write-Host "Failed deployment. Trying once more..." -ForegroundColor Yellow
}
} while (-not($deploymentSucceeded) -and $deploymentTries -lt $maxDeploymentTries)

if ($deployment.ProvisioningState -eq "Failed" -or $null -eq $deployment.Outputs)
{
throw "Deployment failed. Check the Azure subscription Activity Logs for more details."
}

$spnId = $deployment.Outputs['automationPrincipalId'].Value
#endregion
Expand Down

0 comments on commit 6ce3318

Please sign in to comment.