cancel
Showing results for 
Search instead for 
Did you mean: 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Azure Databricks Account ID

RozaZaharieva
New Contributor

Hi everyone,

Is it possible with Terraform or Azure CLI or any other not manual method to get the value for Azure Databricks Account ID and not to use manual method as is described here - https://learn.microsoft.com/en-us/azure/databricks/administration-guide/account-settings/#--locate-y....

Thank you in advance.

3 REPLIES 3

Kaniz_Fatma
Community Manager
Community Manager

Hi @RozaZaharievaTo retrieve the Azure Databricks Account ID without manual intervention, you can use the following methods:

 
  1. Azure CLI: You can use the Azure CLI to query the account details. Run the following command to get the account ID:

    az databricks workspace show --resource-group <resource-group-name> --name <databricks-workspace-name> --query 'id'
    

    Replace <resource-group-name> and <databricks-workspace-name> with your actual resource group and Databricks workspace names.

  2. Terraform: If you’re managing your infrastructure with Terraform, you can use the azurerm_databricks_workspace resource to retrieve the account ID. Here’s an example snippet:

    data "azurerm_databricks_workspace" "example" {
      name                = "<databricks-workspace-name>"
      resource_group_name = "<resource-group-name>"
    }
    
    output "databricks_account_id" {
      value = data.azurerm_databricks_workspace.example.id
    }
    

    Again, replace <resource-group-name> and <databricks-workspace-name> with your actual values.

  3. Other Methods:

    • You can also use the Databricks CLI with appropriate authentication methods (OAuth, managed identities, etc.) to programmatically retrieve the account ID.
    • If you’re using a custom script or automation, consider using the Databricks REST API to fetch the account details.

Remember to replace the placeholders with your actual resource group and workspace names. These methods allow you to obtain the Azure Databricks Account ID programmatically, avoiding manual steps. 🚀

For more details, refer to the official documentation.1

 

Hi there,

I would prefer the REST API way, but I cannot find any method to fetch the account details. Do you know which one I should use?

Thank you.

SHeisterkamp
New Contributor II

I am also looking for a solution to this. The path suggested by @Kaniz_Fatma does not work! When I run the proposed az cli, this is what I get:

```

$> az databricks workspace show --resource-group $my_rg --name $my_ws --query 'id'

"/subscriptions/64e..<my_tenant_id>/resourceGroups/<my_rg>/providers/Microsoft.Databricks/workspaces/<my_ws>"

```

This is not the account ID that is needed for the account API. So this is not a solution. Since terraform and REST API are directly aligned with the cli, the result is the same. So at present there is no solution to this. Unless anyone has any other suggestions?

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!