standard
turbot/azure_cis
Get Involved
Version
Pipeline: 6.2.2 Ensure that Activity Log Alert exists for Delete Policy Assignment
Description
Create an activity log alert for the Delete Policy Assignment event.
Monitoring for delete policy assignment events gives insight into changes done in "azure policy - assignments" and can reduce the time it takes to detect unsolicited changes.
Remediation
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
Delete policy assignment (Policy assignment). - 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.
From Azure CLI
az monitor activity-log alert create --resource-group "<resource group name>" --condition category=Administrative and operationName=Microsoft.Authorization/policyAssignments/delete and level=<verbose | information | warning | error | critical> --scope "/subscriptions/<subscription ID>" --name "<activity log rule name>" --subscription <subscription id> --action-group <action group ID>From PowerShell
Create the conditions object
$conditions = @()$conditions += New-AzActivityLogAlertAlertRuleAnyOfOrLeafConditionObject -Equal Administrative -Field category$conditions += New-AzActivityLogAlertAlertRuleAnyOfOrLeafConditionObject -Equal Microsoft.Authorization/policyAssignments/delete -Field operationName$conditions += New-AzActivityLogAlertAlertRuleAnyOfOrLeafConditionObject -Equal Verbose -Field levelRetrieve the Action Group information and store in a variable, then create the Action object.
$actionGroup = Get-AzActionGroup -ResourceGroupName <resource group name> -Name <action group name>$actionObject = New-AzActivityLogAlertActionGroupObject -Id $actionGroup.IdCreate the Scope variable.
$scope = "/subscriptions/<subscription id>"Create the Activity Log Alert Rule for Microsoft.Authorization/policyAssignments/delete.
New-AzActivityLogAlert -Name "<activity log alert rule name>" -ResourceGroupName "<resource group name>" -Condition $conditions -Scope $scope -Location global -Action $actionObject -Subscription <subscription ID> -Enabled $trueDefault Value
By default, no monitoring alerts are created.
Run the pipeline
To run this pipeline from your terminal:
flowpipe pipeline run azure_cis.pipeline.cis_v300_6_2_2Use this pipeline
To call this pipeline from your pipeline, use a step:
step "pipeline" "step_name" { pipeline = azure_cis.pipeline.cis_v300_6_2_2 }Params
| Name | Type | Required | Description | Default |
|---|---|---|---|---|
| database | connection.steampipe | Yes | Database connection string. | connection.steampipe.default |
| notifier | notifier | Yes | The name of the notifier to use for sending notification messages. | notifier.default |
| notification_level | string | Yes | The verbosity level of notification messages to send. Valid options are 'verbose', 'info', 'error'. | info |
Outputs
This pipeline has no outputs.
Tags
folder = CIS v3.0.0/6 Logging and Monitoring/6.2 Monitoring using Activity Log Alerts