Forrest logo
back to the az tool

az-vm:tldr:3dfe0

az-vm: Create a virtual machine using the default Ubuntu image and generate ssh keys.
$ az vm create --resource-group ${rg} --name ${vm_name} --image ${UbuntuLTS} --admin-user ${azureuser} --generate-ssh-keys
try on your machine

This command is used to create a virtual machine (VM) in Azure using the Azure CLI (Command-Line Interface).

Here is a breakdown of the command and its options:

  • az vm create: This is the base command for creating a virtual machine.

  • --resource-group ${rg}: This specifies the resource group in which the VM should be created. The ${rg} variable should be replaced with the actual name of the resource group.

  • --name ${vm_name}: This specifies the name of the virtual machine. The ${vm_name} variable should be replaced with the desired name of the VM.

  • --image ${UbuntuLTS}: This specifies the image or operating system to be used for the VM. The ${UbuntuLTS} variable should be replaced with the name of the desired image, in this case, it represents Ubuntu LTS (Long Term Support).

  • --admin-user ${azureuser}: This specifies the username for the admin account that will be created on the VM. The ${azureuser} variable should be replaced with the desired username.

  • --generate-ssh-keys: This option generates SSH keys for the VM. SSH keys provide a secure way to log in to the VM. If this option is not used, password-based authentication will be used instead.

Overall, this command creates a virtual machine in Azure, specifies a resource group, VM name, uses Ubuntu LTS as the image, provides an admin username, and generates SSH keys for secure login.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the az tool