Mattias Lindberg
Mattias Lindberg

Reputation: 2116

Replacement for Set-AzActionGroup to configure webhook alerts in Azure

We have a solution that use New-AzActionGroupReceiver and Set-AzActionGroup to configure webhook alerts for our application. But now when we run our Release pipeline in Azure DevOps we get an error because both of these Powershell commands have been removed (https://learn.microsoft.com/en-us/powershell/azure/release-notes-azureps?view=azps-11.4.0#azmonitor-500).

I think the we should use New-AzActionGroupWebhookReceiverObject as a replacement for New-AzActionGroupReceiver, it matches when we want to do.

But I'm not sure what the replacement for the Set-AzActionGroup command is. Any ideas?

The web site say "Use new and update cmdlets instead 'Set-AzActionGroup' cmdlet", but does not give a reference.

Existing code that I need to update:

$actionGroup = Get-AzActionGroup -ResourceGroupName $resourceGroupName -Name "$resourceGroupName-actiongroup"
$runbookReceiver = New-AzActionGroupReceiver -Name "InvokeRunbookWebhook" -UseCommonAlertSchema -WebhookReceiver -ServiceUri $runbookWebHook.WebhookURI
Set-AzActionGroup -ResourceGroupName $resourceGroupName -Name "$resourceGroupName-actiongroup" -ShortName $actionGroup.GroupShortName -Receiver $runbookReceiver

Upvotes: 0

Views: 162

Answers (1)

RithwikBojja
RithwikBojja

Reputation: 11128

Replacement for Set-AzActionGroup to configure webhook alerts in Azure

Replacement for Set-AzActionGroup is Update-AzActionGroup. Both do the same operation.

You can use below script and followed I have Microsoft-Document:

$rithactionGrpName = "testrith"
$rgname = "rbojja"
$testactionGroup = Get-AzActionGroup -ResourceGroupName $rgname -Name $rithactionGrpName
$rnReceiver = New-AzActionGroupWebhookReceiverObject -Name "InvokeRunbookWebhook" -ServiceUri "http://www.test.com/rithwebhook"
Update-AzActionGroup -ResourceGroupName $rgname -Name $rithactionGrpName -ShortName $testactionGroup.GroupShortName -WebhookReceiver $rnReceiver

Output:

enter image description here

Upvotes: 1

Related Questions