Remove-AzSnapshotImmutabilityPolicy
Expires an active Unlocked immutability policy on a managed disk snapshot.
Syntax
DefaultParameterSet (Default)
Remove-AzSnapshotImmutabilityPolicy
[-Name] <String>
-ResourceGroupName <String>
[-Force]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[-AcquirePolicyToken]
[-ChangeReference <String>]
[<CommonParameters>]
ResourceIdParameterSet
Remove-AzSnapshotImmutabilityPolicy
[-ResourceId] <String>
[-Force]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[-AcquirePolicyToken]
[-ChangeReference <String>]
[<CommonParameters>]
InputObjectParameterSet
Remove-AzSnapshotImmutabilityPolicy
[-InputObject] <PSSnapshot>
[-Force]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[-AcquirePolicyToken]
[-ChangeReference <String>]
[<CommonParameters>]
Description
The Remove-AzSnapshotImmutabilityPolicy cmdlet expires an active Unlocked policy without deleting the snapshot. Policies that are absent, expired, or Locked cannot be removed.
Removal requires Microsoft.Compute/snapshots/updateImmutabilityPolicyLock/action and snapshot read permission. Ordinary policy-update permission alone is insufficient. The returned snapshot retains an expired Unlocked policy with duration 0. Repeating removal returns an error.
The cmdlet prompts for acknowledgement before ending protection. Use -Force to suppress this additional prompt; -Confirm:$false alone does not.
If verification fails, the change may already have applied. Inspect the snapshot's ImmutabilityPolicy with Get-AzSnapshot before retrying.
Examples
Example 1: Remove an Unlocked policy from a snapshot object
$snapshot = Get-AzSnapshot -ResourceGroupName "rg-backup" -SnapshotName "snapshot-01"
$snapshot = Remove-AzSnapshotImmutabilityPolicy -InputObject $snapshot
$snapshot.ImmutabilityPolicy | Format-List
This example expires the Unlocked policy and displays the result.
Example 2: Remove a policy by resource ID
Remove-AzSnapshotImmutabilityPolicy -ResourceId "/subscriptions/<subscription-id>/resourceGroups/rg-backup/providers/Microsoft.Compute/snapshots/snapshot-01"
This command removes protection from the snapshot identified by its resource ID.
Example 3: Preview removal by piping a snapshot
Get-AzSnapshot -ResourceGroupName "rg-backup" -SnapshotName "snapshot-01" |
Remove-AzSnapshotImmutabilityPolicy -WhatIf
This command previews removal without changing the snapshot.
Example 4: Remove protection in a background job
$job = Remove-AzSnapshotImmutabilityPolicy -ResourceGroupName "rg-backup" -SnapshotName "snapshot-01" -AsJob
$snapshot = $job | Wait-Job | Receive-Job -ErrorAction Stop
$snapshot.ImmutabilityPolicy |
Format-List Type, ImmutabilityDurationDays, PolicyStartTime, PolicyExpirationTime, IsPolicyExpired
This example expires protection in a background job and returns the remaining snapshot.
Parameters
-AcquirePolicyToken
Acquire an Azure Policy token automatically for this resource operation.
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 |
-AsJob
Runs the cmdlet in the background and returns a job.
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 |
-ChangeReference
The change reference resource ID for this resource operation.
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 |
-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 credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, 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 |
-Force
Suppresses the additional removal acknowledgement, but not standard confirmation, permissions, or retention restrictions.
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 |
-InputObject
Specifies the snapshot whose policy is removed. Only its resource ID is used; current policy is read from Azure.
Parameter properties
| Type: | PSSnapshot |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
InputObjectParameterSet
| Position: | 0 |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Name
Specifies the snapshot name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | SnapshotName |
Parameter sets
DefaultParameterSet
| Position: | 0 |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-ResourceGroupName
Specifies the snapshot's resource group.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
DefaultParameterSet
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-ResourceId
Specifies the snapshot resource ID in the current subscription.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Id |
Parameter sets
ResourceIdParameterSet
| Position: | 0 |
| 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
PSSnapshot
Outputs
PSSnapshot
Notes
Snapshots in Pending, Unknown, or InstantAccess states cannot be updated.
Acknowledgement occurs before a background job starts. Cancelling a job does not guarantee server cancellation or rollback.