Bylaw

Gallery › SQL › Azure Community Policy

Audit If no AAD Admin

Converted Policy AuditIfNotExists Disabled Mode All Version 1.0.0

Aduit If there is no AAD Admin assigned to this server

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

Azure Policy JSONazurepolicy.json · 39 lines
{
  "name": "ed90af69-0e31-428d-8e75-ee85f0f13cc6",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "Audit If no AAD Admin",
    "description": "Aduit If there is no AAD Admin assigned to this server",
    "metadata": {
      "version": "1.0.0",
      "category": "SQL"
    },
    "mode": "All",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "AuditIfNotExists or Disabled the execution of the Policy"
        },
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "defaultValue": "AuditIfNotExists"
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.SQL/servers"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.SQL/servers/administrators"
        }
      }
    }
  }
}
Bylawed90af69-0e31-428d-8e75-ee85f0f13cc6.bylaw.ps1 · 22 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'ed90af69-0e31-428d-8e75-ee85f0f13cc6' {

    Properties @{
        DisplayName = 'Audit If no AAD Admin'
        Description = 'Aduit If there is no AAD Admin assigned to this server'
        Version     = '1.0.0'
        Category    = 'SQL'
        Mode        = 'All'
    }

    Parameter Effect @{
        AllowedValues = @('AuditIfNotExists', 'Disabled')
        Default       = 'AuditIfNotExists'
        DisplayName   = 'Effect'
        Description   = 'AuditIfNotExists or Disabled the execution of the Policy'
    }

    Resource 'Microsoft.SQL/servers'

    AuditIfNotExists 'Microsoft.SQL/servers/administrators' -Effect (Param Effect)
}

Source: policyDefinitions/SQL/audit-if-no-aad-admin/azurepolicy.json in Azure/Community-Policy, under the MIT licence.