Lesson 1 of 5 Azure Virtual Machines

Planning and Creating Virtual Machines

This lesson explains the decisions and settings involved in creating an Azure VM and configuring it after deployment.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify the resources that make up a VM.
  • Describe the main settings in each tab of the VM creation wizard.
  • Explain VM power states and their effect on billing.

Planning a VM

Before creating a VM, decide its region (close to users, with the required sizes available), availability options (zone, availability set or none, which cannot be changed later), image, size, disks and network, and the naming convention. A VM is not a single resource: it consists of the VM resource, an OS disk, at least one network interface and, optionally, a public IP address, an NSG and data disks, all deployed together by the portal.

The following diagram maps each requirement for a working-hours test VM to a creation setting.

Creation settings for a working-hours Windows Server test VM with existing licences. A burstable B-series size, Azure Hybrid Benefit for the Software Assurance licences, no public IP and no inbound ports with Azure Bastion for access, and evening auto-shutdown, which deallocates the VM.
The scenario is illustrative.
Select all that apply

What the portal deploys

Exam skills 3.2.1

Select every resource that the portal can create together when you create a VM.

Log in to try this activity Interactive activities are free with an account.

The creation tabs

The portal's Create a virtual machine wizard groups settings in tabs. Basics: subscription, resource group, name, region, availability options, security type (Trusted launch, the default, with Secure Boot and virtual TPM, or Standard, or Confidential), image, size, administrator account (password, or SSH public key for Linux), inbound port rules and licensing (Azure Hybrid Benefit for existing Windows Server licences). Disks: OS disk type, encryption options including encryption at host, and data disks. Networking: VNet, subnet, public IP, NIC network security group (None, Basic with selected ports, or Advanced with an existing NSG), and load balancing. Management: Microsoft Defender for Cloud, system-assigned managed identity, Microsoft Entra ID login, auto-shutdown, backup and patch orchestration. Monitoring: boot diagnostics and alerts. Advanced: extensions, custom data and cloud-init, proximity placement groups and capacity reservations.

Opening RDP (3389) or SSH (22) to the internet on a public IP is flagged as a risk by the portal; Azure Bastion or just-in-time VM access in Microsoft Defender for Cloud are safer. New VNets use private subnets by default, so a VM without a public IP needs a NAT gateway or other explicit outbound method to reach the internet.

Match the pairs

Which tab holds the setting?

Exam skills 3.2.1

Match each setting with the tab of the Create a virtual machine wizard where it lives.

Log in to try this activity Interactive activities are free with an account.

Configuring VMs after deployment

Custom data and cloud-init pass a script or configuration that runs at first boot (cloud-init on Linux). VM extensions add capabilities later: the Custom Script Extension downloads and runs scripts, and other extensions install the Azure Monitor Agent, Microsoft Defender components or the Network Watcher agent. Run command runs a script inside the VM from the portal without network access to it. Power states matter for cost: a VM shut down from inside the operating system is Stopped and still billed for compute, while one stopped from the portal or with az vm deallocate is Stopped (deallocated) and billed only for disks and reserved IPs.

Scenario questions

Configuring a running VM

Exam skills 3.2.1

Choose how to configure or reach a VM after it is deployed.

Log in to try this activity Interactive activities are free with an account.
Worked example

A cost-aware development VM

Developers need a Windows Server VM for testing that is used only during working hours. The company has Windows Server licences with Software Assurance. The VM must not be reachable from the internet, and costs must be minimized. Which settings should you choose when creating it?

Choose a burstable B-series size, enable Azure Hybrid Benefit to use the existing licences, select no public IP and no inbound ports (developers connect through Azure Bastion), and enable auto-shutdown in the evening, which deallocates the VM. Standard SSD is usually sufficient for the OS disk. Shutting down from inside Windows would leave the VM billed for compute.

Check yourself

A VM is shut down from inside Windows. Is it still billed for compute?

Show answer

Yes. Its status is Stopped, not Stopped (deallocated); compute billing stops only when it is deallocated.

Exam Tips

Remember for the exam

  • Billing for compute stops only when the VM is deallocated.
  • Availability zone or set must be chosen at creation.
  • Run first-boot configuration with custom data or cloud-init; later, with extensions or Run command.
  • Azure Hybrid Benefit reuses existing Windows Server licences.