ARM template for firewall support for the workspace storage account

This article provides you with the ARM template and a description of the required fields for firewall support for the workspace storage account. Firewall support for your workspace storage account is controlled by the ARM template property storageAccountFirewall, which must be set to Enabled.

For certain workspace configurations, such as enabling the compliance security profile, you might need a different ARM template. In that case, contact your Databricks account team.

You can also update or create your workspace using Terraform. See the azurerm_databricks_workspace Terraform provider.

ARM template fields

This table lists the fields and their descriptions for the below ARM template for firewall support for the workspace storage account.

Field Description
Subscription Azure subscription to use.
Resource group Resource group to use. This typically is the resource group of your VNet.
Workspace Name Name of the workspace. If you are using an existing workspace, this must exactly match the existing workspace name.
Managed Resource Group Name The managed resource group for your workspace. This auto-populates in the form to a default name. Change it if your organization wants to customize the managed resource group name.
Storage Account Name The Azure workspace storage account in your managed resource group. This auto-populates in the form to a default name. Change it if your organization wants to customize the managed resource group name.
Workspace VNet Network Id The resource ID for your VNet. For an existing workspace, you can get this by navigating to the workspace in the Azure portal. Click Properties. Under Custom virtual network Id, click View value as JSON. Copy the resource ID in the value field.
Custom Private Subnet Name The private subnet for your VNet. For an existing workspace, you can get this by navigating to the workspace in the Azure portal. Click Properties. Under Custom private subnet, click View value as JSON. Copy the subnet name in the value field.
Custom Public Subnet Name The public subnet for your VNet. For an existing workspace, you can get this by navigating to the workspace in the Azure portal. Click Properties. Under Custom public subnet, click View value as JSON. Copy the subnet name in the value field.
Location The short name for the Azure region that auto-populates to match the main Region field.
Access Connector Name For typical deployments, don’t modify this field. Azure Databricks creates a new Access Connector.
Managed Identity Type For typical deployments, don’t modify this field.
User Managed Identity Resource ID For typical deployments, don’t modify this field.
Storage Account Firewall Specifies whether to enable firewall support for your workspace storage account.
Disable Public Ip This must be set to true. This enables secure cluster connectivity, which is required for firewall support for your workspace storage account.
Public Network Access Typically set this to Enabled. If you enable Private Link, see Enable Azure Private Link back-end and front-end connections for what settings to use.
Required Nsg Rules Typically set this to All Rules. If you enable Private Link, see Enable Azure Private Link back-end and front-end connections for what settings to use.
Customer Managed Keys Enabled Set this true if you use customer-managed keys for managed services or managed disks. See Customer-managed keys for encryption.
Customer Managed Keys Type If customer-managed keys is enabled, select the customer-managed key types for this workspace. Choose Managed Services, ManagedDisks, or Both.
Managed Srvc Key Vault Key Id If you use customer-managed keys for managed services, specify the key vault Key Id.
Managed Disk Key Vault Key Id If you use customer-managed keys for managed disks, specify the key vault Key Id.
Managed Disk Auto Rotation If you use customer-managed keys for managed disks, specify whether to pick up new key versions automatically.

ARM template for firewall support for your workspace storage account

