โ11-04-2022 09:35 AM
Dear Community,
In the GUI I can grant the admin role to a service principal with a simple switch.
How can I achive the same in Terraform? Do you have some code examples?
โ11-06-2022 01:15 PM
Hi @Adrian Wyssโ ,
to create SP with `account admin` role, please use the following:
resource "databricks_service_principal" "this" {
provider = databricks.mws
display_name = "some-name"
}
# assign account_admin role
resource "databricks_service_principal_role" "this" {
provider = databricks.mws
service_principal_id = databricks_service_principal.this.id
role = "account_admin"
}
thanks,
Pat.
โ11-06-2022 01:15 PM
Hi @Adrian Wyssโ ,
to create SP with `account admin` role, please use the following:
resource "databricks_service_principal" "this" {
provider = databricks.mws
display_name = "some-name"
}
# assign account_admin role
resource "databricks_service_principal_role" "this" {
provider = databricks.mws
service_principal_id = databricks_service_principal.this.id
role = "account_admin"
}
thanks,
Pat.
โ07-18-2023 07:24 AM - edited โ07-24-2023 01:40 AM
Hey @Pat,
unfortunately I get following error
Error: cannot read service principal role: Service Principal has no role
from Terraform resource "databricks_service_principal_role" when using your approach from above.
Do you have any idea?
โ11-08-2022 05:10 AM
Dear @Pat Sienkiewiczโ , works perfectly! It would be so easy it the documentation would be better... Rg Adrian
โ11-09-2022 08:26 AM
Hi @Adrian Wyssโโ, It would mean a lot if you could select the "Best Answer" to help others find the correct answer faster.
This makes that answer appear right after the question, so it's easier to find within a thread.
It also helps us mark the question as answered so we can have more eyes helping others with unanswered questions.
Can I count on you?
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