Gallery › Databricks › Azure Landing Zones Library
Deny Databricks workspaces without Vnet injection
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Enforces the use of vnet injection for Databricks workspaces.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-Databricks-VirtualNetwork.alz_policy_definition.json · 62 lines
{
"name": "Deny-Databricks-VirtualNetwork",
"properties": {
"description": "Enforces the use of vnet injection for Databricks workspaces.",
"displayName": "Deny Databricks workspaces without Vnet injection",
"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"
},
{
"anyOf": [
{
"exists": false,
"field": "Microsoft.DataBricks/workspaces/parameters.customVirtualNetworkId.value"
},
{
"exists": false,
"field": "Microsoft.DataBricks/workspaces/parameters.customPublicSubnetName.value"
},
{
"exists": false,
"field": "Microsoft.DataBricks/workspaces/parameters.customPrivateSubnetName.value"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-Databricks-VirtualNetwork.bylaw.ps1 · 36 lines
# Converted from Deny-Databricks-VirtualNetwork.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-Databricks-VirtualNetwork' {
Properties @{
DisplayName = 'Deny Databricks workspaces without Vnet injection'
Description = 'Enforces the use of vnet injection for Databricks workspaces.'
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.customVirtualNetworkId.value exists' {
Field parameters.customVirtualNetworkId.value | Must -Exist
}
Require 'parameters.customPublicSubnetName.value exists' {
Field parameters.customPublicSubnetName.value | Must -Exist
}
Require 'parameters.customPrivateSubnetName.value exists' {
Field parameters.customPrivateSubnetName.value | Must -Exist
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-Databricks-VirtualNetwork.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw