Share via


az policy assignment non-compliance-message

Non-compliance message used by the policy assignment.

Customized message used by the enclosing policy assignment to report non-compliance.

Commands

Name Description Type Status
az policy assignment non-compliance-message create

Create a non-compliance message.

Core GA
az policy assignment non-compliance-message delete

Delete a non-compliance message.

Core GA
az policy assignment non-compliance-message list

Retrieve non-compliance messages.

Core GA
az policy assignment non-compliance-message show

Retrieve a non-compliance message.

Core GA
az policy assignment non-compliance-message update

Update a non-compliance message.

Core GA

az policy assignment non-compliance-message create

Breaking change

The return value will change in a future release of the resource commands. It will be the single created message object rather than the full array of message objects.

Create a non-compliance message.

Create a customized message used to report non-compliance by the policy assignment matching the given name and scope.

az policy assignment non-compliance-message create --message
                                                   --name
                                                   [--policy-definition-reference-id]
                                                   [--resource-group]
                                                   [--scope]

Examples

Add a non-compliance message to a policy assignment

az policy assignment non-compliance-message create -g MyResourceGroup -n MyPolicyAssignment -m 'Resources must follow naming standards'

Add a non-compliance message for a specific policy in an assigned policy set definition

az policy assignment non-compliance-message create -g MyResourceGroup -n MyPolicySetAssignment -m 'Resources must use allowed SKUs' --policy-definition-reference-id SkuPolicyRefId

Required Parameters

--message -m

A custom non-compliance message.

--name -n

The name of the policy assignment.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--policy-definition-reference-id -r

The policy definition reference ID.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--scope

The scope of the policy assignment.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az policy assignment non-compliance-message delete

Breaking change

The return value will change in a future release of the resource commands. It will be empty rather than the full array of remaining message objects.

Delete a non-compliance message.

Delete a non-compliance message from the policy assignment matching the given name and scope.

az policy assignment non-compliance-message delete --message
                                                   --name
                                                   [--policy-definition-reference-id]
                                                   [--resource-group]
                                                   [--scope]

Examples

Remove non-compliance messages from a policy assignment that contain a specific message and no policy definition reference ID

az policy assignment non-compliance-message delete -g MyResourceGroup -n MyPolicyAssignment -m 'Resources must follow naming standards'

Remove non-compliance messages from a policy assignment that contain a specific message and a specific policy definition reference ID

az policy assignment non-compliance-message delete -g MyResourceGroup -n MyPolicySetAssignment -m 'Resources must use allowed SKUs' --policy-definition-reference-id SkuPolicyRefId

Required Parameters

--message -m

A custom non-compliance message.

--name -n

The name of the policy assignment.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--policy-definition-reference-id -r

The policy definition reference ID.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--scope

The scope of the policy assignment.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az policy assignment non-compliance-message list

Retrieve non-compliance messages.

Retrieve all non-compliance messages from the policy assignment matching the given name and scope.

az policy assignment non-compliance-message list --name
                                                 [--resource-group]
                                                 [--scope]

Examples

List the non-compliance messages for a policy assignment

az policy assignment non-compliance-message list -g MyResourceGroup -n MyPolicyAssignment

Required Parameters

--name -n

The name of the policy assignment.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--scope

The scope of the policy assignment.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az policy assignment non-compliance-message show

Retrieve a non-compliance message.

Retrieve and show the details of a non-compliance message belonging to the policy assignment matching the given name and scope.

az policy assignment non-compliance-message show --message
                                                 --name
                                                 [--policy-definition-reference-id]
                                                 [--resource-group]
                                                 [--scope]

Examples

Show the non-compliance message from a policy assignment that contains a specific message and policy definition reference ID

az policy assignment non-compliance-message show -g MyResourceGroup -n MyPolicySetAssignment -m 'Resources must use allowed SKUs' --policy-definition-reference-id SkuPolicyRefId

Required Parameters

--message -m

A custom non-compliance message.

--name -n

The name of the policy assignment.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--policy-definition-reference-id -r

The policy definition reference ID.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--scope

The scope of the policy assignment.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az policy assignment non-compliance-message update

Update a non-compliance message.

Update a non-compliance message belonging to the policy assignment matching the given name and scope.

az policy assignment non-compliance-message update --message
                                                   --name
                                                   [--add]
                                                   [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                                                   [--policy-definition-reference-id]
                                                   [--remove]
                                                   [--resource-group]
                                                   [--scope]
                                                   [--set]

Examples

Update the non-compliance message for a specific policy in an assigned policy set definition

az policy assignment non-compliance-message update -g MyResourceGroup -n MyPolicySetAssignment -m 'Resources may only use SKUs from [preferredSKU, anotherGoodSKU]' --policy-definition-reference-id SkuPolicyRefId

Required Parameters

--message -m

A custom non-compliance message.

--name -n

The name of the policy assignment.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

Property Value
Parameter group: Generic Update Arguments
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

Property Value
Parameter group: Generic Update Arguments
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--policy-definition-reference-id -r

The policy definition reference ID.

--remove

Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove.

Property Value
Parameter group: Generic Update Arguments
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--scope

The scope of the policy assignment.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>.

Property Value
Parameter group: Generic Update Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False