minimal-windows-server-1903.json

{
  "provisioners": [
    {
      "type": "file",
      "source": "{{ template_dir }}/scripts/Windows/custom-scripts",
      "destination": "C:/"
    },
    {
        "type": "windows-restart",
        "restart_timeout": "30m"
    },
    {
        "type": "powershell",
        "scripts": [
            "{{ template_dir }}/scripts/Windows/create_appveyor_user.ps1"
        ],
        "environment_vars": [
            "appveyor_user={{user `install_user`}}",
            "appveyor_password={{user `install_password`}}"
        ]
    },
    {
        "type": "powershell",
        "inline":[
            "Write-Host \"Current user: $(whoami)\""
        ],
        "elevated_user": "{{user `install_user`}}",
        "elevated_password": "{{user `install_password`}}"
    },
    {
        "type": "powershell",
        "scripts":[
            "{{ template_dir }}/scripts/Windows/init_server.ps1"
        ],
        "elevated_user": "{{user `install_user`}}",
        "elevated_password": "{{user `install_password`}}"
    },
    {
        "type": "windows-restart",
        "restart_timeout": "30m"
    },
    {
        "type": "powershell",
        "inline":[
            "docker pull mcr.microsoft.com/windows/servercore:1903",
            "docker pull mcr.microsoft.com/windows/nanoserver:1903"
        ],
        "elevated_user": "{{user `install_user`}}",
        "elevated_password": "{{user `install_password`}}"
    },
    {
        "type": "powershell",
        "scripts":[
            "{{ template_dir }}/scripts/Windows/install_path_utils.ps1",
            "{{ template_dir }}/scripts/Windows/install_powershell_core.ps1",
            "{{ template_dir }}/scripts/Windows/install_powershell_get.ps1",
            "{{ template_dir }}/scripts/Windows/install_7zip.ps1",
            "{{ template_dir }}/scripts/Windows/install_chocolatey.ps1",
            "{{ template_dir }}/scripts/Windows/install_nuget.ps1",
            "{{ template_dir }}/scripts/Windows/install_pstools.ps1"
        ],
        "elevated_user": "{{user `install_user`}}",
        "elevated_password": "{{user `install_password`}}"
    },
    {
        "type": "powershell",
        "scripts":[
            "{{ template_dir }}/scripts/Windows/install_git.ps1",
            "{{ template_dir }}/scripts/Windows/install_git_lfs.ps1",
            "{{ template_dir }}/scripts/Windows/install_mercurial.ps1",
            "{{ template_dir }}/scripts/Windows/install_subversion.ps1",
            "{{ template_dir }}/scripts/Windows/add_ssh_known_hosts.ps1"
        ],
        "elevated_user": "{{user `install_user`}}",
        "elevated_password": "{{user `install_password`}}"
    },
    {
        "type": "powershell",
        "scripts":[
            "{{ template_dir }}/scripts/Windows/install_nodejs_latest.ps1",
            "{{ template_dir }}/scripts/Windows/install_test_agent_build_tools_2019.ps1",
            "{{ template_dir }}/scripts/Windows/install_dotnet_devpack.ps1",
            "{{ template_dir }}/scripts/Windows/install_dotnet_sdk.ps1"
        ],
        "elevated_user": "{{user `install_user`}}",
        "elevated_password": "{{user `install_password`}}"
    },
    {
        "type": "powershell",
        "scripts":[
            "{{ template_dir }}/scripts/Windows/install_appveyor_build_agent_core.ps1",
            "{{ template_dir }}/scripts/Windows/enable_autologon.ps1"
        ],
        "environment_vars": [
            "appveyor_user={{user `install_user`}}",
            "appveyor_password={{user `install_password`}}",
            "build_agent_mode={{user `build_agent_mode`}}"
        ],
        "elevated_user": "{{user `install_user`}}",
        "elevated_password": "{{user `install_password`}}"
    },
    {
        "type": "powershell",
        "scripts":[
            "{{ template_dir }}/scripts/Windows/run_custom_scripts.ps1"
        ],
        "elevated_user": "{{user `install_user`}}",
        "elevated_password": "{{user `install_password`}}"
    }
  ],
  "builders": [
    {
        "type": "azure-arm",
        "subscription_id": "{{ user `azure_subscription_id` }}",
        "client_id": "{{ user `azure_client_id` }}",
        "client_secret": "{{ user `azure_client_secret` }}",
        "location": "{{ user `azure_location` }}",

        "temp_resource_group_name": "packer-RG-win-{{uuid}}",

        "os_type": "Windows",
        "image_publisher": "MicrosoftWindowsServer",
        "image_offer": "WindowsServer",
        "image_sku": "Datacenter-Core-1903-with-Containers-smalldisk",
        "vm_size": "{{user `azure_vm_size`}}",
        "os_disk_size_gb": 128,

        "capture_container_name": "appveyor-images-win",
        "capture_name_prefix": "win-{{user `datemark`}}",
        "resource_group_name": "{{ user `azure_resource_group_name` }}",
        "storage_account": "{{ user `azure_storage_account` }}",

        "communicator": "winrm",
        "winrm_use_ssl": "true",
        "winrm_insecure": "true",
        "winrm_timeout": "30m",
        "winrm_username": "packer",

        "azure_tags": {
          "automation": "packer",
          "OS": "Windows Server version 1903 with Containers",
          "description": "{{user `image_description`}}",
          "date": "{{user `datemark`}}"
        }
    }
  ],
  "post-processors": [
    {
      "type": "manifest",
      "output": "{{user `packer_manifest`}}",
      "strip_path": true
    }
  ]
}