Ensure that Activity Log Alert exists for Create or Update Public IP Address rule
Description
Create an activity log alert for the Create or Update Public IP Addresses rule.
Rationale
Monitoring for Create or Update Public IP Address events gives insight into network access changes and may reduce the time it takes to detect suspicious activity.
Impact
There will be a substantial increase in log size if there are a large number of administrative actions on a server.
Audit Procedure
Using Azure Portal
- Navigate to the
Monitorblade. - Click on
Alerts. - In the Alerts window, click on
Alert rules. - Ensure an alert rule exists where the Condition column contains
Operation name=Microsoft.Network/publicIPAddresses/write. - Click on the Alert
Nameassociated with the previous step. - Ensure the
Conditionpanel displays the textWhenever the Activity Log has an event with Category='Administrative', Operation name='Create or Update Public Ip Address'and does not filter onLevel,StatusorCaller. - Ensure the
Actionspanel displays an Action group is assigned to notify the appropriate personnel in your organization.
Using Azure CLI
az monitor activity-log alert list --subscription <subscription ID> --query "[].{Name:name,Enabled:enabled,Condition:condition.allOf,Actions:actions}"
Look for Microsoft.Network/publicIPAddresses/write in the output.
Using PowerShell
Get-AzActivityLogAlert -SubscriptionId <subscription ID>|where-object {$_.ConditionAllOf.Equal -match "Microsoft.Network/publicIPAddresses/write"}|select-object Location,Name,Enabled,ResourceGroupName,ConditionAllOf
Expected Result
An activity log alert rule should exist with the operation name Microsoft.Network/publicIPAddresses/write and an action group assigned.
Remediation
Remediate from Azure Portal
- Navigate to the
Monitorblade. - Select
Alerts. - Select
Create. - Select
Alert rule. - Choose a subscription.
- Select
Apply. - Select the
Conditiontab. - Click
See all signals. - Select
Create or Update Public Ip Address (Public Ip Address). - Click
Apply. - Select the
Actionstab. - Click
Select action groupsto select an existing action group, orCreate action groupto create a new action group. - Follow the prompts to choose or create an action group.
- Select the
Detailstab. - Select a
Resource group, provide anAlert rule nameand an optionalAlert rule description. - Click
Review + create. - Click
Create.
Remediate from Azure CLI
az monitor activity-log alert create --resource-group "<resource group name>" --condition category=Administrative and operationName=Microsoft.Network/publicIPAddresses/write and level=<verbose | information | warning | error | critical> --scope "/subscriptions/<subscription ID>" --name "<activity log rule name>" --subscription <subscription id> --action-group <action group ID>
Remediate from PowerShell
$conditions = @()
$conditions += New-AzActivityLogAlertAlertRuleAnyOfOrLeafConditionObject -Equal Administrative -Field category
$conditions += New-AzActivityLogAlertAlertRuleAnyOfOrLeafConditionObject -Equal Microsoft.Network/publicIPAddresses/write -Field operationName
$conditions += New-AzActivityLogAlertAlertRuleAnyOfOrLeafConditionObject -Equal Verbose -Field level
$actionGroup = Get-AzActionGroup -ResourceGroupName <resource group name> -Name <action group name>
$actionObject = New-AzActivityLogAlertActionGroupObject -Id $actionGroup.Id
$scope = "/subscriptions/<subscription ID>"
New-AzActivityLogAlert -Name "<activity log alert rule name>" -ResourceGroupName "<resource group name>" -Condition $conditions -Scope $scope -Location global -Action $actionObject -Subscription <subscription ID> -Enabled $true
Default Value
By default, no monitoring alerts are created.
References
- https://azure.microsoft.com/en-us/updates?id=classic-alerting-monitoring-retirement
- https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-create-activity-log-alert-rule
- https://learn.microsoft.com/en-us/rest/api/monitor/activity-log-alerts/create-or-update
- https://learn.microsoft.com/en-us/rest/api/monitor/activity-log-alerts/list-by-subscription-id
- https://learn.microsoft.com/en-us/security/benchmark/azure/mcsb-logging-threat-detection#lt-3-enable-logging-for-security-investigation
CIS Controls
| Controls Version | Control | IG 1 | IG 2 | IG 3 |
|---|---|---|---|---|
| v8 | 8.5 Collect Detailed Audit Logs | x | x | |
| v7 | 6.3 Enable Detailed Logging | x | x |
Profile
Level 1 | Automated