Exercise - Create a Windows virtual machine

Recall that our company processes video content on Windows VMs. A new city has contracted us to process their traffic cameras, but it's a model we've not worked with before. We need to create a new Windows VM and install some proprietary codecs so we can begin processing and analyzing their images.

Create a new Windows virtual machine

We can create Windows VMs with the Azure portal, Azure CLI, or Azure PowerShell. The easiest approach is the portal because it walks you through the required information and provides hints and helpful messages during the creation of the VM.

  1. Sign into the Azure portal using the same account you activated the sandbox with.

  2. On the Azure portal menu or from the Home page, select Create a resource.

  3. Select the See all link next to the Azure Marketplace heading. This option displays all available images on the Azure Marketplace.

    Select Microsoft as the filter value from the Publisher filter options. In the search box, enter Windows Server and then action the search by pressing enter or return.

    Screenshot showing the virtual machine image search options.

  4. The result will show several Windows Server related images. Select the Windows Server image.

    Screenshot showing the virtual machine image search result that highlights the Windows Server option.

  5. There are several Windows Server versions we can select from to create our VM. In the Windows Server image overview panel, from the Select a plan dropdown, select the [smalldisk] Windows Server 2019 Datacenter option.

  6. Select Create to start configuring the VM.

Configure the VM settings

The VM creation experience in the portal is presented in a "wizard" format to walk you through all the configuration areas for the VM. Clicking the "Next" button will take you to the next configurable section. However, you can move between the sections at will with the tabs running across the top that identify each section.

Screenshot showing the virtual machine creation experience in the Azure portal.

Once you fill in all the required options (identified with red stars), you can skip the remainder of the wizard experience and start creating the VM through the Review + Create button at the bottom.

We'll start with the Basics section.

Configure basic VM settings


As you change settings and tab out of each free-text field, Azure will validate each value automatically and place a green check mark next to it when it's good. You can hover over error indicators to get more information on issues it discovers.

  1. Select the Subscription that should be billed for VM hours.

  2. For Resource group, choose "[sandbox resource group name]".

  3. In the Instance Details section, enter a name for your VM, such as test-vp-vm2 (for Test Video Processor VM #2).

    • It's best practice to standardize your resource names so you can easily identify their purpose. Windows VM names are a bit limited - they must be between 1 and 15 characters, cannot contain non-ASCII or special characters, and must be unique in the current resource group.
  4. Select a region close to you from the locations below.

    The free sandbox allows you to create resources in a subset of the Azure global regions. Select a region from the following list when you create resources:

    • West US 2
    • South Central US
    • Central US
    • East US
    • West Europe
    • Southeast Asia
    • Japan East
    • Brazil South
    • Australia Southeast
    • Central India
  5. Leave Availability options as "No Infrastructure redundancy required". This option is used to ensure the VM is highly available by grouping multiple VMs together a set to deal with planned or unplanned maintenance events or outages.

  6. Ensure the image is set to "[smalldisk] Windows Server 2019 Datacenter - Gen1". You can open the dropdown to see all the options available.

  7. The Size field is not directly editable and has a DS1 default size. Click the Change size link to explore other VM sizes. The resulting dialog allows you to filter based on # of CPUs, Name, and Disk Type. Select "Standard DS1 v2" (normally the default) when you are done. That will give the VM 1 CPU and 3.5 GB of memory.


    You can also just slide the view to the left to get back to the VM settings as it opened a new window off to the right and slid the window over to view it.

  8. In the Administrator Account section, set the Username field to a username you will use to sign in to the VM.

  9. In the Password field, enter a password that's at least 12 characters long. It must have three of the following: one lower case character, one uppercase character, one number, and one special character that is not '\' or '-'. Use something you will remember or write it down, you will need it later.

  10. Confirm the password.

  11. In the Inbound port rules section, for Public inbound ports, select Allow selected ports. Since this is a Windows VM, we want to be able to access the desktop using RDP. For Select inbound ports, select RDP (3389) from the dropdown. As the note in the UI indicates, we can also adjust the network ports after we create the VM.

    Screenshot showing the drop-down for opening the port for RDP access on the Windows VM.

Configure Disks for the VM

  1. Click Next : Disks > to move to the Disks tab.

    Screenshot showing the configure disks section for the VM.

  2. Choose Premium SSD for the OS disk type.

  3. For encryption type, select the (Default) Encryption at-rest with a platform-managed key from the dropdown.

Create a data disk

Recall we will get an OS disk (C:) and Temporary disk (D:). Let's add a data disk as well.

  1. Click the Create and attach a new disk link in the Data disks section.

    Screenshot showing the new VM disk creation dialog in the portal.

  2. You can take all the defaults: Name; None (empty disk); 1024 GiB Premium SSD; (Default) Encryption at-rest with a platform-managed key; and No for Enable shared disk. Note that here is where we could use a snapshot, or Storage Blob to create a VHD.

  3. Click OK to create the disk and go back to the Data disks section.

  4. Under Data disks, there should now be a new disk in the first row.

    Screenshot showing the newly added disk in the VM.

Configure the network

  1. Click Next : Networking > to move to the Networking section.

  2. In a production system, where we already have other components, we'd want to utilize an existing virtual network. That way our VM can communicate with the other cloud services in our solution. If there isn't one defined in this location yet, we can create it here and configure the:

    • Address space: the overall IPV4 space available to this network.
    • Subnet range: the first subnet to subdivide the address space - it must fit within the defined address space. Once the VNet is created, you can add additional subnets.
  3. Let's change the default ranges to use the 172.xxx IP address space. Click Create new under Virtual network.

    In the Address space section:

    • Change the Address range field to be to give it the full range of addresses

    In the Subnets section:

    • Leave the Subnet name set as default.
    • Change the Address range field to be to give it 256 IP addresses of the space.
  4. Click OK.


By default, Azure will create a virtual network, network interface, and public IP for your VM. It's not trivial to change the networking options after the VM has been created so always double-check the network assignments on services you create in Azure.

Finish configuring the VM and create the image

The rest of the options have reasonable defaults and there's no need to change any of them. You can explore the other tabs if you like. The individual options have an (i) icon next to them that will show a help bubble to explain the option. This is a great way to learn about the various options you can use to configure the VM.

  1. Click the Review + create button at the bottom of the panel.

  2. The system will validate your options and give you details about the VM being created.

  3. Click Create to create and deploy the VM. The Azure dashboard will show the VM that's being deployed. This may take several minutes.

While that's deploying, let's look at what we can do with this VM.