Copy the following ARM template to enable or disable firewall support for your workspace storage account. You can also deploy a sample ARM template:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspaceName": {
      "type": "String",
      "metadata": {
        "description": "The name of the Azure Databricks workspace to update."
      }
    },
    "location": {
      "defaultValue": "[resourceGroup().location]",
      "type": "String",
      "metadata": {
        "description": "Location for all resources."
      }
    },
    "managedResourceGroupName": {
      "defaultValue": "[format('databricks-rg-{0}-{1}', parameters('workspaceName'), uniqueString(parameters('workspaceName'), resourceGroup().id))]",
      "type": "String",
      "metadata": {
        "description": "The Managed Resource GroupName of the workspace. Do not change unless using a custom managed resource group name."
      }
    },
    "storageAccountName": {
      "defaultValue": "[concat('dbstorage', uniqueString(resourceGroup().id, subscription().id))]",
      "type": "String",
      "metadata": {
        "description": "Workspace storage account name. Do not change unless using a custom storage account name."
      }
    },
    "workspaceVnetResourceId": {
      "defaultValue": "Required Resource ID of the workspace VNet",
      "type": "String",
      "metadata": {
        "description": "The Resource ID of the injected VNet for the workspace"
      }
    },
    "workspacePrivateSubnetName": {
      "defaultValue": "private-subnet",
      "type": "String",
      "metadata": {
        "description": "The private subnet name for the workspace"
      }
    },
    "workspacePublicSubnetName": {
      "defaultValue": "public-subnet",
      "type": "String",
      "metadata": {
        "description": "The public subnet name for the workspace"
      }
    },
    "accessConnectorName": {
      "defaultValue": "[format('{0}-access-connector', parameters('workspaceName'))]",
      "type": "String",
      "metadata": {
        "description": "The access connector to create for the workspace"
      }
    },
    "ManagedIdentityType": {
      "defaultValue": "SystemAssigned",
      "allowedValues": [
        "SystemAssigned",
        "UserAssigned",
        "SystemAssigned,UserAssigned"
      ],
      "type": "String",
      "metadata": {
        "description": "Access Connector Managed Identity Type"
      }
    },
    "userManagedIdentityResourceId": {
      "defaultValue": "Required For User Mananged Identity",
      "type": "String",
      "metadata": {
        "description": "The Resource Id of the User Managed Identity"
      }
    },
    "storageAccountFirewall": {
      "defaultValue": "Enabled",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ],
      "type": "String",
      "metadata": {
        "description": "Enable or Disable firewall support for workspace default storage feature"
      }
    },
    "disablePublicIp": {
      "defaultValue": true,
      "type": "Bool",
      "metadata": {
        "description": "Specifies whether to deploy Azure Databricks workspace with secure cluster connectivity (SCC) enabled or not (No Public IP)."
      }
    },
    "publicNetworkAccess": {
      "defaultValue": "Enabled",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ],
      "type": "String",
      "metadata": {
        "description": "Indicates whether public network access is allowed to the workspace with private endpoint - possible values are Enabled or Disabled."
      }
    },
    "requiredNsgRules": {
      "defaultValue": "AllRules",
      "allowedValues": [
        "AllRules",
        "NoAzureDatabricksRules"
      ],
      "type": "String",
      "metadata": {
        "description": "Indicates whether to retain or remove the AzureDatabricks outbound NSG rule - possible values are AllRules, NoAzureDatabricksRules (private link)."
      }
    },
    "storageDoubleEncryption": {
      "defaultValue": false,
      "type": "Bool",
      "metadata": {
        "description": "Is double encryption for managed storage enabled ?"
      }
    },
    "customerManagedKeysEnabled": {
      "defaultValue": false,
      "type": "Bool",
      "metadata": {
        "description": "Is CMK for managed services enabled ?"
      }
    },
    "CustomerManagedKeyType": {
      "defaultValue": "ManagedServicesCMK",
      "allowedValues": [
        "ManagedServicesCMK",
        "ManagedDisksCMK",
        "BothCMK"
      ],
      "type": "String",
      "metadata": {
        "description": "Selects the CMK types for this workspace, Managed Services and/or Disks, Workspace storage account is not enabled here"
      }
    },

    "ManagedSrvcKeyVaultKeyId": {
      "defaultValue": "https://kv-url/keys/keyname/version",
      "type": "String",
      "metadata": {
        "description": "The Key Vault Key ID"
      }
    },
    "ManagedDiskKeyVaultKeyId": {
      "defaultValue": "https://kv-url/keys/keyname/version",
      "type": "String",
      "metadata": {
        "description": "The Key Vault Key ID"
      }
    },
    "ManagedDiskAutoRotation": {
      "type": "bool",
      "defaultValue": false,
      "allowedValues": [
        true,
        false
      ],
      "metadata": {
        "description": "Whether managed disk will pick up new key version automatically."
      }
    }
  },
  "variables": {
    "ApiVersion": "2024-05-01",
    "workspaceSku": "premium",
    "systemAssignedObject": {
      "type": "[parameters('ManagedIdentityType')]"
    },
    "userAssignedObject": {
      "type": "[parameters('ManagedIdentityType')]",
      "userAssignedIdentities": {
        "[parameters('userManagedIdentityResourceId')]": {}
      }
    },
    "ConnectorSystemAssigned": {
      "id": "[resourceId('Microsoft.Databricks/accessConnectors', parameters('accessConnectorName'))]",
      "identityType": "[parameters('ManagedIdentityType')]"
    },
    "connectorUserAssigned": {
      "id": "[resourceId('Microsoft.Databricks/accessConnectors', parameters('accessConnectorName'))]",
      "identityType": "[parameters('ManagedIdentityType')]",
      "userAssignedIdentityId": "[parameters('userManagedIdentityResourceId')]"
    },
    "managedSrvcFirst" : "[split(parameters('ManagedSrvcKeyVaultKeyId'),'/keys/')]",
    "managedSrvcSecond" : "[split(variables('managedSrvcFirst')[1],'/')]",
     "managedDiskFirst" : "[split(parameters('ManagedDiskKeyVaultKeyId'),'/keys/')]",
    "managedDiskSecond" : "[split(variables('managedDiskFirst')[1],'/')]",
    "ManagedServicesCMK": {
      "managedServices": {
        "keySource": "Microsoft.Keyvault",
        "keyVaultProperties": {
          "keyVaultUri": "[variables('managedSrvcFirst')[0]]",
          "keyName": "[variables('managedSrvcSecond')[0]]",
          "keyVersion": "[variables('managedSrvcSecond')[1]]"
        }
      }
    },
    "ManagedDisksCMK": {
      "managedDisk": {
        "keySource": "Microsoft.Keyvault",
        "keyVaultProperties": {
          "keyVaultUri": "[variables('managedDiskFirst')[0]]",
          "keyName": "[variables('managedDiskSecond')[0]]",
          "keyVersion": "[variables('managedDiskSecond')[1]]"
        },
        "rotationToLatestKeyVersionEnabled": "[parameters('ManagedDiskAutoRotation')]"
      }
    },
    "BothCMK": {
      "managedServices": {
        "keySource": "Microsoft.Keyvault",
        "keyVaultProperties": {
          "keyVaultUri": "[variables('managedSrvcFirst')[0]]",
          "keyName": "[variables('managedSrvcSecond')[0]]",
          "keyVersion": "[variables('managedSrvcSecond')[1]]"
        }
      },
      "managedDisk": {
        "keySource": "Microsoft.Keyvault",
        "keyVaultProperties": {
          "keyVaultUri": "[variables('managedDiskFirst')[0]]",
          "keyName": "[variables('managedDiskSecond')[0]]",
          "keyVersion": "[variables('managedDiskSecond')[1]]"
        },
        "rotationToLatestKeyVersionEnabled": "[parameters('ManagedDiskAutoRotation')]"
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.Databricks/accessConnectors",
      "apiVersion": "2023-05-01",
      "name": "[parameters('accessConnectorName')]",
      "location": "[parameters('location')]",
      "identity": "[if(equals(parameters('ManagedIdentityType'),'SystemAssigned'),variables('systemAssignedObject'),variables('userAssignedObject'))]",
      "properties": {}
    },
    {
      "type": "Microsoft.Databricks/workspaces",
      "apiVersion": "[variables('ApiVersion')]",
      "name": "[parameters('workspaceName')]",
      "location": "[parameters('location')]",
      "dependsOn": [
        "[resourceId('Microsoft.Databricks/accessConnectors', parameters('accessConnectorName'))]"
      ],
      "sku": {
        "name": "[variables('workspaceSku')]"
      },
      "properties": {
        "managedResourceGroupId": "[subscriptionResourceId('Microsoft.Resources/resourceGroups', parameters('managedResourceGroupName'))]",
        "publicNetworkAccess": "[parameters('publicNetworkAccess')]",
        "requiredNsgRules": "[parameters('requiredNsgRules')]",
        "accessConnector": "[if(equals(parameters('ManagedIdentityType'),'SystemAssigned'),variables('ConnectorSystemAssigned'),variables('connectorUserAssigned'))]",
        "defaultStorageFirewall": "[parameters('storageAccountFirewall')]",
        "parameters": {
          "customVirtualNetworkId": {
            "value": "[parameters('workspaceVnetResourceId')]"
          },
          "customPrivateSubnetName": {
            "value": "[parameters('workspacePrivateSubnetName')]"
          },
          "customPublicSubnetName": {
            "value": "[parameters('workspacePublicSubnetName')]"
          },
          "enableNoPublicIp": {
            "value": "[parameters('disablePublicIp')]"
          },
          "storageAccountName": {
            "value": "[parameters('storageAccountName')]"
          },
          "requireInfrastructureEncryption": {
            "value": "[parameters('storageDoubleEncryption')]"
          }
        }
      },
      "condition": "[not(parameters('customerManagedKeysEnabled'))]"
    },
    {
      "type": "Microsoft.Databricks/workspaces",
      "apiVersion": "[variables('ApiVersion')]",
      "name": "[parameters('workspaceName')]",
      "location": "[parameters('location')]",
      "dependsOn": [
        "[resourceId('Microsoft.Databricks/accessConnectors', parameters('accessConnectorName'))]"
      ],
      "sku": {
        "name": "[variables('workspaceSku')]"
      },
      "properties": {
        "managedResourceGroupId": "[subscriptionResourceId('Microsoft.Resources/resourceGroups', parameters('managedResourceGroupName'))]",
        "publicNetworkAccess": "[parameters('publicNetworkAccess')]",
        "requiredNsgRules": "[parameters('requiredNsgRules')]",
        "accessConnector": "[if(equals(parameters('ManagedIdentityType'),'SystemAssigned'),variables('ConnectorSystemAssigned'),variables('connectorUserAssigned'))]",
        "encryption": {
          "entities": "[variables(parameters('CustomerManagedKeyType'))]"
        },
        "defaultStorageFirewall": "[parameters('storageAccountFirewall')]",
        "parameters": {
          "customVirtualNetworkId": {
            "value": "[parameters('workspaceVnetResourceId')]"
          },
          "customPrivateSubnetName": {
            "value": "[parameters('workspacePrivateSubnetName')]"
          },
          "customPublicSubnetName": {
            "value": "[parameters('workspacePublicSubnetName')]"
          },
          "enableNoPublicIp": {
            "value": "[parameters('disablePublicIp')]"
          },
          "storageAccountName": {
            "value": "[parameters('storageAccountName')]"
          },
          "requireInfrastructureEncryption": {
            "value": "[parameters('storageDoubleEncryption')]"
          }
        }
      },
      "condition": "[parameters('customerManagedKeysEnabled')]"
    }
  ]
}