01 Run account list command (Windows/macOS/Linux) with custom output filters to list the IDs of the cloud subscriptions available in your Azure cloud account:
az account list \
--query '[].{id:id, name:name}'
02 The command output should return the requested subscription identifiers (IDs) and names:
[
{
"id": "abcdabcd-1234-abcd-1234-abcdabcdabcd",
"name": "Production Subscription"
},
{
"id": "abcd1234-abcd-1234-abcd-abcd1234abcd",
"name": "Development Subscription"
}
]
03 Run account set command (Windows/macOS/Linux) with the ID of the Azure cloud subscription that you want to access as the identifier parameter to set the selected subscription to be the current active subscription (the command does not produce an output):
az account set \
--subscription abcdabcd-1234-abcd-1234-abcdabcdabcd
04 Run databricks workspace list command (Windows/macOS/Linux) with custom output filters to list the resource ID of each Azure Databricks workspace available in the selected Azure subscription:
az databricks workspace list \
--query '[*].id'
05 The command output should return the requested Databricks workspace resource IDs:
[
"/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Databricks/workspaces/cc-project9-data-workspace",
"/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Databricks/workspaces/cc-prod-databricks-workspace"
]
06 Run monitor diagnostic-settings create command (Windows/macOS/Linux) to enable diagnostic logging for your Azure Databricks workspace. Use the resource ID from step 5 and specify at least one destination (Log Analytics workspace, storage account, or event hub):
Option 1: Send logs to Log Analytics workspace:
az monitor diagnostic-settings create \
--name "DatabricksLogging" \
--resource "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Databricks/workspaces/cc-project9-data-workspace" \
--logs '[{"category": "accounts", "enabled": true}, {"category": "clusters", "enabled": true}, {"category": "notebook", "enabled": true}, {"category": "jobs", "enabled": true}, {"category": "dbfs", "enabled": true}]' \
--workspace "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.OperationalInsights/workspaces/cc-log-analytics-workspace"
Option 2: Archive logs to storage account:
az monitor diagnostic-settings create \
--name "DatabricksLogging" \
--resource "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Databricks/workspaces/cc-project9-data-workspace" \
--logs '[{"category": "accounts", "enabled": true}, {"category": "clusters", "enabled": true}, {"category": "notebook", "enabled": true}, {"category": "jobs", "enabled": true}, {"category": "dbfs", "enabled": true}]' \
--storage-account "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Storage/storageAccounts/cc-databricks-logs-storage"
Option 3: Stream logs to event hub:
az monitor diagnostic-settings create \
--name "DatabricksLogging" \
--resource "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Databricks/workspaces/cc-project9-data-workspace" \
--logs '[{"category": "accounts", "enabled": true}, {"category": "clusters", "enabled": true}, {"category": "notebook", "enabled": true}, {"category": "jobs", "enabled": true}, {"category": "dbfs", "enabled": true}]' \
--event-hub-rule "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.EventHub/namespaces/cc-event-hub-namespace/authorizationrules/RootManageSharedAccessKey"
Note: Replace the resource IDs with your actual Databricks workspace and destination resource IDs. You can combine multiple destinations by including multiple parameters (e.g., both
--workspace and
--storage-account).
07 Repeat steps no. 4 - 6 for each Azure Databricks workspace that you want to configure, available in the selected subscription.
08 Repeat steps no. 3 – 7 for each Azure subscription created in your Microsoft Azure cloud account.