For my purpose, i am going to add a new receiver to existed action group.
First, I use Get-Azactiongroup to get existed action group's information.
Then, Use New-AzActionGroupReceiver to create a new receiver.
After create new receiver, Add this User to action group's information.
Finally, Use Set-AzActionGroup with -InputObject to update.
$actiongroup = get-azactiongroup -resourcegroupname test-01 -name pwsh-action-03
$receiver = New-AzActionGroupReceiver -Name User -EmailReceiver -EmailAddress ******@123.com
$actiongroup.EmailReceivers.Add($receiver)
Set-AzActionGroup -InputObject $actiongroup
For my situation, The platform i using is Windows Powershell, Azure Portal and MacOS termial Powershell.
When i excute commands, it is normal success on MacOS's Powershell.
The Error only happen when i use Windows or Azure Portal.
| Platform |
Version |
| Windows |
5&7.3.7 |
| Powershell MacOS Terminal |
7.3.6 |
| Azure Portal |
7.3.6 |
Error message:
Set-AzActionGroup: Exception type: ErrorResponseException, Message: Microsoft.Azure.Management.Monitor.Models.ErrorResponseException: Operation returned an invalid status code 'BadRequest'
at Microsoft.Azure.Management.Monitor.ActionGroupsOperations.CreateOrUpdateWithHttpMessagesAsync(String resourceGroupName, String actionGroupName, ActionGroupResource actionGroup, Dictionary`2 customHeaders, CancellationToken cancellationToken)
at Microsoft.Azure.Management.Monitor.ActionGroupsOperationsExtensions.CreateOrUpdateAsync(IActionGroupsOperations operations, String resourceGroupName, String actionGroupName, ActionGroupResource actionGroup, CancellationToken cancellationToken)
at Microsoft.Azure.Management.Monitor.ActionGroupsOperationsExtensions.CreateOrUpdate(IActionGroupsOperations operations, String resourceGroupName, String actionGroupName, ActionGroupResource actionGroup)
at Microsoft.Azure.Commands.Insights.ActionGroups.SetAzureRmActionGroupCommand.ProcessRecordInternal()
at Microsoft.Azure.Commands.Insights.MonitorCmdletBase.ExecuteCmdlet(), Code: Null, Status code:Null, Reason phrase: Null