Gallery › Azure Databricks › Azure built-in policies
Configure Azure Databricks Workspaces with private endpoints
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 1.0.2
Private endpoints connect your virtual networks to Azure services without a public IP address at the source or destination. By mapping private endpoints to Azure Databricks Workspaces, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/adbpe.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDatabricks_PrivateEndpoint_DINE.json · 162 lines
{
"properties": {
"displayName": "Configure Azure Databricks Workspaces with private endpoints",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Private endpoints connect your virtual networks to Azure services without a public IP address at the source or destination. By mapping private endpoints to Azure Databricks Workspaces, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/adbpe.",
"metadata": {
"version": "1.0.2",
"category": "Azure Databricks"
},
"version": "1.0.2",
"parameters": {
"privateEndpointSubnetId": {
"type": "String",
"metadata": {
"displayName": "Private endpoint subnet id",
"description": "Specifies the subnet to use to configure private endpoint",
"strongType": "Microsoft.Network/virtualNetworks/subnets"
}
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists"
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Databricks/workspaces"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Databricks/workspaces/privateEndpointConnections",
"existenceCondition": {
"field": "Microsoft.Databricks/workspaces/privateEndpointConnections/privateLinkServiceConnectionState.status",
"equals": "Approved"
},
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
],
"deployment": {
"properties": {
"mode": "incremental",
"parameters": {
"name": {
"value": "[field('name')]"
},
"serviceId": {
"value": "[field('id')]"
},
"privateEndpointSubnetId": {
"value": "[parameters('privateEndpointSubnetId')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string"
},
"serviceId": {
"type": "string"
},
"privateEndpointSubnetId": {
"type": "string"
}
},
"variables": {
"privateEndpointName": "[concat('pe-',substring(parameters('name'),0,min(length(parameters('name')),50)),'-',uniquestring(deployment().name))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"name": "[variables('privateEndpointName')]",
"apiVersion": "2020-06-01",
"properties": {
"mode": "Incremental",
"expressionEvaluationOptions": {
"scope": "inner"
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"serviceId": {
"type": "string"
},
"privateEndpointSubnetId": {
"type": "string"
},
"subnetLocation": {
"type": "string"
}
},
"variables": {
"privateEndpointName": "[deployment().name]"
},
"resources": [
{
"name": "[variables('privateEndpointName')]",
"type": "Microsoft.Network/privateEndpoints",
"apiVersion": "2020-07-01",
"location": "[parameters('subnetLocation')]",
"tags": {},
"properties": {
"subnet": {
"id": "[parameters('privateEndpointSubnetId')]"
},
"privateLinkServiceConnections": [
{
"name": "[variables('privateEndpointName')]",
"properties": {
"privateLinkServiceId": "[parameters('serviceId')]",
"groupIds": [
"databricks_ui_api"
],
"requestMessage": "autoapprove"
}
}
],
"manualPrivateLinkServiceConnections": []
}
}
]
},
"parameters": {
"serviceId": {
"value": "[parameters('serviceId')]"
},
"privateEndpointSubnetId": {
"value": "[parameters('privateEndpointSubnetId')]"
},
"subnetLocation": {
"value": "[reference(first(take(split(parameters('privateEndpointSubnetId'),'/subnets'),1)),'2020-07-01','Full').location]"
}
}
}
}
]
}
}
}
}
}
},
"versions": [
"1.0.2"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/09210db3-d32c-4b2b-b4e1-f72ae920eb11",
"name": "09210db3-d32c-4b2b-b4e1-f72ae920eb11"
}Bylaw09210db3-d32c-4b2b-b4e1-f72ae920eb11.bylaw.ps1 · 38 lines
# Converted from Databricks_PrivateEndpoint_DINE.json by ConvertTo-Bylaw.
Policy '09210db3-d32c-4b2b-b4e1-f72ae920eb11' {
Properties @{
DisplayName = 'Configure Azure Databricks Workspaces with private endpoints'
Description = 'Private endpoints connect your virtual networks to Azure services without a public IP address at the source or destination. By mapping private endpoints to Azure Databricks Workspaces, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/adbpe.'
Version = '1.0.2'
Category = 'Azure Databricks'
PolicyVersion = '1.0.2'
Mode = 'Indexed'
}
Parameter PrivateEndpointSubnetId @{
Type = 'String'
DisplayName = 'Private endpoint subnet id'
Description = 'Specifies the subnet to use to configure private endpoint'
Metadata = [ordered]@{ strongType = 'Microsoft.Network/virtualNetworks/subnets' }
}
Parameter Effect @{
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Databricks/workspaces'
DeployIfNotExists 'Microsoft.Databricks/workspaces/privateEndpointConnections' -Role 'Contributor' -Effect (Param Effect) {
Require 'privateLinkServiceConnectionState.status is Approved' {
Field privateLinkServiceConnectionState.status | Must -Be 'Approved'
}
Deployment -TemplateFile './templates/09210db3-d32c-4b2b-b4e1-f72ae920eb11.json' -Parameters ([ordered]@{
name = (Arm '[field(''name'')]')
serviceId = (Arm '[field(''id'')]')
privateEndpointSubnetId = (Param PrivateEndpointSubnetId)
})
}
}Its deployment templates are written beside it:
templates/09210db3-d32c-4b2b-b4e1-f72ae920eb11.json
Source: built-in-policies/policyDefinitions/Azure Databricks/Databricks_PrivateEndpoint_DINE.json in Azure/azure-policy, under the MIT licence.
Bylaw