Skip to main content

More Info:

Monitoring for create policy assignment events gives insight into changes done in azure policy - assignments and may reduce the time it takes to detect unsolicited changes.

Risk Level

Low

Address

Operational Maturity, Security

Compliance Standards

  • CIS AZURE
  • Cloudanix Best Practice
  • HIPAA
  • ISO 27001
  • NIST CSF
  • PCI
  • SOC2

Triage and Remediation

Remediation

Using Console

Sure, here are the step-by-step instructions to remediate the misconfiguration “Ensure Activity Log Alert exists for Create Policy Assignment” in Azure using the Azure console:
  1. Log in to the Azure portal using your credentials.
  2. Click on the “Monitor” option from the left-hand side menu.
  3. Click on the “Activity log alerts” option from the “Monitor” menu.
  4. Click on the “New alert rule” button to create a new alert rule.
  5. In the “Basics” tab, provide a name for the alert rule and select the subscription to which it applies.
  6. In the “Condition” tab, select the “Signal logic” as “Activity log”.
  7. In the “Target” section, select “Resource Manager” as the “Resource type”.
  8. In the “Event types” section, select “Policy Assignment Created” as the event type.
  9. In the “Actions” tab, select the “Action group” that you want to associate with this alert rule.
  10. In the “Review + create” tab, review the alert rule configuration and click on the “Create” button to create the alert rule.
Once the alert rule is created, you will receive notifications whenever a policy assignment is created in your Azure environment. This will help you to ensure that all policy assignments are being created as per the defined policies and standards.

To remediate the misconfiguration “Ensure Activity Log Alert exists for Create Policy Assignment” in AZURE using AZURE CLI, follow the below steps:
  1. Open the AZURE CLI on your local machine or connect to the AZURE CLI in the AZURE portal.
  2. Run the following command to check if an activity log alert exists for Create Policy Assignment:
    If the command returns an empty array, then there is no activity log alert for Create Policy Assignment.
  3. Run the following command to create an activity log alert for Create Policy Assignment:
    Replace <action-group-id> with the ID of the action group that you want to use for this alert.
  4. Run the following command to verify that the activity log alert has been created:
    The command should return the details of the newly created activity log alert.
By following these steps, you can remediate the misconfiguration “Ensure Activity Log Alert exists for Create Policy Assignment” in AZURE using AZURE CLI.
To remediate the misconfiguration “Ensure Activity Log Alert exists for Create Policy Assignment” in Azure using Python, you can follow these steps:
  1. Import the necessary libraries:
  1. Set the Azure credentials:
  1. Create a MonitorManagementClient:
  1. Define the activity log alert properties:
  1. Create the activity log alert:
  1. Verify that the activity log alert has been created successfully:
These steps will create an activity log alert in Azure that will trigger when a policy assignment is created. You can customize the alert properties as necessary to meet your specific requirements.
This adds an Activity Log Alert specifically for the “Create Policy Assignment” operation; no existing resources are replaced. After you add this, terraform plan should show one new azurerm_monitor_activity_log_alert and one new azurerm_monitor_action_group to be created, with criteria category = "Policy" and operation_name = "Microsoft.Authorization/policyAssignments/write".

Additional Reading: