편집

다음을 통해 공유


Backup-AzRecoveryServicesBackupItem

Starts a backup for a Backup item.

Syntax

Backup-AzRecoveryServicesBackupItem
      -Item <ItemBase>
      [-ExpiryDateTimeUTC <DateTime>]
      [-BackupType <BackupType>]
      [-EnableCompression]
      [-VaultId <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Backup-AzRecoveryServicesBackupItem cmdlet takes an adhoc backup of protected Azure backup item. Using this cmdlet you can do an initial backup immediately after you enable protection or start a backup if a scheduled backup fails. This cmdlet can also be used for custom retention with or without expiry date - refer parameters help text for more details.

Examples

Example 1: Start a backup for a Backup item

$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$NamedContainer = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVM -FriendlyName "pstestv2vm1" -VaultId $vault.ID
$Item = Get-AzRecoveryServicesBackupItem -Container $NamedContainer -WorkloadType AzureVM -VaultId $vault.ID
$Job = Backup-AzRecoveryServicesBackupItem -Item $Item -VaultId $vault.ID -ExpiryDateTimeUTC (Get-Date).ToUniversalTime().AddDays(60)
$Job

Operation        Status               StartTime            EndTime                   JOBID
------------     ---------            ------               ---------                 -------
pstestv2vm1      Backup               InProgress           4/23/2016 5:00:30 PM      cf4b3ef5-2fac-4c8e-a215-d2eba4124f27

The first command gets the Backup container of type AzureVM named pstestv2vm1, and then stores it in the $NamedContainer variable. The second command gets the Backup item corresponding to the container in $NamedContainer, and then stores it in the $Item variable. The last command triggers the backup job for the Backup item in $Item with an expiry time of 60 days from now, default value for expiry time is 30 days if not specified.

Example 2

Starts a backup for a Backup item. (autogenerated)

Backup-AzRecoveryServicesBackupItem -ExpiryDateTimeUTC <DateTime> -Item $Item -VaultId $vault.ID

Parameters

-BackupType

Type of backup to be performed

Type:BackupType
Accepted values:Full, Differential, Log, CopyOnlyFull
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
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:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnableCompression

If enabling compression is required

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

-ExpiryDateTimeUTC

Specifies an expiry time for the Recovery point as a DateTime object, if nothing is given it takes the default value of 30 days. Applicable to VM, SQL (for only Copy-only-full backup type), AFS backup items.

Type:Nullable<T>[DateTime]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Item

Specifies a Backup item for which this cmdlet starts a backup operation.

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

-VaultId

ARM ID of the Recovery Services Vault.

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

-WhatIf

Shows what would happen if the cmdlet runs.

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

Inputs

ItemBase

Nullable<T>[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

String

Outputs

JobBase