From 2ffe6c30194891a3ffcbd945c74578e5da594e1f Mon Sep 17 00:00:00 2001 From: Kofi Forson Date: Wed, 25 May 2022 16:00:31 -0400 Subject: [PATCH] Adding quickstart for validate with Windows image --- .../validators_with_a_windows_image.json | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 quickquickstarts/Using_Validators_with_a_Windows_image/validators_with_a_windows_image.json diff --git a/quickquickstarts/Using_Validators_with_a_Windows_image/validators_with_a_windows_image.json b/quickquickstarts/Using_Validators_with_a_Windows_image/validators_with_a_windows_image.json new file mode 100644 index 0000000..502e44e --- /dev/null +++ b/quickquickstarts/Using_Validators_with_a_Windows_image/validators_with_a_windows_image.json @@ -0,0 +1,80 @@ +{ + "location": "westus2", + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions//resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/": {} + } + }, + "properties": { + "source": { + "type": "PlatformImage", + "publisher": "MicrosoftWindowsDesktop", + "offer": "Windows-10", + "sku": "20h2-pro", + "version": "latest" + }, + "customize": [ + { + "type": "WindowsRestart", + "restartCommand": "shutdown /f /r /t 0 /c \"packer restart\"", + "restartCheckCommand": "", + "restartTimeout": "20m", + "name": "Restart Max" + }, + { + "type": "WindowsUpdate", + "searchCriteria": "IsInstalled=0", + "filters": [ + "exclude:$_.Title -like '*Preview*'", + "include:$true" + ], + "updateLimit": 20 + }, + { + "type": "PowerShell", + "name": "PowerShell Cmds Customizer test", + "inline": [ + "Write-Host HelloCustomize", + "New-Item -ItemType file c:\\example_1.txt", + "echo $?", + "Write-Host ByeCustomize" + ] + } + ], + "validate": { + "continueDistributeOnFailure": false, + "inVMValidations": [ + { + "type": "PowerShell", + "name": "test PowerShell validator inline", + "inline": [ + "Write-Host HelloValidate", + "New-Item -ItemType file c:\\valdnfile_1.txt", + "echo $?", + "Write-Host ByeValidate" + ] + }, + { + "type": "PowerShell", + "name": "", + "scriptUri": "", + "validExitCodes": [ + 0, + 1 + ] + } + ] + }, + "distribute": [ + { + "type": "SharedImage", + "galleryImageId": "/subscriptions//resourceGroups//providers/Microsoft.Compute/galleries//images/", + "runOutputName": "", + "replicationRegions": [ + "westus2" + ] + } + ] + } +}