Remove-AzureRmBackupProtectionPolicy

Deletes a policy from a Backup vault.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

Remove-AzureRmBackupProtectionPolicy
      [-Force]
      [-ProtectionPolicy] <AzureRMBackupProtectionPolicy>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-AzureRmBackupProtectionPolicy cmdlet deletes a policy from an Azure Backup vault. Before you can delete a backup protection policy, the policy must not have any associated Backup items. Before you delete the policy, make sure that each associated item is associated with some other policy. To associate another policy with a backup item, use the Enable-AzureRmBackupProtection cmdlet.

Examples

Example 1: Remove a backup protection policy

PS C:\>$Vault = Get-AzureRmBackupVault -Name "Vault03"
PS C:\> Get-AzureRmBackupProtectionPolicy -Vault $Vault -Name "DailyBackup" | Remove-AzureRmBackupProtectionPolicy

The first command gets the vault named Vault03 by using the Get-AzureRmBackupVault cmdlet. The command stores that object in the $Vault variable. The second command creates a retention policy for 30 days of daily retention, and then stores it in the $Daily variable. The second command gets the protection policy named DailyBackup in the vault in $Vault by using the Get-AzureRmBackupProtectionPolicy cmdlet. The command passes the policy to the current cmdlet. That cmdlet removes the policy.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

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

-Force

Forces the command to run without asking for user confirmation.

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

-ProtectionPolicy

Specifies protection policy that this cmdlet removes. To obtain an AzureRmBackupProtectionPolicy, use the Get-AzureRmBackupProtectionPolicy cmdlet

Type:AzureRMBackupProtectionPolicy
Position:0
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:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

AzureRMBackupProtectionPolicy

Parameters: ProtectionPolicy (ByValue)

Outputs

Void