From 3ca4a7208fcc4db3f9b153a14758cc12be4abba0 Mon Sep 17 00:00:00 2001 From: Hariharan Jayaraman Date: Fri, 18 May 2018 08:12:43 -0700 Subject: [PATCH] Updated Samples and added a windows quick start as well --- examples/azure/windows.json | 4 +-- examples/azure/windows_quickstart.json | 36 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 examples/azure/windows_quickstart.json diff --git a/examples/azure/windows.json b/examples/azure/windows.json index b2e0e49fd..e0b03b7ae 100644 --- a/examples/azure/windows.json +++ b/examples/azure/windows.json @@ -2,8 +2,7 @@ "variables": { "client_id": "{{env `ARM_CLIENT_ID`}}", "client_secret": "{{env `ARM_CLIENT_SECRET`}}", - "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}", - "object_id": "{{env `ARM_OBJECT_ID`}}" + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}" }, "builders": [{ "type": "azure-arm", @@ -11,7 +10,6 @@ "client_id": "{{user `client_id`}}", "client_secret": "{{user `client_secret`}}", "subscription_id": "{{user `subscription_id`}}", - "object_id": "{{user `object_id`}}", "managed_image_resource_group_name": "packertest", "managed_image_name": "MyWindowsOSImage", diff --git a/examples/azure/windows_quickstart.json b/examples/azure/windows_quickstart.json new file mode 100644 index 000000000..3f7a1e9bb --- /dev/null +++ b/examples/azure/windows_quickstart.json @@ -0,0 +1,36 @@ +{ + "variables": { + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}" + }, + "builders": [{ + "type": "azure-arm", + + "subscription_id": "{{user `subscription_id`}}", + + "managed_image_resource_group_name": "packertest", + "managed_image_name": "MyWindowsOSImage", + + "os_type": "Windows", + "image_publisher": "MicrosoftWindowsServer", + "image_offer": "WindowsServer", + "image_sku": "2012-R2-Datacenter", + + "communicator": "winrm", + "winrm_use_ssl": "true", + "winrm_insecure": "true", + "winrm_timeout": "3m", + "winrm_username": "packer", + + "location": "South Central US", + "vm_size": "Standard_DS2_v2" + }], + "provisioners": [{ + "type": "powershell", + "inline": [ + "if( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force}", + "& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit", + "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 } }" + ] + }] +} +