Skip to content
AZ-900 Azure Fundamentals: Complete Exam Prep
Video· 25 min

Lab: create a virtual machine, then delete everything

Video chapters

  • 0:00 Introduction
  • 0:07 Resource group
  • 0:33 Virtual machine
  • 1:23 Verification
  • 1:39 Cleanup

A small web agency wants to test an application on a Linux server before showing it to a client. Buying a machine would take a week. In Azure, it has one in a few minutes, and it stops paying the moment it deletes it. The only risk is forgetting to delete it: a VM that runs for a month doing nothing shows up on the bill.

In this lab, you put a virtual machine in a resource group, look at everything Azure created around it, then delete the group to wipe it all out in a single operation.

Duration: about 25 minutes, including 5 minutes of waiting during deployment. Prerequisites: an Azure account. The free trial is enough.

The screenshots show the portal in English, and the labels below match them.
Cost and cleanup The VM size used here (Standard_D2s_v3) shows at around $70 per month in the portal estimate, or roughly ten cents per hour. On a trial account, it comes out of the free credit. The cost comes mostly from the time the VM runs: do the lab in one sitting and delete the resource group as soon as you finish (step 6). If the size is not available in your region, pick another size with 2 vCPUs.

Step 1: create the resource group

A resource group is a logical folder. Everything you put in it shares the same lifecycle: when you delete the folder, its contents go with it.

  1. In the portal search bar, type Resource groups and open the service.
  2. Click Create.
List of resource groups and the Create button
  1. Fill in the fields:
FieldValue
Subscriptionyour subscription
Resource group nameIntroAzureRG
RegionEast US, or the region closest to you
  1. Click Review + create, then Create.
Summary before creating the group

What you should see: a "Resource group created" notification, and IntroAzureRG in the list.

Group creation notification

Step 2: start the VM creation wizard

  1. In the search bar, type Virtual machines and open the service.
  2. Click Create, then Azure virtual machine.
Virtual machines service

Step 3: set the Basics tab

On the Basics tab, fill in:

FieldValue
Resource groupIntroAzureRG
Virtual machine namemy-VM
Regionthe same as the group
Availability optionsno infrastructure redundancy required
ImageUbuntu Server (the LTS version offered by default)
Run with Azure Spot discountunchecked
SizeStandard_D2s_v3
IntroAzureRG group selectedImage, Spot box unchecked, and size

A Spot VM costs far less, but Azure can take it back without warning when it needs the capacity. For a short test, that would be acceptable. Here we leave it unchecked to get a standard VM.

Further down, under Administrator account:

FieldValue
Authentication typePassword
Usernameazureuser
Passworda password of your own, at least 12 characters, that you do not reuse anywhere

Under Inbound port rules, choose None for public ports. Nobody will be able to reach the VM from the Internet, which is enough for this lab: you are not going to connect to it.

No inbound port open

Step 4: check the price, then create

  1. Leave the other tabs (Disks, Networking, Management, Monitoring) at their default values.
  2. Click Review + create.
  3. Wait for validation to pass, then read the Price block: it is the hourly rate for the size you chose.
Estimated hourly price before creation
  1. Click Create.

Deployment takes a few minutes. The portal shows a progress page, and there is nothing for you to do.

What you should see: the message "Your deployment is complete".

Deployment complete

Step 5: look at the contents of the group

  1. Open Resource groups, then IntroAzureRG.
  2. Look at the Resources tab of the overview.

What you should see: six resources, even though you only asked for a VM.

The six resources of the IntroAzureRG group
ResourceRole
Virtual machinecompute: processors and memory
Diskthe operating system disk
Network interfacethe VM's network card
Virtual networkthe private network the VM is plugged into
Network security groupthe firewall, here with no inbound rule open
Public IP addressthe address reachable from the Internet

The wizard created them for you. That is why a test VM goes in its own group: these side resources stay billable (the disk and the public IP above all), even with the VM stopped. Deleting the VM alone would leave them behind.

Step 6: delete the resource group

  1. In IntroAzureRG, click Delete resource group.
  2. Type the name IntroAzureRG in the confirmation field.
  3. Click Delete, then confirm.
Confirmation by typing the name

What you should see: a "Deleting resource group" notification. A few minutes later, the group is gone from the list, along with the six resources.

Deletion in progress

If the deletion fails, look for a lock on the group (you will see one in lab 08): it has to be removed first.

What to remember for the exam

  • A resource belongs to only one resource group at a time. It can move to another group, but it cannot be in two.
  • Deleting a group deletes everything it contains. It is the clean way to tear down a test environment.
  • A VM is an IaaS service: Azure manages the hardware, you manage the operating system, its updates, and whatever runs on it.
  • A VM stopped from the portal (deallocated) no longer bills for compute, but its disk and its public IP keep costing money.
  • The resource group has a region, which is only used to store its metadata. The resources it contains can be in other regions.

Questions and discussion

No messages yet. Have a question about this lesson? Ask it here.

Sign in to join the discussion. Sign in

We measure site traffic (GA4, Mixpanel). If you say yes, Microsoft Clarity also records how the public pages are used (clicks, scrolling) and we tune Meta ads. Nothing is stored on your device before you answer, and your choice sticks for 6 months.