Bylaw

Gallery › Monitoring › Azure Landing Zones Library

DenyAction implementation on Diagnostic Logs.

Converted Policy DenyAction Mode All Version 1.0.1

DenyAction implementation on Diagnostic Logs.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONDenyAction-DiagnosticLogs.alz_policy_definition.json · 36 lines
{
  "name": "DenyAction-DiagnosticLogs",
  "properties": {
    "description": "DenyAction implementation on Diagnostic Logs.",
    "displayName": "DenyAction implementation on Diagnostic Logs.",
    "metadata": {
      "alzCloudEnvironments": [
        "AzureCloud",
        "AzureChinaCloud",
        "AzureUSGovernment"
      ],
      "category": "Monitoring",
      "deprecated": false,
      "source": "https://github.com/Azure/Enterprise-Scale/",
      "version": "1.0.1"
    },
    "mode": "All",
    "parameters": {},
    "policyRule": {
      "if": {
        "equals": "Microsoft.Insights/diagnosticSettings",
        "field": "type"
      },
      "then": {
        "details": {
          "actionNames": [
            "delete"
          ]
        },
        "effect": "denyAction"
      }
    },
    "policyType": "Custom"
  },
  "type": "Microsoft.Authorization/policyDefinitions"
}
BylawDenyAction-DiagnosticLogs.bylaw.ps1 · 17 lines
# Converted from DenyAction-DiagnosticLogs.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'DenyAction-DiagnosticLogs' {

    Properties @{
        DisplayName = 'DenyAction implementation on Diagnostic Logs.'
        Description = 'DenyAction implementation on Diagnostic Logs.'
        Category    = 'Monitoring'
        Deprecated  = $false
        Version     = '1.0.1'
        Mode        = 'All'
        Metadata    = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
    }

    Resource 'Microsoft.Insights/diagnosticSettings'

    DenyAction Delete
}

Source: policy_definitions/DenyAction-DiagnosticLogs.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.