vm_windows

Description

Creates a Windows Server 2019 virtual machine and configures it with to run IIS following a public example published by Microsoft. This virtual machine has a public ip address and allows ports 80 and 3389 inbound. You must provide an admin_password for Azure and an admin_public_key for AWS.

Concepts

The following concepts are present in this example:

  • IIS

  • Public IP

  • RDP

  • Remote Desktop

  • Secrets

  • Userdata

  • Variables

  • Virtual Machine

  • Windows

Venues

This example is regularly tested against:

awsazure

Release Notes

1.0

  • Initial release.

1.1

  • Changed the admin_password to a secret variable.

Blueprint

---
variables:
  admin_username:
    description: >-
      The administrative account username to use for RDP access.  Note this only
      works on Azure; on AWS this variable is ignored and `Administrator` is used.
      This is an issue we are aware of and plan to resolve.
    type: string
    default: adminuser
  admin_password:
    description: >-
      The administrative account password to use for RDP access.  Note this only
      works on Azure; on AWS this variable is ignored, as the EC2Launch service
      generates a random password that you must acquire through the AWS console.
      This is an issue we are aware of and plan to resolve.
    type: secret
  admin_public_key:
    description: >-
      The OpenSSH Public Key used to protect access to the randomly generated
      Administrative password on AWS.  This is ignored on Azure.
      This is an issue we are aware of and plan to resolve.
    type: string

location:
  region:
    my-region:
      country: USA
      area: northwest
  folder:
    tuono-vm-windows:
      region: my-region

networking:
  network:
    testing:
      range: 10.0.0.0/16
      scope: public
  subnet:
    public:
      range: 10.0.0.0/24
      network: testing
      firewall: vm-windows-access
      scope: public
  protocol:
    http:
      ports:
        - port: 80
          proto: tcp
    rdp:
      ports:
        - port: 3389
          proto: tcp
  firewall:
    vm-windows-access:
      rules:
        - protocols:
            - http
            - rdp
          to: self

compute:
  image:
    ws2019:
      publisher: MicrosoftWindowsServer
      product: WindowsServer
      sku: 2019-Datacenter
      venue:
        aws:
          # The image_id is region specific.
          # https://aws.amazon.com/windows/resources/amis/
          image_id: ami-00186dc7283622336
  vm:
    example:
      cores: 1
      memory: 3 GB
      image: ws2019
      nics:
        external:
          ips:
            - private:
                type: dynamic
              public:
                type: dynamic
          firewall: vm-windows-access
          subnet: public
      tags:
        wicked: awesome
      configure:
        admin:
          username: (( admin_username ))
          password: (( admin_password ))
          public_key: (( admin_public_key ))
        userdata:
          type: powershell
          content: |
            Add-WindowsFeature Web-Server
            Add-Content -Path "C:\inetpub\wwwroot\Default.htm" -Value $($env:computername)
            New-Item -Force -ItemType directory -Path "C:\inetpub\wwwroot\images"
            New-Item -Force -ItemType directory -Path "C:\inetpub\wwwroot\video"
            $imagevalue = "Images: " + $($env:computername)
            Add-Content -Path "C:\inetpub\wwwroot\images\test.htm" -Value $imagevalue
            $videovalue = "Video: " + $($env:computername)
            Add-Content -Path "C:\inetpub\wwwroot\video\test.htm" -Value $videovalue

Last updated

Was this helpful?