Share via


policy-compliance-for-clusters 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 policy-compliance-for-clusters command group within the Databricks CLI contains commands to view and manage the policy compliance status of clusters in your workspace.

databricks policy-compliance-for-clusters enforce-compliance

Updates a cluster to be compliant with the current version of its policy. A cluster can be updated if it is in a RUNNING or TERMINATED state.

If a cluster is updated while in a RUNNING state, it will be restarted so that the new attributes can take effect.

If a cluster is updated while in a TERMINATED state, it will remain TERMINATED. The next time the cluster is started, the new attributes will take effect.

Clusters created by the Databricks Jobs, DLT, or Models services cannot be enforced by this API. Instead, use the "Enforce job policy compliance" API to enforce policy compliance on jobs.

databricks policy-compliance-for-clusters enforce-compliance CLUSTER_ID [flags]

Arguments

CLUSTER_ID

    The ID of the cluster you want to enforce policy compliance on.

Options

--json JSON

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

--validate-only

    If set, previews the changes that would be made to a cluster to enforce compliance but does not update the cluster.

Global flags

Examples

The following example enforces policy compliance on a cluster:

databricks policy-compliance-for-clusters enforce-compliance 1234-567890-abc123

The following example previews the changes without updating the cluster:

databricks policy-compliance-for-clusters enforce-compliance 1234-567890-abc123 --validate-only

The following example enforces compliance using JSON:

databricks policy-compliance-for-clusters enforce-compliance 1234-567890-abc123 --json '{}'

databricks policy-compliance-for-clusters get-compliance

Returns the policy compliance status of a cluster. Clusters could be out of compliance if their policy was updated after the cluster was last edited.

databricks policy-compliance-for-clusters get-compliance CLUSTER_ID [flags]

Arguments

CLUSTER_ID

    The ID of the cluster to get the compliance status

Options

Global flags

Examples

The following example gets the compliance status of a cluster:

databricks policy-compliance-for-clusters get-compliance 1234-567890-abc123

databricks policy-compliance-for-clusters list-compliance

Returns the policy compliance status of all clusters that use a given policy. Clusters could be out of compliance if their policy was updated after the cluster was last edited.

Important

Running this command concurrently 10 or more times could result in throttling, service degradation, or a temporary ban.

databricks policy-compliance-for-clusters list-compliance POLICY_ID [flags]

Arguments

POLICY_ID

    Canonical unique identifier for the cluster policy.

Options

--page-size int

    Maximum number of results to return per page.

--page-token string

    A page token that can be used to navigate to the next page or previous page as returned by next_page_token or prev_page_token.

Global flags

Examples

The following example lists compliance status for all clusters using a policy:

databricks policy-compliance-for-clusters list-compliance ABC123DEF456

The following example lists compliance with pagination:

databricks policy-compliance-for-clusters list-compliance ABC123DEF456 --page-size 10

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