Create Databricks-ready infrastructure that can be reused across multiple workspace deployments.
The BYOR pattern creates pre-configured networking and security infrastructure that meets all Databricks requirements. This is ideal for enterprise teams that separate infrastructure provisioning (network team) from workspace deployment (platform team).
β Separation of Concerns: Network team manages infrastructure, platform team deploys workspaces β Infrastructure Reuse: Deploy multiple workspaces using the same network β Pre-validated Setup: All Databricks requirements configured correctly β CMK Centralization: Shared Key Vault across workspaces (optional)
enable_nat_gateway = truecreate_privatelink_subnet = truecreate_key_vault = truecd deployments/byor
cp terraform.tfvars.example terraform.tfvars
vim terraform.tfvars
Minimum Required Configuration:
workspace_prefix = "<your-prefix>" # e.g., "proddb", "devdb"
location = "<azure-region>" # e.g., "eastus2", "westus"
resource_group_name = "<rg-name>" # e.g., "rg-databricks-byor-eastus2"
vnet_address_space = ["<cidr>"] # e.g., ["10.100.0.0/16"]
public_subnet_address_prefix = "<public-cidr>" # e.g., "10.100.1.0/26"
private_subnet_address_prefix = "<private-cidr>" # e.g., "10.100.2.0/26"
enable_nat_gateway = true # For Non-PL workspaces
tag_owner = "<owner-email>" # e.g., "platform-team@company.com"
tag_keepuntil = "<expiration-date>" # e.g., "12/31/2026"
terraform init
terraform plan
terraform apply
After successful deployment, get the configuration to use in workspace deployments:
# View the output in terminal
terraform output copy_paste_config
# Or save to file for easy copy-paste
terraform output -raw copy_paste_config > byor-config.txt
cat byor-config.txt
This outputs a ready-to-use configuration block like:
# ==============================================
# BYOR Configuration (from BYOR deployment)
# Copy-paste this section into deployments/non-pl/terraform.tfvars
# or deployments/full-private/terraform.tfvars
# ==============================================
# Master Control - Use BYOR infrastructure
use_byor_infrastructure = true
# Core Configuration - MUST match BYOR deployment
location = "<azure-region>"
resource_group_name = "<rg-name>"
# Network Configuration (from BYOR)
existing_vnet_name = "<workspace-prefix>-vnet-<suffix>"
existing_resource_group_name = "<rg-name>"
existing_public_subnet_name = "<workspace-prefix>-public-subnet-<suffix>"
existing_private_subnet_name = "<workspace-prefix>-private-subnet-<suffix>"
existing_nsg_name = "<workspace-prefix>-nsg-<suffix>"
# NSG Association IDs (required for workspace deployment)
existing_public_subnet_nsg_association_id = "/subscriptions/<sub-id>/resourceGroups/<rg-name>/providers/Microsoft.Network/virtualNetworks/<vnet-name>/subnets/<public-subnet-name>"
existing_private_subnet_nsg_association_id = "/subscriptions/<sub-id>/resourceGroups/<rg-name>/providers/Microsoft.Network/virtualNetworks/<vnet-name>/subnets/<private-subnet-name>"
# ==============================================
# CMK Configuration (from BYOR deployment)
# ==============================================
enable_cmk_managed_services = true
enable_cmk_managed_disks = true
enable_cmk_dbfs_root = true
# Key Vault from BYOR
existing_key_vault_id = "/subscriptions/<sub-id>/resourceGroups/<rg-name>/providers/Microsoft.KeyVault/vaults/<kv-name>"
existing_key_id = "https://<kv-name>.vault.azure.net/keys/databricks-cmk-<suffix>/<version>"
Option A: Direct Copy-Paste
# For Non-PL workspace
cd ../non-pl
vim terraform.tfvars
# 1. Set: use_byor_infrastructure = true
# 2. Paste the entire BYOR config section from above
terraform apply
# OR for Full-Private workspace
cd ../full-private
vim terraform.tfvars
# 1. Set: use_byor_infrastructure = true
# 2. Paste the entire BYOR config section from above
terraform apply
Option B: Using Saved File
# Save BYOR output
cd deployments/byor
terraform output -raw copy_paste_config > ../byor-config.txt
# Apply to Non-PL workspace
cd ../non-pl
# Open terraform.tfvars and paste contents from ../byor-config.txt
terraform apply
# Apply to Full-Private workspace (reuse same config)
cd ../full-private
# Open terraform.tfvars and paste contents from ../byor-config.txt
terraform apply
enable_nat_gateway = true # Required for internet egress
create_privatelink_subnet = false # Not needed
create_key_vault = false # Optional
enable_nat_gateway = false # No internet egress (air-gapped)
create_privatelink_subnet = true # Required for Private Link
privatelink_subnet_address_prefix = "10.100.3.0/26"
create_key_vault = false # Optional
create_key_vault = true
cmk_key_type = "RSA" # or "RSA-HSM"
cmk_key_size = 2048 # or 3072, 4096
All subnets automatically include:
delegation {
name = "Microsoft.Databricks/workspaces"
actions = [
"Microsoft.Network/virtualNetworks/subnets/join/action",
"Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
"Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action"
]
}
All Databricks subnets include:
Microsoft.StorageMicrosoft.KeyVaultMicrosoft.EventHubPre-configured with Databricks-required rules:
AzureDatabricks (443) - Control planeStorage (443) - DBFS and artifactsEventHub (443) - Logs and metricsVirtualNetwork (all) - Worker communicationBYOR automatically validates:
terraform output copy_paste_config
Provides a complete configuration block ready to paste into workspace deployments.
terraform output vnet_name
terraform output public_subnet_id
terraform output nat_gateway_public_ip
terraform output cmk_key_id
All outputs available programmatically for automation.
The same BYOR infrastructure can be used for multiple workspaces:
# Deploy infrastructure once
cd deployments/byor
terraform apply
# Get configuration
terraform output copy_paste_config > byor-config.txt
# Deploy multiple workspaces using same network
cd ../non-pl
# Paste config, set workspace_prefix = "workspace1"
terraform apply
cd ../non-pl-2
# Paste same config, set workspace_prefix = "workspace2"
terraform apply
When using CMK from BYOR across multiple workspaces:
Each workspaceβs DBFS storage identity automatically gets access to the shared Key Vault.
See terraform.tfvars.example for complete examples:
1. Deploy BYOR Infrastructure:
cd deployments/byor
terraform apply
# Get the copy-paste configuration
terraform output -raw copy_paste_config > ../byor-config.txt
# or simply view it:
terraform output copy_paste_config
2. Deploy Non-PL Workspace:
cd ../non-pl
# Edit terraform.tfvars:
# - Set: use_byor_infrastructure = true
# - Paste the BYOR output from ../byor-config.txt
terraform apply
3. Deploy Full-Private Workspace (Same Network):
cd ../full-private
# Edit terraform.tfvars:
# - Set: use_byor_infrastructure = true
# - Paste the same BYOR output from ../byor-config.txt
terraform apply
β BYOR creates: VNet, Subnets, NSG, NAT Gateway, Key Vault β Non-PL workspace creates: Workspace, Unity Catalog, NCC, SEP β Full-Private workspace creates: Workspace, Unity Catalog, Private Endpoints, NCC
Both workspaces share the same network and Key Vault! π
β DO:
β DONβT:
Ready to create your infrastructure? Start with terraform.tfvars.example! π