<?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 Re: Add a tag to a catalog with REST API in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/add-a-tag-to-a-catalog-with-rest-api/m-p/128477#M3868</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A class="" href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502" target="_self"&gt;&lt;SPAN class=""&gt;szymon_dybczak&lt;/SPAN&gt;&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;I have solved it with the "/api/2.0/sql/statements/" REST API&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;param(

    [Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$false)] [System.String] $FullDatabricksName,
    [Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$false)] [System.String] $ResourceGroupName
)

Function DatabricksConfig
{
    param(
            [string]$Method,
            [string]$API,
            [string]$Body = "",
            [string]$FullDatabricksName,
            [boolean]$AccountConsole = $false
        )

    If ($AccountConsole -eq $true)
    {
        $Url = $Url = "https://accounts.azuredatabricks.net"+$API
    }
    Else
    {
        $Databricks_Workspace_Url = (Get-AzDatabricksWorkspace -Name $FullDatabricksName -ResourceGroupName $ResourceGroupName).Url
        $Url = "https://"+$Databricks_Workspace_Url+$API
    }

    #Authentication header
    $azureApiToken = (ConvertFrom-SecureString (Get-AzAccessToken -Resource "2ff814a6-3304-4ab8-85cb-cd0e6f879c1d" -AsSecureString).Token -AsPlainText)# "2ff814a6-3304-4ab8-85cb-cd0e6f879c1d" represents the programmatic ID for Azure Databricks along with the default scope (/.default, URL-encoded as %2f.default).
    
    $authHeader = @{
        "Authorization"="Bearer " + "$azureApiToken";
        "Content-Type"="application/json";
    }

    If ($Body -eq "")
    {
        $Result = Invoke-RestMethod -Method $Method -Uri $Url -Headers $authHeader -ErrorAction SilentlyContinue
    }
    Else
    {
        $Result = Invoke-RestMethod -Method $Method -Uri $Url -Headers $authHeader -Body $Body -ErrorAction SilentlyContinue
    }
    Return $Result
}

$WarehouseId = ((DatabricksConfig -Method "Get" -API "/api/2.0/sql/warehouses" -FullDatabricksName $FullDatabricksName).warehouses | Where-Object name -eq "Serverless Starter Warehouse").id

$Body = Get-Content "./GetCatalogProps/SQL.json" | ConvertFrom-JSON
$Body.statement = "ALTER CATALOG curated SET TAGS ('tag1' = 'val1');"
$Body.warehouse_id = $WarehouseId
$Body = $Body | ConvertTo-JSON

DatabricksConfig -Body $Body -Method "Post" -API "/api/2.0/sql/statements/" -FullDatabricksName $FullDatabricksName&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Marco&lt;/P&gt;</description>
    <pubDate>Thu, 14 Aug 2025 15:31:20 GMT</pubDate>
    <dc:creator>Marco37</dc:creator>
    <dc:date>2025-08-14T15:31:20Z</dc:date>
    <item>
      <title>Add a tag to a catalog with REST API</title>
      <link>https://community.databricks.com/t5/administration-architecture/add-a-tag-to-a-catalog-with-rest-api/m-p/128459#M3864</link>
      <description>&lt;P&gt;Goodday,&lt;/P&gt;&lt;P&gt;I have an Azure DevOps pipeline with which I provision our Databricks workspaces. With this pipeline I also create the catalogs through the Databricks API (/api/2.1/unity-catalog/catalogs).&lt;BR /&gt;&lt;A href="https://docs.databricks.com/api/azure/workspace/catalogs/create" target="_blank"&gt;Create a catalog | Catalogs API | REST API reference | Azure Databricks&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I also want to add a tag to the catalog, but i cannot figure out how to do this through this or another REST API.&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Marco37_0-1755176222089.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19094i5364102CE35C61B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Marco37_0-1755176222089.png" alt="Marco37_0-1755176222089.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;BR /&gt;Marco&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 13:00:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/add-a-tag-to-a-catalog-with-rest-api/m-p/128459#M3864</guid>
      <dc:creator>Marco37</dc:creator>
      <dc:date>2025-08-14T13:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Add a tag to a catalog with REST API</title>
      <link>https://community.databricks.com/t5/administration-architecture/add-a-tag-to-a-catalog-with-rest-api/m-p/128470#M3866</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/114724"&gt;@Marco37&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Unfortunately, I believe this is not currently possible through REST API. The only options you have are via UI or using SQL.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, it's also no possible to do this using terraform. There's a PR that is hanging from some time, but still no progress.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/databricks/terraform-provider-databricks/pull/3268" target="_blank"&gt;https://github.com/databricks/terraform-provider-databricks/pull/3268&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 13:35:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/add-a-tag-to-a-catalog-with-rest-api/m-p/128470#M3866</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-14T13:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Add a tag to a catalog with REST API</title>
      <link>https://community.databricks.com/t5/administration-architecture/add-a-tag-to-a-catalog-with-rest-api/m-p/128477#M3868</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A class="" href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502" target="_self"&gt;&lt;SPAN class=""&gt;szymon_dybczak&lt;/SPAN&gt;&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;I have solved it with the "/api/2.0/sql/statements/" REST API&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;param(

    [Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$false)] [System.String] $FullDatabricksName,
    [Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$false)] [System.String] $ResourceGroupName
)

