Remove-AzRecoveryServicesBackupProtectionPolicy
Deletes a Backup protection policy from a vault.
Syntax
PolicyName (Default)
Remove-AzRecoveryServicesBackupProtectionPolicy
[-Name] <String>
[-PassThru]
[-Force]
[-VaultId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PolicyObject
Remove-AzRecoveryServicesBackupProtectionPolicy
[-Policy] <PolicyBase>
[-PassThru]
[-Force]
[-VaultId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Remove-AzRecoveryServicesBackupProtectionPolicy cmdlet deletes backup policies for a 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-AzRecoveryServicesBackupProtection cmdlet.
Set the vault context by using the Set-AzRecoveryServicesVaultContext cmdlet before you use the current cmdlet.
Examples
Example 1: Remove a policy
$Pol= Get-AzRecoveryServicesBackupProtectionPolicy -Name "NewPolicy"
Remove-AzRecoveryServicesBackupProtectionPolicy -Policy $Pol
The first command gets the Backup protection policy named NewPolicy, and then stores it in the $Pol variable.
The second command removes the policy object in $Pol.
Example 2
Deletes a Backup protection policy from a vault. (autogenerated)
Remove-AzRecoveryServicesBackupProtectionPolicy -Name 'V2VM' -VaultId $vault.ID
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: False
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
Forces the command to run without asking for user confirmation.
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
-Name
Specifies the name of the Backup protection policy to remove.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
PolicyName
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-PassThru
Return the policy to be deleted.
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
-Policy
Specifies the Backup protection policy to remove.
To obtain an BackupPolicy object, use the Get-AzRecoveryServicesBackupProtectionPolicy cmdlet.
Parameter properties
Type: PolicyBase
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
PolicyObject
Position: 1
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-VaultId
ARM ID of the Recovery Services Vault.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
Parameter properties
Type: SwitchParameter
Default value: False
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 .
Outputs