<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Can't set account admin using Terraform in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/can-t-set-account-admin-using-terraform/m-p/38371#M266</link>
    <description>&lt;P&gt;I want to set the account admin for a service principal in order to create the Unity Catalog metastore. The Terraform code looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data "databricks_service_principal" "application" {
  count = var.environment == "dev" ? 1 : 0

  application_id = "00000000-0000-0000-0000-000000000000"
}

resource "databricks_service_principal_role" "account_admin" {
  count = var.environment == "dev" ? 1 : 0

  service_principal_id = data.databricks_service_principal.application[0].id
  role                 = "account_admin"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;This should theoretically work according to the answers in &lt;A href="https://community.databricks.com/t5/data-engineering/creating-a-service-principal-with-admin-role-on-account-level-in/m-p/23631" target="_blank" rel="noopener"&gt;this thread&lt;/A&gt;.&lt;/P&gt;&lt;P data-unlink="true"&gt;But unfortunately I get following error from Terraform for the resource "databricks_service_principal_role": &lt;FONT color="#FF0000"&gt;Error: cannot read service principal role: Service Principal has no role&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;For me this error message is not very useful and I don't know what is wrong here. Is this maybe a bug in the Databricks Terraform provider?&lt;/P&gt;&lt;P&gt;Site notes (if relevant):&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I'm using the newest Databricks Terraform provider (V 1.21)&lt;/LI&gt;&lt;LI&gt;The Databricks workspace is deployed in Azure.&lt;/LI&gt;&lt;LI&gt;Using the "databrick_user_role" resource and trying to assign the account_admin role to a Databricks user will produce the same error message: &lt;FONT color="#FF0000"&gt;User has no role&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Looking at the &lt;A href="https://github.com/databricks/terraform-provider-databricks/blob/master/aws/resource_service_principal_role.go" target="_blank" rel="noopener"&gt;source code on GitHub&lt;/A&gt;&amp;nbsp;(Databricks Terraform provider) I found the error message from above but I don't understand why the "ReadContext" section in there is even executed.&lt;/P&gt;&lt;P&gt;It would be really nice if someone can help me, as I have to enable the Unity Catalog metastore very soon &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2023 12:14:30 GMT</pubDate>
    <dc:creator>niklas</dc:creator>
    <dc:date>2023-07-25T12:14:30Z</dc:date>
    <item>
      <title>Can't set account admin using Terraform</title>
      <link>https://community.databricks.com/t5/administration-architecture/can-t-set-account-admin-using-terraform/m-p/38371#M266</link>
      <description>&lt;P&gt;I want to set the account admin for a service principal in order to create the Unity Catalog metastore. The Terraform code looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data "databricks_service_principal" "application" {
  count = var.environment == "dev" ? 1 : 0

  application_id = "00000000-0000-0000-0000-000000000000"
}

resource "databricks_service_principal_role" "account_admin" {
  count = var.environment == "dev" ? 1 : 0

  service_principal_id = data.databricks_service_principal.application[0].id
  role                 = "account_admin"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;This should theoretically work according to the answers in &lt;A href="https://community.databricks.com/t5/data-engineering/creating-a-service-principal-with-admin-role-on-account-level-in/m-p/23631" target="_blank" rel="noopener"&gt;this thread&lt;/A&gt;.&lt;/P&gt;&lt;P data-unlink="true"&gt;But unfortunately I get following error from Terraform for the resource "databricks_service_principal_role": &lt;FONT color="#FF0000"&gt;Error: cannot read service principal role: Service Principal has no role&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;For me this error message is not very useful and I don't know what is wrong here. Is this maybe a bug in the Databricks Terraform provider?&lt;/P&gt;&lt;P&gt;Site notes (if relevant):&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I'm using the newest Databricks Terraform provider (V 1.21)&lt;/LI&gt;&lt;LI&gt;The Databricks workspace is deployed in Azure.&lt;/LI&gt;&lt;LI&gt;Using the "databrick_user_role" resource and trying to assign the account_admin role to a Databricks user will produce the same error message: &lt;FONT color="#FF0000"&gt;User has no role&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Looking at the &lt;A href="https://github.com/databricks/terraform-provider-databricks/blob/master/aws/resource_service_principal_role.go" target="_blank" rel="noopener"&gt;source code on GitHub&lt;/A&gt;&amp;nbsp;(Databricks Terraform provider) I found the error message from above but I don't understand why the "ReadContext" section in there is even executed.&lt;/P&gt;&lt;P&gt;It would be really nice if someone can help me, as I have to enable the Unity Catalog metastore very soon &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 12:14:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/can-t-set-account-admin-using-terraform/m-p/38371#M266</guid>
      <dc:creator>niklas</dc:creator>
      <dc:date>2023-07-25T12:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can't set account admin using Terraform</title>
      <link>https://community.databricks.com/t5/administration-architecture/can-t-set-account-admin-using-terraform/m-p/38504#M271</link>
      <description>&lt;P&gt;Hi Kaniz, thank you very much for your reply!&lt;BR /&gt;Here is the solution to the problem from above:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/76762299/cant-set-databricks-account-admin-using-terraform/76763140?noredirect=1#comment135335112_76763140" target="_blank"&gt;https://stackoverflow.com/questions/76762299/cant-set-databricks-account-admin-using-terraform/76763140?noredirect=1#comment135335112_76763140&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 14:30:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/can-t-set-account-admin-using-terraform/m-p/38504#M271</guid>
      <dc:creator>niklas</dc:creator>
      <dc:date>2023-07-26T14:30:06Z</dc:date>
    </item>
  </channel>
</rss>

