Cannot run New-AzActionGroup after New-AzActionGroupReceiver

Oleg Tserkovnyuk 561 Reputation points
2024-05-16T10:59:45.49+00:00

Hello,

I am trying to create a new action group using PS. The group will use webhook. To achieve this I need to create an action group receiver.

Code:

$ActionGroupShortName = 'Alert' 
$ActionGroupReceiverName = 'MonitoringAlertActionGroupReceiver'
$WebhookURL = 'https://api.compnay.com/v1/json/azure?apiKey=1111-1111-111-111-111'
$ActionGroupReceiver = New-AzActionGroupReceiver -Name $ActionGroupReceiverName -WebhookReceiver -ServiceUri $WebhookURL -UseCommonAlertSchema
New-AzActionGroup -Name $ActionGroupName -ResourceGroupName $ResourceGroupName -Location $Location -GroupShortName $ActionGroupShortName
Set-AzActionGroup -ResourceGroupName $ResourceGroupName -Name $ActionGroupName -ShortName $ActionGroupShortName -Receiver @($ActionGroupReceiver)

Recently this code stopped working. I cannot use the commands New-AzActionGroupReceiver and New-AzActionGroup in the same PS session. If I run them in the same PS session the command always crashes.

I have updated the Az.Monitor module, this did not help. I use PS7.

Example 1: Run first New-AzActionGroupReceiver, New-AzActionGroup crashes:User's image

Example 2: Run first New-AzActionGroup (canceled it), New-AzActionGroupReceiver crashes:User's image

I am going to open a case with MS, but often I get answers here much faster.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,885 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,418 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,186 questions
0 comments No comments
{count} votes