az policy definition

Manage resource policy definitions.

Commands

az policy definition create Create a policy definition.
az policy definition delete Delete a policy definition.
az policy definition list List policy definitions.
az policy definition show Get a policy definition.
az policy definition update Update a policy definition.

az policy definition create

Create a policy definition.

az policy definition create --name
[--description]
[--display-name]
[--mode {All, Indexed, NotSpecified}]
[--params]
[--rules]

Examples

Create a read-only policy.

az policy definition create -n readOnlyStorage --rules     {         "if":         {             "source": "action",             "equals": "Microsoft.Storage/storageAccounts/write"         },         "then":         {             "effect": "deny"         }     }

Create a policy parameter definition with the following example

{
                            "allowedLocations": {
                                "type": "array",
                                "metadata": {
                                    "description": "The list of locations that can be specified
                                                    when deploying resources",
                                    "strongType": "location",
                                    "displayName": "Allowed locations"
                                }
                            }
                        }

Required Parameters

--name -n
Name of the new policy definition.

Optional Parameters

--description
Description of policy definition.
--display-name
Display name of policy definition.
--mode -m
Mode of the new policy definition.
accepted values: All, Indexed, NotSpecified
--params
JSON formatted string or a path to a file or uri with parameter definitions.
--rules
Policy rules in JSON format, or a path to a file containing JSON rules.

az policy definition delete

Delete a policy definition.

az policy definition delete --name

Required Parameters

--name -n
The policy definition name.

az policy definition list

List policy definitions.

az policy definition list

az policy definition show

Get a policy definition.

az policy definition show --name

Required Parameters

--name -n
The policy definition name.

az policy definition update

Update a policy definition.

az policy definition update --name
[--description]
[--display-name]
[--params]
[--rules]

Required Parameters

--name -n
The policy definition name.

Optional Parameters

--description
Description of policy definition.
--display-name
Display name of policy definition.
--params
JSON formatted string or a path to a file or uri with parameter definitions.
--rules
JSON formatted string or a path to a file or uri with such content.