Edit

Share via


Update-AzPolicySetDefinition

This operation updates an existing policy set definition in the given subscription or management group with the given name.

Syntax

Name (Default)

Update-AzPolicySetDefinition
    -Name <String>
    [-DisplayName <String>]
    [-Description <String>]
    [-PolicyDefinition <String>]
    [-Metadata <String>]
    [-Parameter <String>]
    [-PolicyDefinitionGroup <String>]
    [-BackwardCompatible]
    [-DefaultProfile <PSObject>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ManagementGroupName

Update-AzPolicySetDefinition
    -Name <String>
    -ManagementGroupName <String>
    [-DisplayName <String>]
    [-Description <String>]
    [-PolicyDefinition <String>]
    [-Metadata <String>]
    [-Parameter <String>]
    [-PolicyDefinitionGroup <String>]
    [-BackwardCompatible]
    [-DefaultProfile <PSObject>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SubscriptionId

Update-AzPolicySetDefinition
    -Name <String>
    -SubscriptionId <String>
    [-DisplayName <String>]
    [-Description <String>]
    [-PolicyDefinition <String>]
    [-Metadata <String>]
    [-Parameter <String>]
    [-PolicyDefinitionGroup <String>]
    [-BackwardCompatible]
    [-DefaultProfile <PSObject>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Id

Update-AzPolicySetDefinition
    -Id <String>
    [-DisplayName <String>]
    [-Description <String>]
    [-PolicyDefinition <String>]
    [-Metadata <String>]
    [-Parameter <String>]
    [-PolicyDefinitionGroup <String>]
    [-BackwardCompatible]
    [-DefaultProfile <PSObject>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

InputObject

Update-AzPolicySetDefinition
    -InputObject <IPolicySetDefinition>
    [-DisplayName <String>]
    [-Description <String>]
    [-PolicyDefinition <String>]
    [-Metadata <String>]
    [-Parameter <String>]
    [-PolicyDefinitionGroup <String>]
    [-BackwardCompatible]
    [-DefaultProfile <PSObject>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

This operation updates an existing policy set definition in the given subscription or management group with the given name.

Examples

Example 1: Update the description of a policy set definition

$PolicySetDefinition = Get-AzPolicySetDefinition -Id '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition'
Update-AzPolicySetDefinition -Id $PolicySetDefinition.Id -Description 'Updated policy to not allow virtual machine creation'

The first command gets a policy set definition by using the Get-AzPolicySetDefinition cmdlet. The command stores that object in the $PolicySetDefinition variable. The second command updates the description of the policy set definition identified by the Id property of $PolicySetDefinition.

Example 2: Update the metadata of a policy set definition

Update-AzPolicySetDefinition -Name 'VMPolicySetDefinition' -Metadata '{"category":"Virtual Machine"}'

This command updates the metadata of a policy set definition named VMPolicySetDefinition to indicate its category is "Virtual Machine".

Example 3: Update the groups of a policy set definition

Update-AzPolicySetDefinition -Name 'VMPolicySetDefinition' -GroupDefinition '[{ "name": "group1", "displayName": "Virtual Machine Security" }, { "name": "group2" }]'

This command updates the groups of a policy set definition named VMPolicySetDefinition.

Example 4: Update the groups of a policy set definition using a hash table

$groupsJson = ConvertTo-Json @{ name = "group1"; displayName = "Virtual Machine Security" }, @{ name = "group2" }
Update-AzPolicySetDefinition -Name 'VMPolicySetDefinition' -GroupDefinition $groupsJson

This command updates the groups of a policy set definition named VMPolicySetDefinition from a hash table.

Example 5: [Backcompat] Update the metadata of a policy set definition

Set-AzPolicySetDefinition -Name 'VMPolicySetDefinition' -Metadata '{"category":"Virtual Machine"}'

This command updates the metadata of a policy set definition named VMPolicySetDefinition to indicate its category is "Virtual Machine".

Parameters

-BackwardCompatible

Causes cmdlet to return artifacts using legacy format placing policy-specific properties in a property bag object.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRMContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Description

The policy set definition description.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DisplayName

The display name of the policy set definition.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Id

The resource Id of the policy definition to update.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ResourceId

Parameter sets

Id
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-InputObject

This operation updates an existing policy set definition in the given subscription or management group with the given name.

Parameter properties

Type:IPolicySetDefinition
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

InputObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-ManagementGroupName

The ID of the management group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ManagementGroupName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Metadata

The policy set definition metadata. Metadata is an open ended object and is typically a collection of key value pairs.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

The name of the policy set definition to update.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:PolicySetDefinitionName

Parameter sets

Name
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ManagementGroupName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SubscriptionId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Parameter

The parameter definitions for parameters used in the policy set. The keys are the parameter names.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PolicyDefinition

The policy definition array in JSON string form.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PolicyDefinitionGroup

The metadata describing groups of policy definition references within the policy set definition. To construct, see NOTES section for POLICYDEFINITIONGROUP properties and create a hash table.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:GroupDefinition

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SubscriptionId

The ID of the target subscription.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SubscriptionId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

IPolicySetDefinition

String

Outputs

IPolicySetDefinition

Notes

ALIASES

Set-AzPolicySetDefinition