You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-machines/maintenance-configurations-cli.md
+43-42Lines changed: 43 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Maintenance Configurations for Azure virtual machines using CLI
3
-
description: Learn how to control when maintenance is applied to your Azure VMs using Maintenance configurations and CLI.
2
+
title: Maintenance Configurations for Azure virtual machines using the Azure CLI
3
+
description: Learn how to control when maintenance is applied to your Azure VMs by using Maintenance Configurations and the Azure CLI.
4
4
author: ju-shim
5
5
ms.service: virtual-machines
6
6
ms.subservice: maintenance
@@ -15,26 +15,26 @@ ms.author: jushiman
15
15
16
16
**Applies to:**:heavy_check_mark: Linux VMs :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets :heavy_check_mark: Uniform scale sets
17
17
18
-
Maintenance Configurations lets you decide when to apply platform updates to various Azure resources. This topic covers the Azure CLI options for using this service. For more about benefits of using Maintenance Configurations, its limitations, and other management options, see [Managing platform updates with Maintenance Configurations](maintenance-configurations.md).
18
+
You can use the Maintenance Configurations feature to control when to apply platform updates to various Azure resources. This article covers the Azure CLI options for using this feature. For more information about the benefits of using Maintenance Configurations, its limitations, and other management options, see [Managing platform updates with Maintenance Configurations](maintenance-configurations.md).
19
19
20
20
> [!IMPORTANT]
21
-
> There are different **scopes** which support certain machine types and schedules, so please ensure you are selecting the right scope for your virtual machine.
21
+
> Specific *scopes*support certain machine types and schedules. Be sure to select the right scope for your virtual machine (VM).
22
22
23
23
## Create a maintenance configuration
24
24
25
-
The first step to creating a maintenance configuration is creating a resource group as a container for your configuration. In this example, a resource group named *myMaintenanceRG* is created in *eastus*. If you already have a resource group that you want to use, you can skip this part and replace the resource group name with your own in the rest of the examples.
25
+
The first step in creating a maintenance configuration is creating a resource group as a container for your configuration. This example creates a resource group named *myMaintenanceRG* in *eastus*. If you already have a resource group that you want to use, you can skip this part and replace the resource group name with your own in the rest of the examples.
26
26
27
27
```azurecli-interactive
28
28
az group create \
29
29
--location eastus \
30
30
--name myMaintenanceRG
31
31
```
32
32
33
-
After creating the resource group, use `az maintenance configuration create` to create a maintenance configuration.
33
+
After you create the resource group, use `az maintenance configuration create` to create a maintenance configuration.
34
34
35
35
### Host
36
36
37
-
This example creates a maintenance configuration named *myConfig* scoped to host machines with a scheduled window of 5 hours on the fourth Monday of every month.
37
+
This example creates a maintenance configuration named *myConfig* scoped to host machines, with a scheduled window of 5 hours on the fourth Monday of every month:
38
38
39
39
```azurecli-interactive
40
40
az maintenance configuration create \
@@ -47,26 +47,26 @@ az maintenance configuration create \
--maintenance-window-time-zone "Pacific Standard Time"
49
49
```
50
-
51
-
Using `--maintenance-scope host` ensures that the maintenance configuration is used for controlling updates to the host infrastructure. If you try to create a configuration with the same name, but in a different location, you will get an error. Configuration names must be unique to your resource group.
52
50
53
-
You can check if you have created the maintenance configuration successfully by querying for available maintenance configurations using `az maintenance configuration list`.
51
+
Using `--maintenance-scope host` ensures that the maintenance configuration is used for controlling updates to the host infrastructure. If you try to create a configuration with the same name but in a different location, you'll get an error. Configuration names must be unique to your resource group.
52
+
53
+
To check if you successfully created the maintenance configuration, you can query for available maintenance configurations by using `az maintenance configuration list`:
54
54
55
55
```azurecli-interactive
56
56
az maintenance configuration list
57
57
--query "[].{Name:name, ID:id}"
58
58
--output table
59
59
```
60
60
61
-
> [!NOTE]
62
-
> Maintenance recurrence can be expressed as daily, weekly or monthly. Some examples are:
> -**monthly**- maintenance-window-recur-every: "Month day23,day24"**or**"Month Last Sunday"**or** "Month Fourth Monday"
61
+
You can express maintenance recurrence as daily, weekly, or monthly. Here are some examples:
62
+
63
+
-**Daily**: A `maintenance-window-recur-every` value of `"Day"` or `"3Days"`.
64
+
-**Weekly**: A `maintenance-window-recur-every` value of `"3Weeks"` or `"Week Saturday,Sunday"`.
65
+
-**Monthly**: A `maintenance-window-recur-every` value of `"Month day23,day24"` or `"Month Last Sunday"` or `Month Fourth Monday`.
66
66
67
-
### Virtual Machine Scale Sets
67
+
### Virtual machine scale sets
68
68
69
-
This example creates a maintenance configuration named *myConfig* with the osimage scope for virtual machine scale sets with a scheduled window of 5 hours on the fourth Monday of every month.
69
+
This example creates a maintenance configuration named *myConfig* with the OS image scope for virtual machine scale sets, with a scheduled window of 5 hours on the fourth Monday of every month:
70
70
71
71
```azurecli-interactive
72
72
az maintenance configuration create \
@@ -82,7 +82,7 @@ az maintenance configuration create \
82
82
83
83
### Guest VMs
84
84
85
-
This example creates a maintenance configuration named *myConfig* scoped to guest machines (VMs and Arc enabled servers) with a scheduled window of 2 hours every 20 days. To learn more about this maintenance configurations on guest VMs see [Guest](maintenance-configurations.md#guest).
85
+
This example creates a maintenance configuration named *myConfig* scoped to guest machines (VMs and Azure Arc-enabled servers), with a scheduled window of 2 hours every 20 days. [Learn more about maintenance configurations on guest VMs](maintenance-configurations.md#guest).
86
86
87
87
```azurecli-interactive
88
88
az maintenance configuration create \
@@ -106,7 +106,7 @@ Use `az maintenance assignment create` to assign the configuration to your machi
106
106
107
107
### Isolated VM
108
108
109
-
Apply the configuration to an isolated host VM using the ID of the configuration. Specify `--resource-type virtualMachines` and supply the name of the VM for `--resource-name`, and the resource group for to the VM in `--resource-group`, and the location of the VM for `--location`.
109
+
Apply the configuration to an isolated host VM by using the ID of the configuration. Specify `--resource-type virtualMachines`. Supply the name of the VM for `--resource-name`, the VM's resource group for `--resource-group`, and the location of the VM for `--location`.
110
110
111
111
```azurecli-interactive
112
112
az maintenance assignment create \
@@ -121,7 +121,7 @@ az maintenance assignment create \
121
121
122
122
### Dedicated host
123
123
124
-
To apply a configuration to a dedicated host, you need to include `--resource-type hosts`, `--resource-parent-name` with the name of the host group, and `--resource-parent-type hostGroups`.
124
+
To apply a configuration to a dedicated host, you need to include `--resource-type hosts`, `--resource-parent-name` with the name of the host group, and `--resource-parent-type hostGroups`.
125
125
126
126
The parameter `--resource-id` is the ID of the host. You can use [az-vm-host-get-instance-view](/cli/azure/vm/host#az-vm-host-get-instance-view) to get the ID of your dedicated host.
127
127
@@ -138,7 +138,7 @@ az maintenance assignment create \
138
138
--resource-parent-type hostGroups
139
139
```
140
140
141
-
### Virtual Machine Scale Sets
141
+
### Virtual machine scale sets
142
142
143
143
```azurecli-interactive
144
144
az maintenance assignment create \
@@ -164,9 +164,9 @@ az maintenance assignment create \
You can verify that the configuration was applied correctly, or check to see what configuration is currently applied using `az maintenance assignment list`.
169
+
You can verify that the configuration was applied correctly, or check to see what configuration is currently applied, by using `az maintenance assignment list`.
170
170
171
171
### Isolated VM
172
172
@@ -194,7 +194,7 @@ az maintenance assignment list \
194
194
--output table
195
195
```
196
196
197
-
### Virtual Machine Scale Sets
197
+
### Virtual machine scale sets
198
198
199
199
```azurecli-interactive
200
200
az maintenance assignment list \
@@ -220,11 +220,11 @@ az maintenance assignment list \
220
220
221
221
## Check for pending updates
222
222
223
-
Use `az maintenance update list` to see if there are pending updates. Update --subscription to be the ID for the subscription that contains the VM.
223
+
Use `az maintenance update list` to see if there are pending updates. Update `--subscription` to be the ID for the subscription that contains the VM.
224
224
225
-
If there are no updates, the command will return an error message, which will contain the text:`Resource not found...StatusCode: 404`.
225
+
If there are no updates, the command returns an error message that contains the text `Resource not found...StatusCode: 404`.
226
226
227
-
If there are updates, only one will be returned, even if there are multiple updates pending. The data for this update will be returned in an object:
227
+
If there are updates, the command returns only one, even if multiple updates are pending. The data for this update is returned in an object:
228
228
229
229
```text
230
230
[
@@ -241,7 +241,7 @@ If there are updates, only one will be returned, even if there are multiple upda
241
241
242
242
### Isolated VM
243
243
244
-
Check for pending updates for an isolated VM. In this example, the output is formatted as a table for readability.
244
+
Check for pending updates for an isolated VM. In this example, the output is formatted as a table for readability:
245
245
246
246
```azurecli-interactive
247
247
az maintenance update list \
@@ -255,7 +255,7 @@ az maintenance update list \
255
255
256
256
### Dedicated host
257
257
258
-
To check for pending updates for a dedicated host. In this example, the output is formatted as a table for readability. Replace the values for the resources with your own.
258
+
Check for pending updates for a dedicated host. In this example, the output is formatted as a table for readability. Replace the values for the resources with your own.
259
259
260
260
```azurecli-interactive
261
261
az maintenance update list \
@@ -271,11 +271,11 @@ az maintenance update list \
271
271
272
272
## Apply updates
273
273
274
-
Use `az maintenance apply update` to apply pending updates. On success, this command will return JSON containing the details of the update. Apply update calls can take up to 2 hours to complete.
274
+
Use `az maintenance apply update` to apply pending updates. On success, this command returns JSON that contains the details of the update. Calls to apply updates can take up to 2 hours to complete.
275
275
276
276
### Isolated VM
277
277
278
-
Create a request to apply updates to an isolated VM.
278
+
Create a request to apply updates to an isolated VM:
279
279
280
280
```azurecli-interactive
281
281
az maintenance applyupdate create \
@@ -286,10 +286,9 @@ az maintenance applyupdate create \
286
286
--provider-name Microsoft.Compute
287
287
```
288
288
289
-
290
289
### Dedicated host
291
290
292
-
Apply updates to a dedicated host.
291
+
Apply updates to a dedicated host:
293
292
294
293
```azurecli-interactive
295
294
az maintenance applyupdate create \
@@ -302,9 +301,9 @@ az maintenance applyupdate create \
302
301
--resource-parent-type hostGroups
303
302
```
304
303
305
-
### Virtual Machine Scale Sets
304
+
### Virtual machine scale sets
306
305
307
-
Apply update to a scale set
306
+
Apply updates to a scale set:
308
307
309
308
```azurecli-interactive
310
309
az maintenance applyupdate create \
@@ -315,11 +314,11 @@ az maintenance applyupdate create \
315
314
--provider-name Microsoft.Compute
316
315
```
317
316
318
-
## Check the status of applying updates
317
+
## Check the status of applying updates
319
318
320
-
You can check on the progress of the updates using `az maintenance applyupdate get`.
319
+
You can check on the progress of the updates by using `az maintenance applyupdate get`.
321
320
322
-
You can use `default` as the update name to see results for the last update, or replace `myUpdateName` with the name of the update that was returned when you ran `az maintenance applyupdate create`.
321
+
To see results for the last update, use `default` as the update name. Or replace `myUpdateName` with the name of the update that was returned when you ran `az maintenance applyupdate create`.
LastUpdateTime will be the time when the update got complete, either initiated by you or by the platform in case self-maintenance window was not used. If there has never been an update applied through maintenance control it will show default value.
333
+
334
+
`LastUpdateTime` is the time when the update finished, whether you initiated the update or the platform initiated it because you didn't use the self-maintenance window. If an update was never applied through Maintenance Configurations, `LastUpdateTime` shows the default value.
335
335
336
336
### Isolated VM
337
337
@@ -363,7 +363,7 @@ az maintenance applyupdate get \
363
363
--output table
364
364
```
365
365
366
-
### Virtual Machine Scale Sets
366
+
### Virtual machine scale sets
367
367
368
368
```azurecli-interactive
369
369
az maintenance applyupdate get \
@@ -379,7 +379,7 @@ az maintenance applyupdate get \
379
379
380
380
## Delete a maintenance configuration
381
381
382
-
Use `az maintenance configuration delete` to delete a maintenance configuration. Deleting the configuration removes the maintenance control from the associated resources.
382
+
To delete a maintenance configuration, use `az maintenance configuration delete`. Deleting the configuration removes the maintenance control from the associated resources.
383
383
384
384
```azurecli-interactive
385
385
az maintenance configuration delete \
@@ -389,4 +389,5 @@ az maintenance configuration delete \
389
389
```
390
390
391
391
## Next steps
392
-
To learn more, see [Maintenance and updates](maintenance-and-updates.md).
392
+
393
+
To learn more, see [Maintenance for virtual machines in Azure](maintenance-and-updates.md).
0 commit comments