Skip to content

Commit cc8c91a

Browse files
Merge pull request #231271 from cynthn/docs-editor/tutorial-manage-vm-1679098592
Update tutorial-manage-vm.md
2 parents 157ab01 + c54e18c commit cc8c91a

File tree

1 file changed

+66
-55
lines changed

1 file changed

+66
-55
lines changed

articles/virtual-machines/linux/tutorial-manage-vm.md

Lines changed: 66 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: cynthn
55
ms.service: virtual-machines
66
ms.collection: linux
77
ms.topic: tutorial
8-
ms.date: 03/23/2018
8+
ms.date: 03/23/2023
99
ms.author: cynthn
1010
ms.custom: mvc, devx-track-azurecli
1111

@@ -25,18 +25,19 @@ Azure virtual machines provide a fully configurable and flexible computing envir
2525
> * Resize a VM
2626
> * View and understand VM state
2727
28-
This tutorial uses the CLI within the [Azure Cloud Shell](../../cloud-shell/overview.md), which is constantly updated to the latest version. To open the Cloud Shell, select **Try it** from the top of any code block.
28+
This tutorial uses the CLI within the [Azure Cloud Shell](../../cloud-shell/overview.md), which is constantly updated to the latest version.
2929

3030
If you choose to install and use the CLI locally, this tutorial requires that you are running the Azure CLI version 2.0.30 or later. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI]( /cli/azure/install-azure-cli).
3131

3232
## Create resource group
3333

3434
Create a resource group with the [az group create](/cli/azure/group) command.
3535

36-
An Azure resource group is a logical container into which Azure resources are deployed and managed. A resource group must be created before a virtual machine. In this example, a resource group named *myResourceGroupVM* is created in the *eastus* region.
36+
An Azure resource group is a logical container into which Azure resources are deployed and managed. A resource group must be created before a virtual machine. In this example, a resource group named *myResourceGroupVM* is created in the *eastus2* region.
37+
3738

3839
```azurecli-interactive
39-
az group create --name myResourceGroupVM --location eastus
40+
az group create --name myResourceGroupVM --location eastus2
4041
```
4142

4243
The resource group is specified when creating or modifying a VM, which can be seen throughout this tutorial.
@@ -45,24 +46,25 @@ The resource group is specified when creating or modifying a VM, which can be se
4546

4647
Create a virtual machine with the [az vm create](/cli/azure/vm) command.
4748

48-
When you create a virtual machine, several options are available such as operating system image, disk sizing, and administrative credentials. The following example creates a VM named *myVM* that runs Ubuntu Server. A user account named *azureuser* is created on the VM, and SSH keys are generated if they do not exist in the default key location (*~/.ssh*):
49+
When you create a virtual machine, several options are available such as operating system image, disk sizing, and administrative credentials. The following example creates a VM named *myVM* that runs SUSE Linux Enterprise Server (SLES). A user account named *azureuser* is created on the VM, and SSH keys are generated if they do not exist in the default key location (*~/.ssh*):
4950

5051
```azurecli-interactive
5152
az vm create \
5253
--resource-group myResourceGroupVM \
5354
--name myVM \
54-
--image UbuntuLTS \
55+
--image SLES \
56+
--public-ip-sku Standard \
5557
--admin-username azureuser \
5658
--generate-ssh-keys
5759
```
5860

59-
It may take a few minutes to create the VM. Once the VM has been created, the Azure CLI outputs information about the VM. Take note of the `publicIpAddress`, this address can be used to access the virtual machine..
61+
It may take a few minutes to create the VM. Once the VM has been created, the Azure CLI outputs information about the VM. Take note of the `publicIpAddress`, this address can be used to access the virtual machine.
6062

6163
```output
6264
{
6365
"fqdns": "",
6466
"id": "/subscriptions/d5b9d4b7-6fc1-0000-0000-000000000000/resourceGroups/myResourceGroupVM/providers/Microsoft.Compute/virtualMachines/myVM",
65-
"location": "eastus",
67+
"location": "eastus2",
6668
"macAddress": "00-0D-3A-23-9A-49",
6769
"powerState": "VM running",
6870
"privateIpAddress": "10.0.0.4",
@@ -116,33 +118,41 @@ x64 WindowsServer MicrosoftWindowsServer 2012-Datac
116118
x64 WindowsServer MicrosoftWindowsServer 2008-R2-SP1 MicrosoftWindowsServer:WindowsServer:2008-R2-SP1:latest Win2008R2SP1 latest
117119
```
118120

