Bewerken

Delen via


Update-AzPolicySetDefinition

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

Syntax

Update-AzPolicySetDefinition
      -Name <String>
      [-DisplayName <String>]
      [-Description <String>]
      [-PolicyDefinition <String>]
      [-Metadata <String>]
      [-Parameter <String>]
      [-PolicyDefinitionGroup <String>]
      [-BackwardCompatible]
      [-DefaultProfile <PSObject>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzPolicySetDefinition
      -Name <String>
      -ManagementGroupName <String>
      [-DisplayName <String>]
      [-Description <String>]
      [-PolicyDefinition <String>]
      [-Metadata <String>]
      [-Parameter <String>]
      [-PolicyDefinitionGroup <String>]
      [-BackwardCompatible]
      [-DefaultProfile <PSObject>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzPolicySetDefinition
      -Name <String>
      -SubscriptionId <String>
      [-DisplayName <String>]
      [-Description <String>]
      [-PolicyDefinition <String>]
      [-Metadata <String>]
      [-Parameter <String>]
      [-PolicyDefinitionGroup <String>]
      [-BackwardCompatible]
      [-DefaultProfile <PSObject>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzPolicySetDefinition
      -Id <String>
      [-DisplayName <String>]
      [-Description <String>]
      [-PolicyDefinition <String>]
      [-Metadata <String>]
      [-Parameter <String>]
      [-PolicyDefinitionGroup <String>]
      [-BackwardCompatible]
      [-DefaultProfile <PSObject>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzPolicySetDefinition
      [-DisplayName <String>]
      [-Description <String>]
      [-PolicyDefinition <String>]
      [-Metadata <String>]
      [-Parameter <String>]
      [-PolicyDefinitionGroup <String>]
      [-BackwardCompatible]
      -InputObject <IPolicySetDefinition>
      [-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 -ResourceId '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition'
Update-AzPolicySetDefinition -Id $PolicySetDefinition.ResourceId -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 ResourceId 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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Description

The policy set definition description.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DisplayName

The display name of the policy set definition.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Id

The resource Id of the policy definition to update.

Type:String
Aliases:ResourceId
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-InputObject

Type:IPolicySetDefinition
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ManagementGroupName

The ID of the management group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Metadata

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

The name of the policy set definition to update.

Type:String
Aliases:PolicySetDefinitionName
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Parameter

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PolicyDefinition

The policy definition array in JSON string form.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:String
Aliases:GroupDefinition
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SubscriptionId

The ID of the target subscription.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

IPolicySetDefinition

String

Outputs

IPolicySetDefinition

Notes

ALIASES

Set-AzPolicySetDefinition