2021-07-16 10:52:37 +01:00
|
|
|
# az vm
|
|
|
|
|
|
|
|
> Manage virtual machines in Azure.
|
2022-10-26 03:27:29 +01:00
|
|
|
> Part of `azure-cli`.
|
2022-10-04 16:06:23 +01:00
|
|
|
> More information: <https://learn.microsoft.com/cli/azure/vm>.
|
2021-07-16 10:52:37 +01:00
|
|
|
|
2021-09-16 04:32:13 +01:00
|
|
|
- List details of available Virtual Machines:
|
2021-07-16 10:52:37 +01:00
|
|
|
|
|
|
|
`az vm list`
|
|
|
|
|
2022-10-26 03:27:29 +01:00
|
|
|
- Create a virtual machine using the default Ubuntu image and generate ssh keys:
|
2021-07-16 10:52:37 +01:00
|
|
|
|
2022-10-26 03:27:29 +01:00
|
|
|
`az vm create --resource-group {{rg}} --name {{vm_name}} --image {{UbuntuLTS}} --admin-user {{azureuser}} --generate-ssh-keys`
|
2021-07-16 10:52:37 +01:00
|
|
|
|
|
|
|
- Stop a Virtual Machine:
|
|
|
|
|
|
|
|
`az vm stop --resource-group {{rg}} --name {{vm_name}}`
|
|
|
|
|
|
|
|
- Deallocate a Virtual Machine:
|
|
|
|
|
|
|
|
`az vm deallocate --resource-group {{rg}} --name {{vm_name}}`
|
|
|
|
|
|
|
|
- Start a Virtual Machine:
|
|
|
|
|
|
|
|
`az vm start --resource-group {{rg}} --name {{vm_name}}`
|
|
|
|
|
|
|
|
- Restart a Virtual Machine:
|
|
|
|
|
|
|
|
`az vm restart --resource-group {{rg}} --name {{vm_name}}`
|
|
|
|
|
2021-09-16 04:32:13 +01:00
|
|
|
- List VM images available in the Azure Marketplace:
|
2021-07-16 10:52:37 +01:00
|
|
|
|
|
|
|
`az vm image list`
|