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