Bylaw

Gallery › SQL › Azure built-in policies

An Azure Active Directory administrator should be provisioned for SQL servers

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0

Audit provisioning of an Azure Active Directory administrator for your SQL server to enable Azure AD authentication. Azure AD authentication enables simplified permission management and centralized identity management of database users and other Microsoft services

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

Azure Policy JSONSQL_DB_AuditServerADAdmins_Audit.json · 44 lines
{
  "properties": {
    "displayName": "An Azure Active Directory administrator should be provisioned for SQL servers",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Audit provisioning of an Azure Active Directory administrator for your SQL server to enable Azure AD authentication. Azure AD authentication enables simplified permission management and centralized identity management of database users and other Microsoft services",
    "metadata": {
      "version": "1.0.0",
      "category": "SQL"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Sql/servers"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Sql/servers/administrators"
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/1f314764-cb73-4fc9-b863-8eca98ac36e9",
  "name": "1f314764-cb73-4fc9-b863-8eca98ac36e9"
}
Bylaw1f314764-cb73-4fc9-b863-8eca98ac36e9.bylaw.ps1 · 24 lines
# Converted from SQL_DB_AuditServerADAdmins_Audit.json by ConvertTo-Bylaw.
Policy '1f314764-cb73-4fc9-b863-8eca98ac36e9' {

    Properties @{
        DisplayName   = 'An Azure Active Directory administrator should be provisioned for SQL servers'
        Description   = 'Audit provisioning of an Azure Active Directory administrator for your SQL server to enable Azure AD authentication. Azure AD authentication enables simplified permission management and centralized identity management of database users and other Microsoft services'
        Version       = '1.0.0'
        Category      = 'SQL'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Sql/servers'

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

Source: built-in-policies/policyDefinitions/SQL/SQL_DB_AuditServerADAdmins_Audit.json in Azure/azure-policy, under the MIT licence.