github.com/inloco/packer@v1.3.2/examples/azure/windows.json (about) 1 { 2 "variables": { 3 "client_id": "{{env `ARM_CLIENT_ID`}}", 4 "client_secret": "{{env `ARM_CLIENT_SECRET`}}", 5 "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}" 6 }, 7 "builders": [{ 8 "type": "azure-arm", 9 10 "client_id": "{{user `client_id`}}", 11 "client_secret": "{{user `client_secret`}}", 12 "subscription_id": "{{user `subscription_id`}}", 13 14 "managed_image_resource_group_name": "packertest", 15 "managed_image_name": "MyWindowsOSImage", 16 17 "os_type": "Windows", 18 "image_publisher": "MicrosoftWindowsServer", 19 "image_offer": "WindowsServer", 20 "image_sku": "2012-R2-Datacenter", 21 22 "communicator": "winrm", 23 "winrm_use_ssl": "true", 24 "winrm_insecure": "true", 25 "winrm_timeout": "3m", 26 "winrm_username": "packer", 27 28 "location": "South Central US", 29 "vm_size": "Standard_DS2_v2" 30 }], 31 "provisioners": [{ 32 "type": "powershell", 33 "inline": [ 34 "if( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force}", 35 "& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit", 36 "while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10 } else { break } }" 37 ] 38 }] 39 } 40