Enable-AzureRmBackupProtection
Associates an item with an Azure Backup protection policy.
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
Enable-AzureRmBackupProtection
-Policy <AzureRMBackupProtectionPolicy>
[-Item] <AzureRMBackupContainerContextObject>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Enable-AzureRmBackupProtection cmdlet associates an item with an Azure Backup protection policy. To enable a protection policy, you must first have an existing backup item and an existing policy. Both must belong to the same Backup vault. The backup schedule does the full initial copy for the item and the incremental copy for the subsequent backups.
Examples
Example 1: Enable protection on an Azure virtual machine
PS C:\>$Vault = Get-AzureRmBackupVault -Name "Vault03"
PS C:\> $Policy = Get-AzureRmBackupProtectionPolicy -Vault $Vault -Name "DefaultPolicy"
PS C:\> Get-AzureRmBackupContainer -Vault $Vault -Type AzureVM -Status Registered | Get-AzureRmBackupItem | Enable-AzureRmBackupProtection -Policy $Policy
WorkloadName Operation Status StartTime EndTime
------------ --------- ------ --------- -------
co03-vm ConfigureBackup Completed 26-Aug-15 12:19:49 PM 26-Aug-15 12:19:54 PM
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 gets the Backup protection policy named DefaultPolicy for the vault in $Vault. The command stores that object in the $Policy variable. The final command uses the pipeline operator to pass values from one cmdlet to the next. It gets a container, by using the Get-AzureRmBackupContainer cmdlet. The command gets the backup item from that container by using the Get-AzureRmBackupItem cmdlet. The current cmdlet enables the policy stored in $Policy for the item that the command passes to that cmdlet.
Parameters
-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 |
-Item
Specifies the Backup item for which this cmdlet enables protection. To obtain an AzureRmBackupItem, use the Get-AzureRmBackupItem cmdlet.
Type: | AzureRMBackupContainerContextObject |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Policy
Specifies protection policy that this cmdlet associates with an item. To obtain an AzureRmBackupProtectionPolicy object, use the Get-AzureRmBackupProtectionPolicy cmdlet.
Type: | AzureRMBackupProtectionPolicy |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
AzureRMBackupContainerContextObject
Parameters: Item (ByValue)