Skip to content

Modify

SYNOPSIS

The modify effect: what to change on a non-compliant resource. Use it instead of Effect.

SYNTAX

Modify [[-Body] <ScriptBlock>] [-Role <String[]>] [-ConflictEffect <String>] [-Effect <Object>] [<CommonParameters>]

USED IN

Policy

EXAMPLES

Example 1

Modify -Role 'Tag Contributor' {
    Tag Environment | AddOrReplace 'Production'
    Tag CostCenter | Add (ResourceGroupTag CostCenter)
    Tag TempResource | Remove
}

PARAMETERS

-Body

The operations.

Type: ScriptBlock
Required: false
Position: 1
Accept pipeline input: false

-Role

Roles the assignment's managed identity needs: built-in role names, GUIDs or full role definition IDs (ADR-0022).

Type: String[]
Required: false
Position: named
Accept pipeline input: false

-ConflictEffect

What happens when another policy modifies the same field, or the field can't be modified: Audit, Deny (Azure's default) or Disabled.

Type: String
Required: false
Position: named
Accept pipeline input: false

-Effect

The effect as a parameter, (Param Effect). Without it, the effect is Modify.

Type: Object
Required: false
Position: named
Accept pipeline input: false