119-
A full list can be seen by adding the `--all` parameter. The image list can also be filtered by `--publisher` or `–-offer`. In this example, the list is filtered for all images with an offer that matches *CentOS*.
121+
A full list can be seen by adding the `--all` parameter. The image list can also be filtered by `--publisher` or `–-offer`. In this example, the list is filtered for all images, published by OpenLogic, with an offer that matches *CentOS*.
120122

121123
```azurecli-interactive
122-
az vm image list --offer CentOS --all --output table
124+
az vm image list --offer CentOS --publisher OpenLogic --all --output table
123125
```
124126

125-
Partial output:
127+
Example partial output:
126128

127129
```output
128-
Offer Publisher Sku Urn Version
129-
---------------- ---------------- ---- -------------------------------------- -----------
130-
CentOS OpenLogic 6.5 OpenLogic:CentOS:6.5:6.5.201501 6.5.201501
131-
CentOS OpenLogic 6.5 OpenLogic:CentOS:6.5:6.5.201503 6.5.201503
132-
CentOS OpenLogic 6.5 OpenLogic:CentOS:6.5:6.5.201506 6.5.201506
133-
CentOS OpenLogic 6.5 OpenLogic:CentOS:6.5:6.5.20150904 6.5.20150904
134-
CentOS OpenLogic 6.5 OpenLogic:CentOS:6.5:6.5.20160309 6.5.20160309
135-
CentOS OpenLogic 6.5 OpenLogic:CentOS:6.5:6.5.20170207 6.5.20170207
130+
Architecture Offer Publisher Sku Urn Version
131+
-------------- ------------------------- ----------- --------------- -------------------------------------------------------- ---------------
132+
x64 CentOS OpenLogic 8_2 OpenLogic:CentOS:8_2:8.2.2020111800 8.2.2020111800
133+
x64 CentOS OpenLogic 8_2-gen2 OpenLogic:CentOS:8_2-gen2:8.2.2020062401 8.2.2020062401
134+
x64 CentOS OpenLogic 8_2-gen2 OpenLogic:CentOS:8_2-gen2:8.2.2020100601 8.2.2020100601
135+
x64 CentOS OpenLogic 8_2-gen2 OpenLogic:CentOS:8_2-gen2:8.2.2020111801 8.2.2020111801
136+
x64 CentOS OpenLogic 8_3 OpenLogic:CentOS:8_3:8.3.2020120900 8.3.2020120900
137+
x64 CentOS OpenLogic 8_3 OpenLogic:CentOS:8_3:8.3.2021020400 8.3.2021020400
138+
x64 CentOS OpenLogic 8_3-gen2 OpenLogic:CentOS:8_3-gen2:8.3.2020120901 8.3.2020120901
139+
x64 CentOS OpenLogic 8_3-gen2 OpenLogic:CentOS:8_3-gen2:8.3.2021020401 8.3.2021020401
140+
x64 CentOS OpenLogic 8_4 OpenLogic:CentOS:8_4:8.4.2021071900 8.4.2021071900
141+
x64 CentOS OpenLogic 8_4-gen2 OpenLogic:CentOS:8_4-gen2:8.4.2021071901 8.4.2021071901
142+
x64 CentOS OpenLogic 8_5 OpenLogic:CentOS:8_5:8.5.2022012100 8.5.2022012100
143+
x64 CentOS OpenLogic 8_5 OpenLogic:CentOS:8_5:8.5.2022101800 8.5.2022101800
144+
x64 CentOS OpenLogic 8_5-gen2 OpenLogic:CentOS:8_5-gen2:8.5.2022012101 8.5.2022012101
136145
```
137146

138147

