Get-AzRecoveryServicesBackupItem

Gets the items from a container in Backup.

Syntax

Get-AzRecoveryServicesBackupItem
   [-Container] <ContainerBase>
   [[-Name] <String>]
   [[-ProtectionStatus] <ItemProtectionStatus>]
   [[-ProtectionState] <ItemProtectionState>]
   [-WorkloadType] <WorkloadType>
   [[-DeleteState] <ItemDeleteState>]
   [-FriendlyName <String>]
   [-VaultId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-UseSecondaryRegion]
   [<CommonParameters>]
Get-AzRecoveryServicesBackupItem
   [-BackupManagementType] <BackupManagementType>
   [[-Name] <String>]
   [[-ProtectionStatus] <ItemProtectionStatus>]
   [[-ProtectionState] <ItemProtectionState>]
   [-WorkloadType] <WorkloadType>
   [[-DeleteState] <ItemDeleteState>]
   [-FriendlyName <String>]
   [-VaultId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-UseSecondaryRegion]
   [<CommonParameters>]
Get-AzRecoveryServicesBackupItem
   [-Policy] <PolicyBase>
   [[-Name] <String>]
   [[-ProtectionStatus] <ItemProtectionStatus>]
   [[-ProtectionState] <ItemProtectionState>]
   [[-DeleteState] <ItemDeleteState>]
   [-FriendlyName <String>]
   [-VaultId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-UseSecondaryRegion]
   [<CommonParameters>]

Description

The Get-AzRecoveryServicesBackupItem cmdlet gets the list of protected items in a container and the protection status of the items. A container that is registered to an Azure Recovery Services vault can have one or more items that can be protected. For Azure virtual machines, there can be only one backup item in the virtual machine container. Set the vault context by using the -VaultId parameter.

Examples

Example 1: Get an item from a Backup container

$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$Container = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVM -FriendlyName "V2VM" -VaultId $vault.ID
$BackupItem = Get-AzRecoveryServicesBackupItem -Container $Container -WorkloadType AzureVM -VaultId $vault.ID

The first command gets the container of type AzureVM, and then stores it in the $Container variable. The second command gets the Backup item named V2VM in $Container, and then stores it in the $BackupItem variable.

Example 2: Get an Azure File Share Item from FriendlyName

$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$Container = Get-AzRecoveryServicesBackupContainer -ContainerType AzureStorage -FriendlyName "StorageAccount1" -VaultId $vault.ID
$BackupItem = Get-AzRecoveryServicesBackupItem -Container $Container -WorkloadType AzureFiles -VaultId $vault.ID -FriendlyName "FileShareName"

The first command gets the container of type AzureStorage, and then stores it in the $Container variable. The second command gets the Backup item whose friendlyName matches the value passed in FriendlyName Parameter, and then stores it in the $BackupItem variable. Using FriendlyName parameter can result in returning more than one Azure File Share. In such cases, execute the cmdlet by passing value for -Name parameter as the Name property returned in the result set of $BackupItem.

Parameters

-BackupManagementType

The class of resources being protected. The acceptable values for this parameter are:

  • AzureVM
  • MAB
  • AzureStorage
  • AzureWorkload
Type:BackupManagementType
Accepted values:AzureVM, MAB, AzureStorage, AzureWorkload
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Container

Specifies a container object from which this cmdlet gets backup items. To obtain an AzureRmRecoveryServicesBackupContainer, use the Get-AzRecoveryServicesBackupContainer cmdlet.

Type:ContainerBase
Position:1
Default value:None
Required:True
Accept pipeline input:True
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

-DeleteState

Specifies the deletestate of the item The acceptable values for this parameter are:

  • ToBeDeleted
  • NotDeleted
Type:ItemDeleteState
Accepted values:ToBeDeleted, NotDeleted
Position:6
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FriendlyName

FriendlyName of the backed up item

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

-Name

Specifies the name of backup item. For file share, specify the unique ID of protected file share.

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

-Policy

Protection policy object.

Type:PolicyBase
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ProtectionState

Specifies the state of protection. The acceptable values for this parameter are:

  • IRPending. Initial synchronization has not started and there is no recovery point yet.
  • Protected. Protection is ongoing.
  • ProtectionError. There is a protection error.
  • ProtectionStopped. Protection is disabled.
Type:ItemProtectionState
Accepted values:IRPending, ProtectionError, Protected, ProtectionStopped, BackupsSuspended
Position:4
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ProtectionStatus

Specifies the overall protection status of an item in the container. The acceptable values for this parameter are:

  • Healthy
  • Unhealthy
Type:ItemProtectionStatus
Accepted values:Healthy, Unhealthy
Position:3
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UseSecondaryRegion

Filters from Secondary Region for Cross Region Restore

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
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

-WorkloadType

Workload type of the resource. The acceptable values for this parameter are:

  • AzureVM
  • AzureFiles
  • MSSQL
  • FileFolder
  • SAPHanaDatabase
Type:WorkloadType
Accepted values:AzureVM, AzureFiles, MSSQL, FileFolder, SAPHanaDatabase
Position:5
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

ContainerBase

String

Outputs

ItemBase