Bylaw

Gallery › Azure Data Explorer › Azure built-in policies

All Database Admin on Azure Data Explorer should be disabled

Converted Policy Audit Deny Disabled Mode All Version 1.0.0

Disable all database admin role to restrict granting highly privileged/administrative user role.

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

Azure Policy JSONADX_AllDatabaseAdmins_Deny.json · 50 lines
{
  "properties": {
    "displayName": "All Database Admin on Azure Data Explorer should be disabled",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "Disable all database admin role to restrict granting highly privileged/administrative user role.",
    "metadata": {
      "category": "Azure Data Explorer",
      "version": "1.0.0"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Kusto/Clusters/principalAssignments"
          },
          {
            "field": "Microsoft.Kusto/Clusters/principalAssignments/role",
            "equals": "AllDatabasesAdmin"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/8945ba5e-918e-4a57-8117-fe615d12e3ba",
  "name": "8945ba5e-918e-4a57-8117-fe615d12e3ba"
}
Bylaw8945ba5e-918e-4a57-8117-fe615d12e3ba.bylaw.ps1 · 28 lines
# Converted from ADX_AllDatabaseAdmins_Deny.json by ConvertTo-Bylaw.
Policy '8945ba5e-918e-4a57-8117-fe615d12e3ba' {

    Properties @{
        DisplayName   = 'All Database Admin on Azure Data Explorer should be disabled'
        Description   = 'Disable all database admin role to restrict granting highly privileged/administrative user role.'
        Category      = 'Azure Data Explorer'
        Version       = '1.0.0'
        PolicyVersion = '1.0.0'
        Mode          = 'All'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.Kusto/Clusters/principalAssignments' {

        Require 'role is not AllDatabasesAdmin' {
            Field role | Must -Not -Be 'AllDatabasesAdmin' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Azure Data Explorer/ADX_AllDatabaseAdmins_Deny.json in Azure/azure-policy, under the MIT licence.