diff --git a/helpers/GenerateResourcesAndImage.ps1 b/helpers/GenerateResourcesAndImage.ps1 index d90dc87c6..27659c9ce 100644 --- a/helpers/GenerateResourcesAndImage.ps1 +++ b/helpers/GenerateResourcesAndImage.ps1 @@ -88,6 +88,8 @@ Function GenerateResourcesAndImage { .PARAMETER AllowBlobPublicAccess The Azure storage account will be created with this option. + .PARAMETER OnError + Specify how packer handles an error during image creation. .EXAMPLE GenerateResourcesAndImage -SubscriptionId {YourSubscriptionId} -ResourceGroupName "shsamytest1" -ImageGenerationRepositoryRoot "C:\virtual-environments" -ImageType Ubuntu1804 -AzureLocation "East US" #> @@ -119,6 +121,9 @@ Function GenerateResourcesAndImage { [Parameter(Mandatory = $False)] [bool] $EnableHttpsTrafficOnly = $False, [Parameter(Mandatory = $False)] + [ValidateSet("abort","ask","cleanup","run-cleanup-provisioner")] + [string] $OnError = "ask", + [Parameter(Mandatory = $False)] [hashtable] $Tags ) @@ -281,7 +286,7 @@ Function GenerateResourcesAndImage { $builderScriptPath = $builderScriptPath_temp } - & $packerBinary build -on-error=ask ` + & $packerBinary build -on-error=$($OnError) ` -var "client_id=$($spClientId)" ` -var "client_secret=$($ServicePrincipalClientSecret)" ` -var "subscription_id=$($SubscriptionId)" `