-
Notifications
You must be signed in to change notification settings - Fork 12
/
windows-2019-iis.json
45 lines (37 loc) · 1.78 KB
/
windows-2019-iis.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
"builders": [{
"type": "azure-arm",
"client_id": "{{user `azure-client-id`}}",
"client_secret": "{{user `azure-client-secret`}}",
"tenant_id": "{{user `azure-tenant-id`}}",
"subscription_id": "{{user `azure-subscription-id`}}",
"managed_image_resource_group_name": "{{user `azure-resource-group`}}",
"managed_image_name": "WindowsServer2019-IIS-Packer",
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2019-Datacenter",
"communicator": "winrm",
"winrm_use_ssl": true,
"winrm_insecure": true,
"winrm_timeout": "3m",
"winrm_username": "packer",
"location": "{{user `azure-region`}}",
"vm_size": "{{user `vm-size`}}"
}],
"provisioners": [
{
"type": "powershell",
"inline": [
"# Install IIS",
"Install-WindowsFeature -name Web-Server -IncludeManagementTools",
"Install-WindowsFeature Web-Asp-Net45",
" # NOTE: the following *3* lines are only needed if the you have installed the Guest Agent.",
" while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureTelemetryService).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
"& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit /mode:vm",
"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 } }"
]
}]
}