Detection rules › Panther

Azure Policy Violation Detected

Status
Experimental
Severity
informational
Log types
Azure.MonitorActivity
Reference
https://learn.microsoft.com/en-us/azure/governance/policy/overview
Source
github.com/panther-labs/panther-analysis

Detects when an Azure resource is found to be non-compliant with assigned Azure Policies. Policy violations indicate that resources do not meet organizational compliance requirements for security, networking, encryption, or other governance controls. Repeated violations may indicate configuration drift or potential security misconfigurations.

Rules detecting the same action

Other rules on this platform that filter on the same API call or operation.

Rule body yaml

AnalysisType: rule
Filename: azure_policy_violation.py
RuleID: "Azure.MonitorActivity.Policy.Violation"
DisplayName: "Azure Policy Violation Detected"
Enabled: true
LogTypes:
  - Azure.MonitorActivity
Severity: Info
Status: Experimental
Description: >
  Detects when an Azure resource is found to be non-compliant with assigned Azure Policies.
  Policy violations indicate that resources do not meet organizational compliance requirements
  for security, networking, encryption, or other governance controls. Repeated violations
  may indicate configuration drift or potential security misconfigurations.
Runbook: |
  1. Query Azure Monitor Activity logs for all configuration changes to the resource ID in the 48 hours before the policy violation to identify what triggered the non-compliance
  2. Find all policy violations for the same resource ID in the past 30 days to determine if this is an isolated incident or pattern of configuration drift
  3. Check for other policy violations with the same policy definition name across all resources in the past 7 days to identify broader compliance issues
Reference: https://learn.microsoft.com/en-us/azure/governance/policy/overview
SummaryAttributes:
  - properties.entity
  - callerIpAddress
  - correlationId
Tests:
  - Name: Storage Account Policy Violation
    ExpectedResult: true
    Log:
      {
        "time": "2025-12-22T10:30:00.0000000Z",
        "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/storage-rg/providers/Microsoft.Storage/storageAccounts/mystorage",
        "operationName": "MICROSOFT.AUTHORIZATION/POLICIES/AUDIT/ACTION",
        "operationVersion": "2021-06-01",
        "category": "Policy",
        "resultType": "Success",
        "callerIpAddress": "1.1.1.1",
        "correlationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "level": "Warning",
        "location": "eastus",
        "properties": {
          "entity": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/storage-rg/providers/Microsoft.Storage/storageAccounts/mystorage",
          "eventCategory": "Policy",
          "isComplianceCheck": "False",
          "message": "Microsoft.Authorization/policies/audit/action",
          "policies": "[{\"policyDefinitionId\":\"/providers/Microsoft.Authorization/policyDefinitions/2a1a9cdf-e04d-429a-8416-3bfb72a1b26f\",\"policySetDefinitionId\":\"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\"policyDefinitionReferenceId\":\"storageAccountsShouldRestrictNetworkAccessUsingVirtualNetworkRulesMonitoringEffect\",\"policySetDefinitionName\":\"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\"policySetDefinitionDisplayName\":\"Microsoft cloud security benchmark\",\"policyDefinitionName\":\"2a1a9cdf-e04d-429a-8416-3bfb72a1b26f\",\"policyDefinitionDisplayName\":\"Storage accounts should restrict network access using virtual network rules\",\"policyDefinitionEffect\":\"Audit\",\"policyAssignmentId\":\"/subscriptions/12345678-1234-1234-1234-123456789abc/providers/Microsoft.Authorization/policyAssignments/SecurityCenterBuiltIn\",\"policyAssignmentName\":\"SecurityCenterBuiltIn\",\"policyAssignmentDisplayName\":\"ASC Default\"}]",
          "resourceLocation": "westus2"
        },
        "tenantId": "87654321-4321-4321-4321-111111111111"
      }
  - Name: Shared Key Access Policy Violation
    ExpectedResult: true
    Log:
      {
        "time": "2025-12-22T11:15:00.0000000Z",
        "resourceId": "/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/prod-rg/providers/Microsoft.Storage/storageAccounts/prodstorage",
        "operationName": "microsoft.authorization/policies/audit/action",
        "category": "Policy",
        "resultType": "Success",
        "callerIpAddress": "1.2.3.4",
        "correlationId": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
        "level": "Warning",
        "location": "westeurope",
        "properties": {
          "entity": "/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/prod-rg/providers/Microsoft.Storage/storageAccounts/prodstorage",
          "eventCategory": "Policy",
          "isComplianceCheck": "True",
          "message": "Microsoft.Authorization/policies/audit/action",
          "policies": "[{\"policyDefinitionDisplayName\":\"Storage accounts should prevent shared key access\",\"policySetDefinitionDisplayName\":\"Microsoft cloud security benchmark\",\"policyDefinitionEffect\":\"Audit\",\"policyAssignmentDisplayName\":\"ASC Default\"}]",
          "resourceLocation": "westeurope"
        },
        "tenantId": "22222222-2222-2222-2222-222222222222"
      }
  - Name: AuditIfNotExists Policy Violation
    ExpectedResult: true
    Log:
      {
        "time": "2025-12-22T12:00:00.0000000Z",
        "resourceId": "/subscriptions/33333333-3333-3333-3333-333333333333/resourceGroups/network-rg/providers/Microsoft.Network/virtualNetworks/myvnet",
        "operationName": "MICROSOFT.AUTHORIZATION/POLICIES/AUDITIFNOTEXISTS/ACTION",
        "category": "Policy",
        "resultType": "Success",
        "callerIpAddress": "2.2.2.2",
        "correlationId": "c3d4e5f6-a7b8-9012-cdef-333333333333",
        "level": "Warning",
        "location": "centralus",
        "properties": {
          "entity": "/subscriptions/33333333-3333-3333-3333-333333333333/resourceGroups/network-rg/providers/Microsoft.Network/virtualNetworks/myvnet",
          "eventCategory": "Policy",
          "isComplianceCheck": "False",
          "message": "Microsoft.Authorization/policies/auditifnotexists/action",
          "policies": "[{\"policyDefinitionDisplayName\":\"Network Watcher should be enabled\",\"policyDefinitionEffect\":\"AuditIfNotExists\"}]",
          "resourceLocation": "centralus"
        },
        "tenantId": "33333333-3333-3333-3333-333333333333"
      }
  - Name: Different Category
    ExpectedResult: false
    Log:
      {
        "time": "2025-12-22T14:00:00.0000000Z",
        "resourceId": "/subscriptions/55555555-5555-5555-5555-555555555555/resourceGroups/admin-rg/providers/Microsoft.Storage/storageAccounts/adminstorage",
        "operationName": "MICROSOFT.STORAGE/STORAGEACCOUNTS/WRITE",
        "category": "Administrative",
        "resultType": "Success",
        "callerIpAddress": "1.2.3.4",
        "correlationId": "e5f6a7b8-c9d0-1234-ef01-111111111111",
        "level": "Information",
        "tenantId": "55555555-5555-5555-5555-555555555555"
      }

Detection logic

Condition

operationName in ["MICROSOFT.AUTHORIZATION/POLICIES/AUDIT/ACTION", "MICROSOFT.AUTHORIZATION/POLICIES/AUDITIFNOTEXISTS/ACTION"]
category eq "Policy"
level eq "Warning"

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
categoryeq
  • Policy
leveleq
  • Warning
operationNamein
  • MICROSOFT.AUTHORIZATION/POLICIES/AUDIT/ACTION
  • MICROSOFT.AUTHORIZATION/POLICIES/AUDITIFNOTEXISTS/ACTION

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

FieldSource
entityproperties.entity