Azure Databricks CLI Script for Workspace and Cluster Configuration
Here's an example Azure Databricks CLI script that configures a workspace and creates a cluster:
# Replace these values with your own
export DATABRICKS_HOST="https://<your-workspace>.azuredatabricks.net"
export DATABRICKS_TOKEN="<your-access-token>"
# Set the desired runtime version (e.g., 10.4 LTS)
DATABRICKS_RUNTIME_VERSION="10.4-LTS"
# Define the cluster configuration
CLUSTER_NAME="MySampleCluster"
CLUSTER_NODE_TYPE="Standard_DS3_v3"
CLUSTER_NUM_WORKERS=3
# Create the cluster
databricks clusters create \
--cluster-name "${CLUSTER_NAME}" \
--num-workers "${CLUSTER_NUM_WORKERS}" \
--node-type "${CLUSTER_NODE_TYPE}" \
--spark-version "${DATABRICKS_RUNTIME_VERSION}"
# Wait for the cluster to start
while [ "$(databricks clusters get --cluster-name ${CLUSTER_NAME} --json | jq -r '.state')" != "RUNNING" ]; do
sleep 10
done
echo "Cluster '${CLUSTER_NAME}' is now running."
Explanation:
databricks clusters create
command is used to create the cluster with the specified configuration.Additional options:
Remember to update the script with your specific values and customize it as needed for your desired cluster configuration.
Note: This example uses Linux commands. If you're working on Windows, adapt the syntax accordingly.