Set-AzPolicyExemption
Modifies a policy exemption.
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
Syntax
Set-AzPolicyExemption
-Name <String>
[-Scope <String>]
[-DisplayName <String>]
[-Description <String>]
[-ExemptionCategory <String>]
[-PolicyDefinitionReferenceId <String[]>]
[-ExpiresOn <DateTime>]
[-ClearExpiration]
[-Metadata <String>]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzPolicyExemption
-Id <String>
[-DisplayName <String>]
[-Description <String>]
[-ExemptionCategory <String>]
[-PolicyDefinitionReferenceId <String[]>]
[-ExpiresOn <DateTime>]
[-ClearExpiration]
[-Metadata <String>]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzPolicyExemption
[-DisplayName <String>]
[-Description <String>]
[-ExemptionCategory <String>]
[-PolicyDefinitionReferenceId <String[]>]
[-ExpiresOn <DateTime>]
[-ClearExpiration]
[-Metadata <String>]
-InputObject <PsPolicyExemption>
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzPolicyExemption cmdlet modifies a policy exemption. Specify an exemption by ID or by name and scope.
Examples
Example 1: Update the display name
PS C:\> $ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
PS C:\> $PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07' -Scope $ResourceGroup.ResourceId
PS C:\> Set-AzPolicyExemption -Id $PolicyExemption.ResourceId -DisplayName 'Exempt VM creation limit'
The first command gets a resource group named ResourceGroup11 by using the Get-AzResourceGroup cmdlet. The command stores that object in the $ResourceGroup variable. The second command gets the policy exemption named PolicyExemption07 by using the Get-AzPolicyExemption cmdlet. The command stores that object in the $PolicyExemption variable. The final command updates the display name on the policy exemption on the resource group identified by the ResourceId property of $ResourceGroup.
Example 2: Update the expiration date time
PS C:\> $NextMonth = (Get-Date).AddMonths(1)
PS C:\> $PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07'
PS C:\> Set-AzPolicyExemption -Id $PolicyExemption.ResourceId -ExpiresOn $NextMonth
The first command gets the current date time by using the Get-Date cmdlet and add 1 month to the current date time The command stores that object in the $NextMonth variable. The second command gets the policy exemption named PolicyExemption07 by using the Get-AzPolicyExemption cmdlet. The command stores that object in the $PolicyExemption variable. The final command updates the expiration date time for the policy exemption on the default subscription.
Example 3: Clear the expiration date time
PS C:\> $PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07'
PS C:\> Set-AzPolicyExemption -Id $PolicyExemption.ResourceId -ClearExpiration
The first command gets the policy exemption named PolicyExemption07 by using the Get-AzPolicyExemption cmdlet. The command stores that object in the $PolicyExemption variable. The second command clears the expiration date time for the policy exemption on the default subscription. The updated exemption will never expire.
Example 4: Update the expiration category
PS C:\> $PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07'
PS C:\> Set-AzPolicyExemption -Id $PolicyExemption.ResourceId -ExemptionCategory Mitigated
The first command gets the policy exemption named PolicyExemption07 by using the Get-AzPolicyExemption cmdlet. The command stores that object in the $PolicyExemption variable. The second command updates the expiration category for the policy exemption on the default subscription. The updated exemption will never expire.
Parameters
When set, indicates the version of the resource provider API to use. If not specified, the API version is automatically determined as the latest available.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
If set, this switch clears the expiration date and time on the updated policy exemption.
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
| Type: | SwitchParameter |
| Aliases: | cf |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The description for the updated policy exemption.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The display name for the updated policy exemption.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The policy exemption category of the updated policy exemption. Possible values are Waiver and Mitigated.
| Type: | String |
| Accepted values: | Waiver, Mitigated |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The expiration date and time (in UTC ISO 8601 format yyyy-MM-ddTHH:mm:ssZ) of the updated policy exemption.
| Type: | Nullable<T>[DateTime] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The fully qualified policy exemption Id to update, including the scope, e.g. /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}.
| Type: | String |
| Aliases: | ResourceId |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The policy exemption object to update that was output from another cmdlet.
| Type: | PsPolicyExemption |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The metadata for the updated policy exemption. This can either be a path to a file containing the metadata JSON, or the metadata as a JSON string.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The name of the policy exemption to update.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The policy definition reference ID list when the associated policy assignment is for a policy set (initiative).
| Type: | String[] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
When set, indicates that the cmdlet should use pre-release API versions when automatically determining which version to use.
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The scope of the updated policy exemption, e.g. /providers/managementGroups/{managementGroupName}, defaults to current subscription.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
| Type: | SwitchParameter |
| Aliases: | wi |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Inputs
String[]
Nullable<T>[[System.DateTime, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]