0
0
Azurecloud~5 mins

VM sizes and series (B, D, E, F) in Azure - Commands & Configuration

Choose your learning style9 modes available
Introduction
Choosing the right virtual machine size helps your app run smoothly without wasting money. Azure offers different VM series with varying power and cost to fit different needs.
When you want a low-cost VM that can handle occasional bursts of activity without paying for full power all the time.
When you need a balanced VM for general purpose tasks like web servers or small databases.
When your app requires more memory for faster data processing or caching.
When you need a VM optimized for compute-heavy tasks like batch processing or gaming servers.
Commands
This command lists all available VM sizes in the East US region so you can see options like B, D, E, and F series.
Terminal
az vm list-sizes --location eastus
Expected OutputExpected
[{"name":"Standard_B1s","numberOfCores":1,"memoryInMb":1024,"maxDataDiskCount":2,"osDiskSizeInMb":1047552,"resourceDiskSizeInMb":4096,"maxNicCount":2},{"name":"Standard_D2s_v3","numberOfCores":2,"memoryInMb":8192,"maxDataDiskCount":4,"osDiskSizeInMb":1047552,"resourceDiskSizeInMb":16384,"maxNicCount":2},{"name":"Standard_E2s_v3","numberOfCores":2,"memoryInMb":16384,"maxDataDiskCount":4,"osDiskSizeInMb":1047552,"resourceDiskSizeInMb":16384,"maxNicCount":2},{"name":"Standard_F2s_v2","numberOfCores":2,"memoryInMb":4096,"maxDataDiskCount":4,"osDiskSizeInMb":1047552,"resourceDiskSizeInMb":16384,"maxNicCount":2}]
--location - Specifies the Azure region to list VM sizes available there.
Creates a VM using the B1s size, which is a low-cost burstable VM good for light workloads with occasional spikes.
Terminal
az vm create --resource-group example-rg --name example-vm --image UbuntuLTS --size Standard_B1s --admin-username azureuser --generate-ssh-keys
Expected OutputExpected
{ "fqdns": "", "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/example-rg/providers/Microsoft.Compute/virtualMachines/example-vm", "location": "eastus", "name": "example-vm", "powerState": "VM running", "resourceGroup": "example-rg", "zones": [] }
--size - Specifies the VM size to use.
--generate-ssh-keys - Automatically creates SSH keys for secure login.
Checks the size of the VM to confirm it was created with the correct series and size.
Terminal
az vm show --resource-group example-rg --name example-vm --query hardwareProfile.vmSize
Expected OutputExpected
"Standard_B1s"
--query - Filters output to show only the VM size.
Key Concept

If you remember nothing else from this pattern, remember: choose the VM size series that matches your workload needs for cost and performance balance.

Common Mistakes
Choosing a VM size without checking if it is available in the desired region.
The VM size might not be offered in that region, causing deployment failure.
Always run 'az vm list-sizes --location your-region' to confirm availability before creating a VM.
Using a high-powered VM size for a light workload.
This wastes money because you pay for more resources than needed.
Pick a smaller or burstable VM size like B series for light or variable workloads.
Summary
Use 'az vm list-sizes' to see available VM sizes in your region.
Create VMs with the '--size' flag to pick the right series like B, D, E, or F.
Verify your VM size after creation to ensure it matches your needs.