Bylaw

Gallery › Databricks › Azure Landing Zones Library

Deny public IPs for Databricks cluster

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Denies the deployment of workspaces that do not use the noPublicIp feature to host Databricks clusters without public IPs.

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

Azure Policy JSONDeny-Databricks-NoPublicIp.alz_policy_definition.json · 50 lines
{
  "name": "Deny-Databricks-NoPublicIp",
  "properties": {
    "description": "Denies the deployment of workspaces that do not use the noPublicIp feature to host Databricks clusters without public IPs.",
    "displayName": "Deny public IPs for Databricks cluster",
    "metadata": {
      "alzCloudEnvironments": [
        "AzureCloud"
      ],
      "category": "Databricks",
      "source": "https://github.com/Azure/Enterprise-Scale/",
      "version": "1.0.0"
    },
    "mode": "Indexed",
    "parameters": {
      "effect": {
        "allowedValues": [
          "Audit",
          "Disabled",
          "Deny"
        ],
        "defaultValue": "Deny",
        "metadata": {
          "description": "Enable or disable the execution of the policy",
          "displayName": "Effect"
        },
        "type": "String"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "equals": "Microsoft.Databricks/workspaces",
            "field": "type"
          },
          {
            "field": "Microsoft.DataBricks/workspaces/parameters.enableNoPublicIp.value",
            "notEquals": true
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "policyType": "Custom"
  },
  "type": "Microsoft.Authorization/policyDefinitions"
}
BylawDeny-Databricks-NoPublicIp.bylaw.ps1 · 28 lines
# Converted from Deny-Databricks-NoPublicIp.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-Databricks-NoPublicIp' {

    Properties @{
        DisplayName = 'Deny public IPs for Databricks cluster'
        Description = 'Denies the deployment of workspaces that do not use the noPublicIp feature to host Databricks clusters without public IPs.'
        Category    = 'Databricks'
        Version     = '1.0.0'
        Mode        = 'Indexed'
        Metadata    = [ordered]@{ alzCloudEnvironments = @('AzureCloud'); source = 'https://github.com/Azure/Enterprise-Scale/' }
    }

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

    Resource 'Microsoft.Databricks/workspaces' {

        Require 'parameters.enableNoPublicIp.value is true' {
            Field parameters.enableNoPublicIp.value | Must -Be $true
        }
    }

    Effect (Param Effect)
}

Source: policy_definitions/Deny-Databricks-NoPublicIp.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.