Share via


tag-policies command group

Note

This information applies to Databricks CLI versions 0.205 and above. The Databricks CLI is in Public Preview.

Databricks CLI use is subject to the Databricks License and Databricks Privacy Notice, including any Usage Data provisions.

The tag-policies command group within the Databricks CLI contains commands to manage policies for governed tags in Databricks. See Governed tags.

databricks tag-policies create-tag-policy

Create a new tag policy, making the associated tag key governed.

databricks tag-policies create-tag-policy TAG_KEY [flags]

Arguments

TAG_KEY

    The tag key for which to create a policy.

Options

--description string

    Description of the tag policy.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body

Global flags

Examples

The following example creates a tag policy for a tag key:

databricks tag-policies create-tag-policy environment --description "Policy for environment tags"

The following example creates a tag policy using JSON:

databricks tag-policies create-tag-policy department --json '{"description": "Policy for department classification", "allowed_values": ["engineering", "sales", "marketing"]}'

The following example creates a tag policy using a JSON file:

databricks tag-policies create-tag-policy compliance --json @tag-policy.json

databricks tag-policies delete-tag-policy

Delete a tag policy by its associated governed tag's key, leaving that tag key ungoverned.

databricks tag-policies delete-tag-policy TAG_KEY [flags]

Arguments

TAG_KEY

    The tag key for which to delete the policy.

Options

Global flags

Examples

The following example deletes a tag policy:

databricks tag-policies delete-tag-policy environment

databricks tag-policies get-tag-policy

Get a single tag policy by its associated governed tag's key.

databricks tag-policies get-tag-policy TAG_KEY [flags]

Arguments

TAG_KEY

    The tag key for which to retrieve the policy.

Options

Global flags

Examples

The following example gets a tag policy:

databricks tag-policies get-tag-policy environment

databricks tag-policies list-tag-policies

List the tag policies for all governed tags in the account.

databricks tag-policies list-tag-policies [flags]

Options

--page-size int

    Maximum number of tag policies to return per page.

--page-token string

    Token to retrieve the next page of results.

Global flags

Examples

The following example lists all tag policies:

databricks tag-policies list-tag-policies

The following example lists tag policies with pagination:

databricks tag-policies list-tag-policies --page-size 10

databricks tag-policies update-tag-policy

Update an existing tag policy for a single governed tag.

databricks tag-policies update-tag-policy TAG_KEY UPDATE_MASK [flags]

Arguments

TAG_KEY

    The tag key for which to update the policy.

UPDATE_MASK

    The field mask must be a single string, with multiple fields separated by commas (no spaces). The field path is relative to the resource object, using a dot (.) to navigate sub-fields (e.g., author.given_name). Specification of elements in sequence or map fields is not allowed, as only the entire collection field can be specified. Field names must exactly match the resource field names.

    An asterisk (*) field mask indicates full replacement. It's recommended to always explicitly list the fields being updated and avoid using wildcards, as it can lead to unintended results if the API changes in the future.

Options

--description string

    Description of the tag policy.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body

Global flags

Examples

The following example updates a tag policy's description:

databricks tag-policies update-tag-policy environment "description" --description "Updated policy for environment tags"

The following example updates a tag policy using JSON:

databricks tag-policies update-tag-policy department "allowed_values" --json '{"allowed_values": ["engineering", "sales", "marketing", "operations"]}'

The following example updates a tag policy using a JSON file:

databricks tag-policies update-tag-policy compliance "description,allowed_values" --json @updated-policy.json

Global flags

--debug

  Whether to enable debug logging.

-h or --help

    Display help for the Databricks CLI or the related command group or the related command.

--log-file string

    A string representing the file to write output logs to. If this flag is not specified then the default is to write output logs to stderr.

--log-format format

    The log format type, text or json. The default value is text.

--log-level string

    A string representing the log format level. If not specified then the log format level is disabled.

-o, --output type

    The command output type, text or json. The default value is text.

-p, --profile string

    The name of the profile in the ~/.databrickscfg file to use to run the command. If this flag is not specified then if it exists, the profile named DEFAULT is used.

--progress-format format

    The format to display progress logs: default, append, inplace, or json

-t, --target string

    If applicable, the bundle target to use