cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Service Principal and Grants in Databricks

jv_v
Contributor

 

Hi,

We created a service principal in Databricks as per the documentation here.

However, when we execute the following SQL query, we are unable to see the service principal:

 
SHOW GRANTS testservice ON METASTORE

error:
[RequestId=564cbcf9-e8b7-476d-a4db-96e6dccb87ad ErrorClass=PRINCIPAL_DOES_NOT_EXIST] Could not find principal with name testservice

We believe this might be the reason why we are unable to create an external location and also unable to grant the "CREATE EXTERNAL LOCATION" permission using the following Terraform code:

resource "databricks_grants" "grant" {

depends_on = [databricks_metastore.this]

  metastore = "databricks_metastore.this.id"

  grant {

    principal = "testservice"

    privileges = ["CREATE_EXTERNAL_LOCATION","CREATE_CATALOG"]

  }

}



// Task011 Create external location to be used as root storage by dev catalog

resource "databricks_external_location" "dev_location" {

  provider = databricks.Workspace

  name = var.external_location_name

  #url="abfss://strgconr@demorkstrgac.dfs.core.windows.net"

  url = format("abfss://%s@%s.dfs.core.windows.net/",azurerm_storage_container.dev_catalog.name,

  module.metastore_and_users.azurerm_storage_account_unity_catalog.name)

  credential_name = databricks_storage_credential.external_mi.id

  owner           = var.owner

  comment         = "External location used by dev catalog as root storage"

}

error: cannot create grants: metastore_id must be empty or equal to the metastore id assigned to the workspace.

Can you help us understand why the service principal is not appearing in the query results and how we can resolve this issue to create an external location and grant the necessary permissions?

0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group