148+
139149
> [!NOTE]
140150
> Canonical has changed the **Offer** names they use for the most recent versions. Before Ubuntu 20.04, the **Offer** name is UbuntuServer. For Ubuntu 20.04 the **Offer** name is `0001-com-ubuntu-server-focal` and for Ubuntu 22.04 it's `0001-com-ubuntu-server-jammy`.
141151
142-
To deploy a VM using a specific image, take note of the value in the *Urn* column, which consists of the publisher, offer, SKU, and optionally a version number to [identify](cli-ps-findimage.md#terminology) the image. When specifying the image, the image version number can be replaced with `latest`, which selects the latest version of the distribution. In this example, the `--image` parameter is used to specify the latest version of a CentOS 6.5 image.
152+
To deploy a VM using a specific image, take note of the value in the *Urn* column, which consists of the publisher, offer, SKU, and optionally a version number to [identify](cli-ps-findimage.md#terminology) the image. When specifying the image, the image version number can be replaced with `latest`, which selects the latest version of the distribution. In this example, the `--image` parameter is used to specify the latest version of a CentOS 8.5.
143153

144154
```azurecli-interactive
145-
az vm create --resource-group myResourceGroupVM --name myVM2 --image OpenLogic:CentOS:6.5:latest --generate-ssh-keys
155+
az vm create --resource-group myResourceGroupVM --name myVM2 --image OpenLogic:CentOS:8_5:latest --generate-ssh-keys
146156
```
147157

148158
## Understand VM sizes
@@ -153,45 +163,45 @@ A virtual machine size determines the amount of compute resources such as CPU, G
153163

154164
The following table categorizes sizes into use cases.
155165

156-
| Type | Common sizes | Description |
157-
|--------------------------|-------------------|------------------------------------------------------------------------------------------------------------------------------------|
158-
| [General purpose](../sizes-general.md) |B, Dsv3, Dv3, DSv2, Dv2, Av2, DC| Balanced CPU-to-memory. Ideal for dev / test and small to medium applications and data solutions. |
159-
| [Compute optimized](../sizes-compute.md) | Fsv2 | High CPU-to-memory. Good for medium traffic applications, network appliances, and batch processes. |
160-
| [Memory optimized](../sizes-memory.md) | Esv3, Ev3, M, DSv2, Dv2 | High memory-to-core. Great for relational databases, medium to large caches, and in-memory analytics. |
161-
| [Storage optimized](../sizes-storage.md) | Lsv2, Ls | High disk throughput and IO. Ideal for Big Data, SQL, and NoSQL databases. |
162-
| [GPU](../sizes-gpu.md) | NV, NVv2, NC, NCv2, NCv3, ND | Specialized VMs targeted for heavy graphic rendering and video editing. |
163-
| [High performance](../sizes-hpc.md) | H | Our most powerful CPU VMs with optional high-throughput network interfaces (RDMA). |
166+
| Type | Description |
167+
|--------------------------|------------------------------------------------------------------------------------------------------------------------------------|
168+
| [General purpose](../sizes-general.md) | Balanced CPU-to-memory. Ideal for dev / test and small to medium applications and data solutions. |
169+
| [Compute optimized](../sizes-compute.md) | High CPU-to-memory. Good for medium traffic applications, network appliances, and batch processes. |
170+
| [Memory optimized](../sizes-memory.md) | High memory-to-core. Great for relational databases, medium to large caches, and in-memory analytics. |
171+
| [Storage optimized](../sizes-storage.md) | High disk throughput and IO. Ideal for Big Data, SQL, and NoSQL databases. |
172+
| [GPU](../sizes-gpu.md) | Specialized VMs targeted for heavy graphic rendering and video editing. |
173+
| [High performance](../sizes-hpc.md) | Our most powerful CPU VMs with optional high-throughput network interfaces (RDMA). |
174+
164175

165176

166177
### Find available VM sizes
167178

168179
To see a list of VM sizes available in a particular region, use the [az vm list-sizes](/cli/azure/vm) command.
169180

170181
```azurecli-interactive
171-
az vm list-sizes --location eastus --output table
182+
az vm list-sizes --location eastus2 --output table
172183
```
173184

174-
Partial output:
185+
Example partial output:
175186

176187
```output
177188
MaxDataDiskCount MemoryInMb Name NumberOfCores OsDiskSizeInMb ResourceDiskSizeInMb
178189
------------------ ------------ ---------------------- --------------- ---------------- ----------------------
179-
2 3584 Standard_DS1 1 1047552 7168
180-
4 7168 Standard_DS2 2 1047552 14336
181-
8 14336 Standard_DS3 4 1047552 28672
182-
16 28672 Standard_DS4 8 1047552 57344
183-
4 14336 Standard_DS11 2 1047552 28672
184-
8 28672 Standard_DS12 4 1047552 57344
185-
16 57344 Standard_DS13 8 1047552 114688
186-
32 114688 Standard_DS14 16 1047552 229376
187-
1 768 Standard_A0 1 1047552 20480
188-
2 1792 Standard_A1 1 1047552 71680
189-
4 3584 Standard_A2 2 1047552 138240
190-
8 7168 Standard_A3 4 1047552 291840
191-
4 14336 Standard_A5 2 1047552 138240
192-
16 14336 Standard_A4 8 1047552 619520
193-
8 28672 Standard_A6 4 1047552 291840
194-
16 57344 Standard_A7 8 1047552 619520
190+
4 8192 Standard_D2ds_v4 2 1047552 76800
191+
8 16384 Standard_D4ds_v4 4 1047552 153600
192+
16 32768 Standard_D8ds_v4 8 1047552 307200
193+
32 65536 Standard_D16ds_v4 16 1047552 614400
194+
32 131072 Standard_D32ds_v4 32 1047552 1228800
195+
32 196608 Standard_D48ds_v4 48 1047552 1843200
196+
32 262144 Standard_D64ds_v4 64 1047552 2457600
197+
4 8192 Standard_D2ds_v5 2 1047552 76800
198+
8 16384 Standard_D4ds_v5 4 1047552 153600
199+
16 32768 Standard_D8ds_v5 8 1047552 307200
200+
32 65536 Standard_D16ds_v5 16 1047552 614400
201+
32 131072 Standard_D32ds_v5 32 1047552 1228800
202+
32 196608 Standard_D48ds_v5 48 1047552 1843200
203+
32 262144 Standard_D64ds_v5 64 1047552 2457600
204+
32 393216 Standard_D96ds_v5 96 1047552 3686400
195205
```
196206

197207
### Create VM with specific size
@@ -202,8 +212,8 @@ In the previous VM creation example, a size was not provided, which results in a
202212
az vm create \
203213
--resource-group myResourceGroupVM \
204214
--name myVM3 \
205-
--image UbuntuLTS \
206-
--size Standard_F4s \
215+
--image SLES \
216+
--size Standard_D2ds_v4 \
207217
--generate-ssh-keys
208218
```
209219

@@ -224,7 +234,7 @@ az vm list-vm-resize-options --resource-group myResourceGroupVM --name myVM --qu
224234
If the desired size is available, the VM can be resized from a powered-on state, however it is rebooted during the operation. Use the [az vm resize]( /cli/azure/vm) command to perform the resize.
225235

226236
```azurecli-interactive
227-
az vm resize --resource-group myResourceGroupVM --name myVM --size Standard_DS4_v2
237+
az vm resize --resource-group myResourceGroupVM --name myVM --size Standard_D4s_v3
228238
```
229239

230240
If the desired size is not on the current cluster, the VM needs to be deallocated before the resize operation can occur. Use the [az vm deallocate]( /cli/azure/vm) command to stop and deallocate the VM. Note, when the VM is powered back on, any data on the temp disk may be removed. The public IP address also changes unless a static IP address is being used.
@@ -275,9 +285,9 @@ az vm get-instance-view \
275285
Output:
276286

277287
```output
278-
ode DisplayStatus Level
279-
------------------ --------------- -------
280-
PowerState/running VM running Info
288+
Code Level DisplayStatus
289+
------------------ ------- ---------------
290+
PowerState/running Info VM running
281291
```
282292

283293
To retrieve the power state of all the VMs in your subscription, use the [Virtual Machines - List All API](/rest/api/compute/virtualmachines/listall) with parameter **statusOnly** set to *true*.
@@ -308,9 +318,9 @@ az vm start --resource-group myResourceGroupVM --name myVM
308318

309319
### Deleting VM resources
310320

311-
You can delete a VM, but by default this only deletes the VM resource, not the disks and networking resources the VM uses. You can change the default behavior to delete other resources when you delete the VM. For more information, see [Delete a VM and attached resources](../delete.md).
321+
Depending on how you delete a VM, it may only delete the VM resource, not the networking and disk resources. You can change the default behavior to delete other resources when you delete the VM. For more information, see [Delete a VM and attached resources](../delete.md).
312322

313-
Deleting a resource group also deletes all resources contained within, such as the VM, virtual network, and disk. The `--no-wait` parameter returns control to the prompt without waiting for the operation to complete. The `--yes` parameter confirms that you wish to delete the resources without an additional prompt to do so.
323+
Deleting a resource group also deletes all resources in the resource group, like the VM, virtual network, and disk. The `--no-wait` parameter returns control to the prompt without waiting for the operation to complete. The `--yes` parameter confirms that you wish to delete the resources without an additional prompt to do so.
314324

315325
```azurecli-interactive
316326
az group delete --name myResourceGroupVM --no-wait --yes
@@ -331,3 +341,4 @@ Advance to the next tutorial to learn about VM disks.
331341

332342
> [!div class="nextstepaction"]
333343
> [Create and Manage VM disks](./tutorial-manage-disks.md)
344+

0 commit comments

Comments
 (0)