Function DatabricksConfig
{
    param(
            [string]$Method,
            [string]$API,
            [string]$Body = "",
            [string]$FullDatabricksName,
            [boolean]$AccountConsole = $false
        )

    If ($AccountConsole -eq $true)
    {
        $Url = $Url = "https://accounts.azuredatabricks.net"+$API
    }
    Else
    {
        $Databricks_Workspace_Url = (Get-AzDatabricksWorkspace -Name $FullDatabricksName -ResourceGroupName $ResourceGroupName).Url
        $Url = "https://"+$Databricks_Workspace_Url+$API
    }

    #Authentication header
    $azureApiToken = (ConvertFrom-SecureString (Get-AzAccessToken -Resource "2ff814a6-3304-4ab8-85cb-cd0e6f879c1d" -AsSecureString).Token -AsPlainText)# "2ff814a6-3304-4ab8-85cb-cd0e6f879c1d" represents the programmatic ID for Azure Databricks along with the default scope (/.default, URL-encoded as %2f.default).
    
    $authHeader = @{
        "Authorization"="Bearer " + "$azureApiToken";
        "Content-Type"="application/json";
    }

    If ($Body -eq "")
    {
        $Result = Invoke-RestMethod -Method $Method -Uri $Url -Headers $authHeader -ErrorAction SilentlyContinue
    }
    Else
    {
        $Result = Invoke-RestMethod -Method $Method -Uri $Url -Headers $authHeader -Body $Body -ErrorAction SilentlyContinue
    }
    Return $Result
}

$WarehouseId = ((DatabricksConfig -Method "Get" -API "/api/2.0/sql/warehouses" -FullDatabricksName $FullDatabricksName).warehouses | Where-Object name -eq "Serverless Starter Warehouse").id

$Body = Get-Content "./GetCatalogProps/SQL.json" | ConvertFrom-JSON
$Body.statement = "ALTER CATALOG curated SET TAGS ('tag1' = 'val1');"
$Body.warehouse_id = $WarehouseId
$Body = $Body | ConvertTo-JSON

DatabricksConfig -Body $Body -Method "Post" -API "/api/2.0/sql/statements/" -FullDatabricksName $FullDatabricksName&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Marco&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 15:31:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/add-a-tag-to-a-catalog-with-rest-api/m-p/128477#M3868</guid>
      <dc:creator>Marco37</dc:creator>
      <dc:date>2025-08-14T15:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Add a tag to a catalog with REST API</title>
      <link>https://community.databricks.com/t5/administration-architecture/add-a-tag-to-a-catalog-with-rest-api/m-p/128482#M3869</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/114724"&gt;@Marco37&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for sharing solution. Could you mark your solution as a best answer? This helps others with similar question find correct answer faster.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 16:43:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/add-a-tag-to-a-catalog-with-rest-api/m-p/128482#M3869</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-14T16:43:37Z</dc:date>
    </item>
  </channel>
</rss>

