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/update-manager/includes/pre-post-prerequisites.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
author: SnehaSudhir
3
3
ms.author: sudhirsneha
4
4
ms.topic: include
5
-
ms.date: 12/07/2023
5
+
ms.date: 09/24/2024
6
6
---
7
7
8
8
@@ -22,24 +22,24 @@ ms.date: 12/07/2023
22
22
Use PowerShell cmdlet [New-AzRoleAssignment](/powershell/module/az.resources/new-azroleassignment) to assign a role to the system-assigned managed identity.
23
23
24
24
```powershell
25
-
New-AzRoleAssignment `
26
-
-ObjectId $SA_PrincipalId `
27
-
-ResourceGroupName $resourceGroup `
28
-
-RoleDefinitionName "Contributor"
25
+
New-AzRoleAssignment `
26
+
-ObjectId $SA_PrincipalId `
27
+
-ResourceGroupName $resourceGroup `
28
+
-RoleDefinitionName "Contributor"
29
29
```
30
30
31
31
Assign a role to a user-assigned managed identity.
32
32
33
33
```powershell
34
-
New-AzRoleAssignment `
35
-
-ObjectId $UAMI.PrincipalId`
36
-
-ResourceGroupName $resourceGroup `
37
-
-RoleDefinitionName "Contributor"
34
+
New-AzRoleAssignment `
35
+
-ObjectId $UAMI.PrincipalId`
36
+
-ResourceGroupName $resourceGroup `
37
+
-RoleDefinitionName "Contributor"
38
38
```
39
39
For the system-assigned managed identity, show `ClientId` and record the value for later use.
40
40
41
41
```powershell
42
-
$UAMI.ClientId
42
+
$UAMI.ClientId
43
43
```
44
44
---
45
-
3. Import the `Az.ResourceGraph` module, ensure the module is updated to ThreadJob with the module version 2.0.3.
45
+
3. Import the `Az.ResourceGraph` module, ensure the module is updated to ThreadJob with the module version 2.0.3.
Copy file name to clipboardExpand all lines: articles/update-manager/tutorial-webhooks-using-runbooks.md
+22-23Lines changed: 22 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,18 +2,18 @@
2
2
title: Create pre and post events using a webhook with Automation runbooks.
3
3
description: In this tutorial, you learn how to create the pre and post events using webhook with Automation runbooks.
4
4
ms.service: azure-update-manager
5
-
ms.date: 09/04/2024
5
+
ms.date: 09/24/2024
6
6
ms.topic: tutorial
7
7
author: SnehaSudhirG
8
8
ms.author: sudhirsneha
9
-
#Customer intent: As an IT admin, I want create pre and post events using a webhook with Automation runbooks.
9
+
#Customer intent: As an IT admin, I want create pre and post events using a webhook with Automation runbooks.
10
10
---
11
11
12
12
# Tutorial: Create pre and post events using a webhook with Automation
13
13
14
14
**Applies to:**:heavy_check_mark: Windows VMs :heavy_check_mark: Linux VMs :heavy_check_mark: On-premises environment :heavy_check_mark: Azure VMs :heavy_check_mark: Azure Arc-enabled servers.
15
15
16
-
Pre and post events, also known as pre/post-scripts, allow you to execute user-defined actions before and after the schedule patch installation. One of the most common scenarios is to start and stop a VM. With pre-events, you can run a prepatching script to start the VM before initiating the schedule patching process. Once the schedule patching is complete, and the server is rebooted, a post-patching script can be executed to safely shut down the VM.
16
+
Pre and post events, also known as pre/post-scripts, allow you to execute user-defined actions before and after the schedule patch installation. One of the most common scenarios is to start and stop a Virtual Machine (VM). With pre-events, you can run a prepatching script to start the VM before initiating the schedule patching process. Once the schedule patching is complete, and the server is rebooted, a post-patching script can be executed to safely shut down the VM.
17
17
18
18
This tutorial explains how to create pre and post events to start and stop a VM in a schedule patch workflow using a webhook.
19
19
@@ -43,17 +43,15 @@ In this tutorial, you learn how to:
if ($eventType -ne “Microsoft.Maintenance.PostMaintenanceEvent”) {
235
-
Write-Output "Webhook not triggered as part of post-patching for maintenance run"
227
+
if ($eventType -ne "Microsoft.Maintenance.PostMaintenanceEvent") {
228
+
Write-Output "Webhook not triggered as part of post-patching for maintenance run"
236
229
return
237
230
}
238
231
@@ -247,17 +240,11 @@ if ($resourceSubscriptionIds.Count -eq 0) {
247
240
Start-Sleep -Seconds 30
248
241
Write-Output "Querying ARG to get machine details [MaintenanceRunId=$maintenanceRunId][ResourceSubscriptionIdsCount=$($resourceSubscriptionIds.Count)]"
249
242
$argQuery = @"
250
-
251
243
maintenanceresources
252
-
253
244
| where type =~ 'microsoft.maintenance/applyupdates'
254
-
255
245
| where properties.correlationId =~ '$($maintenanceRunId)'
256
-
257
246
| where id has '/providers/microsoft.compute/virtualmachines/'
0 commit comments