azure-databricks

In azure databricks how to remove automatically tag


In Azure Databrick, I open my workspace > Compute. Under "Tags" section I see the existing tags in below screenshot. They are all readonly. I am able to add new tags but unable to edit or remove existing tags. For example, I try to add a new key "ProjectName" it is not allowed because it is conflicting with existing tag.

Could you guide me how to remove an existing tag?

enter image description here


Solution

  • You need to use the API to manage the tags:

    First, you need to list the existing tags to identify the tag you want to remove. You can do this by retrieving the cluster information. Use the Clusters API to update the cluster configuration by removing the specific tag.

    List the existing tags to make a GET request to retrieve the cluster information:

    curl -X GET \
      -H "Authorization: Bearer <your-access-token>" \
      https://<databricks-instance>/api/2.0/clusters/get?cluster_id=<your-cluster-id>
    

    Update the cluster configuration to make a POST request to update the cluster configuration by removing the specific tag:

    curl -X POST \
      -H "Authorization: Bearer <your-access-token>" \
      -H "Content-Type: application/json" \
      -d '{
        "cluster_id": "<your-cluster-id>",
        "custom_tags": {
          "ProjectName": null
        }
      }' \
      https://<databricks-instance>/api/2.0/clusters/edit
    

    Reference: Update cluster configuration

    Unable to edit/add custom-tags via the Azure DataBricks /clusters REST API