Azure / Azure/azure-powershell
Set-AzureRmActivityLogAlert and -action
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
Hi,
I'm really struggling to use your command, the documentation is very poor and the example doesn't work.
I'm wondering if you can help explain your work?
I'm trying to use powershell to create an alert please see below. Here is what I have so far.
$email = New-AzureRmActionGroupReceiver -Name 'user1' -EmailReceiver -EmailAddress 'username@outlook.com'
$AG1 = Set-AzureRmActionGroup -Name 'Emailag' -ResourceGroup 'testrg' -ShortName 'testEmail' -Receiver $email
$condition1 = New-AzureRmActivityLogAlertCondition -Field 'category' -Equal 'Administrative'
$Condition2 = New-AzureRmActivityLogAlertCondition -Field 'resourceType' -Equal 'Microsoft.Network/NetworkSecurityGroups'
$Condition3 = New-AzureRmActivityLogAlertCondition -Field 'operationName' -Equal 'Microsoft.network/networksecuritygroups/write'
set-azurermactivitylogalert -location 'ukwest' -name 'alertone' -resourcegroupname 'testrg' -Scope '/' -action $AG1 -Condition $condition1, $Condition2, $Condition3
I need some questions answered to get this working.
1, When I run the command set-azurermactivitylogalert what should the -action be set to. The documentation is misleading. I am to use new-azurermactiongroup or set-azurermactiongroup which create to very different objects?
$AG1 = Set-AzureRmActionGroup -Name 'Emailag' -ResourceGroup 'testrg' -ShortName 'testEmail' -Receiver $email
$AG2 = new-azurermactiongroup -actiongroupID 'actiongroupid'
2, what is the new-azureactiongroup used for?
3, can you put an example using my lines of code so I can understand how to create an alert please.
4, I've had to use resouce explorer just to find out what conditions to set, which I'm not sure they are right, I would be good to have better documentation about this command.
Thanks
Russell
Contributor guide
Assessment
This issue has not been assessed yet.