Closed adisaljusi closed 1 year ago
Can you share your config of the "databricks_metastore_data_access" related part?
HI @TakeshiMatsukura thanks for the heads up, I forgot to include this in the issue. I've updated the issue with the required resources. I'll additionally add them in this comment as well.
resource "azurerm_databricks_access_connector" "unity" {
name = "db-mi-${local.prefix}"
resource_group_name = azurerm_resource_group.lakehouse.name
location = azurerm_resource_group.lakehouse.location
identity {
type = "SystemAssigned"
}
}
resource "databricks_metastore" "primary" {
name = "primary"
storage_root = format("abfss://%s@%s.dfs.core.windows.net/",
azurerm_storage_container.unity_catalog.name,
azurerm_storage_account.adls.name)
force_destroy = true
}
resource "databricks_metastore_data_access" "primary" {
metastore_id = databricks_metastore.primary.id
name = "mi_dac"
azure_managed_identity {
access_connector_id = azurerm_databricks_access_connector.unity.id
}
is_default = true
}
resource "databricks_metastore_assignment" "primary" {
metastore_id = databricks_metastore.primary.id
workspace_id = azurerm_databricks_workspace.lakehouse.workspace_id
default_catalog_name = "hive_metastore"
}
most likely, you're missing the addition of SPN to account. you can do that by:
provider "databricks" {
alias = "account"
account_id = "..."
host = "https://accounts.azuredatabricks.net"
}
resource "databricks_service_principal" "spn_running_apply" {
provider = databricks.account
application_id = "00000000-0000-0000-0000-000000000000" // spn
}
resource "databricks_mws_permission_assignment" "add_admin_group" {
workspace_id = azurerm_databricks_workspace.lakehouse.workspace_id
principal_id = databricks_service_principal.spn_running_apply.id
permissions = ["ADMIN"]
}
@tanmay-db please verify if this works and confirm
Hi @nfx, @adisaljusi databricks_service_principal
resource cannot be used because this requires user to have account admin status and otherwise leads to:
│ Error: cannot create service principal: This API is disabled for users without account admin status. Contact your administrator for more information
Enabling account admin can be done in the accounts console. Please see: Assign account admin rights to a user. Also Manage users, service principals, and groups for information on what action can per performed by user.
After that databricks_metastore_data_access
resource is created successfully. Verified with SPN not having account admin status (leads to - cannot create metastore data access: Only account admins can create Azure Managed Identity Storage Credentials) and with account admin status (leads to successful creation of the resource)
Closing the ticket. Please feel free to reopen.
Hi @tanmay-db ,
Thanks for the explanation! That's correct, we forgot to assign the SPN with the account admin permissions.
Thanks for closing the issue!
Best, Adis
While creating an Unity Catalog, the
databricks_metastore_data_access
fails when applying the plan. The service principal is assigned as an Account Admin on the Azure Databricks access console anddatabricks_metastore
resource was created successfully.Configuration
Expected Behavior
The
databricks_metastore_data_access
resource should be created without errors as thedatabricks_metastore
was successfully created, requiring the same permissions.Actual Behavior
Terraform plan fails with the error: "cannot create metastore data access: Only account admins can create Azure Managed Identity Storage Credentials."
Steps to Reproduce
terraform apply -var-file=variables.tfvars
Terraform and provider versions
Terraform: 1.4.5 hashicorp/azurerm: 3.52.0 databricks/databricks: 1.14.3
Debug Output
╷ │ Error: cannot create metastore data access: Only account admins can create Azure Managed Identity Storage Credentials. │ │ with databricks_metastore_data_access.primary, │ on unity_catalog.tf line 19, in resource "databricks_metastore_data_access" "primary": │ 19: resource "databricks_metastore_data_access" "primary" { │ ╵
Important Factoids