az policy remediation

Manage resource policy remediations.

Commands

az policy remediation cancel

Cancel a resource policy remediation.

az policy remediation create

Create a resource policy remediation.

az policy remediation delete

Delete a resource policy remediation.

az policy remediation deployment

Manage resource policy remediation deployments.

az policy remediation deployment list

Lists deployments for a resource policy remediation.

az policy remediation list

List resource policy remediations.

az policy remediation show

Show a resource policy remediation.

az policy remediation cancel

Cancel a resource policy remediation.

az policy remediation cancel --name
                             [--management-group]
                             [--namespace]
                             [--parent]
                             [--resource]
                             [--resource-group]
                             [--resource-type]
                             [--subscription]

Required Parameters

--name -n

Name of the remediation.

Optional Parameters

--management-group -m

Name of management group.

--namespace

Provider namespace (Ex: Microsoft.Provider).

--parent

The parent path (Ex: resourceTypeA/nameA/resourceTypeB/nameB).

--resource

Resource ID or resource name. If a name is given, please provide the resource group and other relevant resource id arguments.

--resource-group -g

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

--resource-type

Resource type (Ex: resourceTypeC).

--subscription

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

az policy remediation create

Create a resource policy remediation.

az policy remediation create --name
                             --policy-assignment
                             [--definition-reference-id]
                             [--location-filters]
                             [--management-group]
                             [--namespace]
                             [--parent]
                             [--resource]
                             [--resource-discovery-mode {ExistingNonCompliant, ReEvaluateCompliance}]
                             [--resource-group]
                             [--resource-type]
                             [--subscription]

Examples

Create a remediation at resource group scope for a policy assignment

az policy remediation create -g myRg -n myRemediation --policy-assignment eeb18edc813c42d0ad5a9eab

Create a remediation at resource group scope for a policy assignment using the policy assignment resource ID

az policy remediation create -g myRg -n myRemediation --policy-assignment "/subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.Authorization/policyAssignments/myPa"

Create a remediation at subscription scope for a policy set assignment

az policy remediation create -n myRemediation --policy-assignment eeb18edc813c42d0ad5a9eab --definition-reference-id auditVMPolicyReference

Create a remediation at management group scope for specific resource locations

az policy remediation create -m myMg -n myRemediation --policy-assignment eeb18edc813c42d0ad5a9eab --location-filters eastus westeurope

Create a remediation for a specific resource using the resource ID

az policy remediation create --resource "/subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/myVm" -n myRemediation --policy-assignment eeb18edc813c42d0ad5a9eab

Create a remediation that will re-evaluate compliance before remediating

az policy remediation create -g myRg -n myRemediation --policy-assignment eeb18edc813c42d0ad5a9eab --resource-discovery-mode ReEvaluateCompliance

Required Parameters

--name -n

Name of the remediation.

--policy-assignment -a

Name or resource ID of the policy assignment.

Optional Parameters

--definition-reference-id

Policy definition reference ID inside the policy set definition. Only required when the policy assignment is assigning a policy set definition.

--location-filters

Space separated list of resource locations that should be remediated (Ex: centralus westeurope).

--management-group -m

Name of management group.

--namespace

Provider namespace (Ex: Microsoft.Provider).

--parent

The parent path (Ex: resourceTypeA/nameA/resourceTypeB/nameB).

--resource

Resource ID or resource name. If a name is given, please provide the resource group and other relevant resource id arguments.

--resource-discovery-mode

The way resources to remediate are discovered. Defaults to ExistingNonCompliant if not specified.

accepted values: ExistingNonCompliant, ReEvaluateCompliance
--resource-group -g

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

--resource-type

Resource type (Ex: resourceTypeC).

--subscription

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

az policy remediation delete

Delete a resource policy remediation.

az policy remediation delete --name
                             [--management-group]
                             [--namespace]
                             [--parent]
                             [--resource]
                             [--resource-group]
                             [--resource-type]
                             [--subscription]

Required Parameters

--name -n

Name of the remediation.

Optional Parameters

--management-group -m

Name of management group.

--namespace

Provider namespace (Ex: Microsoft.Provider).

--parent

The parent path (Ex: resourceTypeA/nameA/resourceTypeB/nameB).

--resource

Resource ID or resource name. If a name is given, please provide the resource group and other relevant resource id arguments.

--resource-group -g

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

--resource-type

Resource type (Ex: resourceTypeC).

--subscription

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

az policy remediation list

List resource policy remediations.

az policy remediation list [--management-group]
                           [--namespace]
                           [--parent]
                           [--query-examples]
                           [--resource]
                           [--resource-group]
                           [--resource-type]
                           [--subscription]

Optional Parameters

--management-group -m

Name of management group.

--namespace

Provider namespace (Ex: Microsoft.Provider).

--parent

The parent path (Ex: resourceTypeA/nameA/resourceTypeB/nameB).

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource

Resource ID or resource name. If a name is given, please provide the resource group and other relevant resource id arguments.

--resource-group -g

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

--resource-type

Resource type (Ex: resourceTypeC).

--subscription

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

az policy remediation show

Show a resource policy remediation.

az policy remediation show --name
                           [--management-group]
                           [--namespace]
                           [--parent]
                           [--query-examples]
                           [--resource]
                           [--resource-group]
                           [--resource-type]
                           [--subscription]

Required Parameters

--name -n

Name of the remediation.

Optional Parameters

--management-group -m

Name of management group.

--namespace

Provider namespace (Ex: Microsoft.Provider).

--parent

The parent path (Ex: resourceTypeA/nameA/resourceTypeB/nameB).

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource

Resource ID or resource name. If a name is given, please provide the resource group and other relevant resource id arguments.

--resource-group -g

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

--resource-type

Resource type (Ex: resourceTypeC).

--subscription

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