Created
May 17, 2018 05:49
-
-
Save ngeegoh/369b3dac2d8e4f5661a5e7d2754c7bd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": { | |
"client_id": "{{env `AZURE_CLIENT_ID`}}", | |
"client_secret": "{{env `AZURE_CLIENT_SECRET`}}", | |
"tenant_id": "{{env `AZURE_TENANT_ID`}}", | |
"subscription_id": "{{env `AZURE_SUBSCRIPTION_ID`}}", | |
"object_id": "{{env `AZURE_OBJECT_ID`}}" | |
}, | |
"builders": [{ | |
"type": "azure-arm", | |
"client_id": "{{user `client_id`}}", | |
"client_secret": "{{user `client_secret`}}", | |
"tenant_id": "{{user `tenant_id`}}", | |
"subscription_id": "{{user `subscription_id`}}", | |
"object_id": "{{user `object_id`}}", | |
"managed_image_resource_group_name": "MyPacker", | |
"managed_image_name": "myPackerImage", | |
"virtual_network_name": "abcd", | |
"virtual_network_subnet_name": "Development", | |
"virtual_network_resource_group_name": "Networking", | |
"os_type": "Windows", | |
"image_publisher": "MicrosoftWindowsServer", | |
"image_offer": "WindowsServer", | |
"image_sku": "2016-Datacenter", | |
"disk_additional_size": "12", | |
"communicator": "winrm", | |
"winrm_use_ssl": "true", | |
"winrm_insecure": "true", | |
"winrm_timeout": "10m", | |
"winrm_username": "packer", | |
"azure_tags": { | |
"dept": "Engineering", | |
"task": "Image deployment" | |
}, | |
"location": "australiasoutheast", | |
"vm_size": "Standard_DS2_v2" | |
}], | |
"provisioners": [ | |
{ | |
"type": "powershell", | |
"inline": ["mkdir c:\\Packer"] | |
}, | |
{ | |
"type": "file", | |
"source": "ToUpload/", | |
"destination": "c:\\Packer" | |
}, | |
{ | |
"type": "windows-restart", | |
"restart_check_command": "powershell -command \"& {Write-Output 'restarted.'}\"" | |
}, | |
{ | |
"type": "windows-restart", | |
"restart_check_command": "powershell -command \"& {Write-Output 'restarted.'}\"" | |
}, | |
{ | |
"type": "powershell", | |
"script": | |
"ToUpload/join_domain.ps1" | |
}, | |
{ | |
"type": "windows-restart", | |
"restart_timeout": "10m", | |
"restart_check_command": "powershell -command \"& {Write-Output 'restarted.'}\"" | |
}, | |
{ | |
"type": "powershell", | |
"inline": [ | |
"Install-WindowsFeature Web-Server", | |
"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" | |
] | |
}] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Azure credentials need to be specified before running this JSON file.