- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 05:10 AM
Dear @Pat Sienkiewicz , works perfectly! It would be so easy it the documentation would be better... Rg Adrian

