Set-​Azure​Rm​Policy​Assignment

Modifies a policy assignment.

Syntax

Set-AzureRmPolicyAssignment
   -Name <String>
   -Scope <String>
   [-DisplayName <String>]
   [-ApiVersion <String>]
   [-Pre]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]
Set-AzureRmPolicyAssignment
   [-DisplayName <String>]
   [-ApiVersion <String>]
   [-Pre]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   -Id <String>
   [<CommonParameters>]

Description

The Set-AzureRmPolicyAssignment cmdlet modifies a policy assignment. Specify an assignment by ID or by name and scope.

Examples

Example 1: Update the display name

PS C:\>$ResourceGroup = Get-AzureRmResourceGroup -Name "ResourceGroup11"
PS C:\> $PolicyAssignment = Get-AzureRmPolicyAssignment -Name "PolicyAssignment" -Scope $ResourceGroup.ResourceId
PS C:\> Set-AzureRmPolicyAssignment -Id $PolicyAssignment.ResourceId -DisplayName "Do not allow VM creation"

The first command gets a resource group named ResourceGroup11 by using the Get-AzureRMResourceGroup cmdlet. The command stores that object in the $ResourceGroup variable.

The second command gets the policy assignment named PolicyAssignment by using the Get-AzureRmPolicyAssignment cmdlet. The command stores that object in the $PolicyAssignment variable.

The final command updates the display name on the policy assignment identified by the ResourceId property of $PolicyAssignment.

Required Parameters

-Id

Specifies the fully qualified resource ID for the policy assignment that this cmdlet modifies.

Type:String
Aliases:ResourceId
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies the name of the policy assignment that this cmdlet modifies.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Scope

Specifies the scope at which the policy is applied.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-ApiVersion

Specifies the version of the resource provider API to use. If you do not specify a version, this cmdlet uses the latest available version.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DisplayName

Specifies a new display name for the policy assignment.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-InformationAction

Specifies how this cmdlet responds to an information event.The acceptable values for this parameter are:- Continue

  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Pre

Indicates that this cmdlet considers pre-release API versions when it automatically determines which version to use.

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