1 - Overview and Prerequisites

In this tutorial, you learn how to create a virtual network (VNet) and deploy a virtual machine (VM) to the VNet with the Azure CLI. This tutorial also covers Azure CLI specific concepts such as shell variables and output queries.

This tutorial can be completed with the interactive experience offered through Azure Cloud Shell, or you may install the CLI locally.

Use ctrl-shift-v (cmd-shift-v on macOS) to paste tutorial text into Azure Cloud Shell.


Shell variables

Shell variables store values for future use and can be used to pass values to command parameters. Shell variables allow for the reuse of commands, both on their own and in scripts. This tutorial uses shell variables for easier customization of command parameters. To use your own parameter values instead of using the provided values, change the values assigned to the shell variables. For more information about shell variables, see Use shell variables.

Create a resource group

In Azure, all resources are allocated in a resource management group. Resource groups provide logical groupings of resources that make them easier to work with as a collection. Use the az group create command to create a resource group named VMTutorialResources.

# create shell variables

az group create --name $resourceGroup --location $location