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>]
   [<CommonParameters>]
Get-AzRecoveryServicesBackupItem
   [-BackupManagementType] <BackupManagementType>
   [[-Name] <String>]
   [[-ProtectionStatus] <ItemProtectionStatus>]
   [[-ProtectionState] <ItemProtectionState>]
   [-WorkloadType] <WorkloadType>
   [[-DeleteState] <ItemDeleteState>]
   [-FriendlyName <String>]
   [-VaultId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzRecoveryServicesBackupItem
   [-Policy] <PolicyBase>
   [[-Name] <String>]
   [[-ProtectionStatus] <ItemProtectionStatus>]
   [[-ProtectionState] <ItemProtectionState>]
   [[-DeleteState] <ItemDeleteState>]
   [-FriendlyName <String>]
   [-VaultId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzRecoveryServicesBackupItem cmdlet gets the items in a container or a value in Azure Backup 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

PS C:\> $vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
PS C:\> $Container = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVM -Status Registered -Name "V2VM" -VaultId $vault.ID
PS C:\> $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

PS C:\> $vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
PS C:\> $Container = Get-AzRecoveryServicesBackupContainer -ContainerType AzureStorage -Status Registered -Name "StorageAccount1" -VaultId $vault.ID
PS C:\> $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 use -Name parameter with parameter value as the Name property returned in $BackupItem variable.

Parameters

-BackupManagementType

Specifies the Backup management type. The acceptable values for this parameter are:

  • AzureVM
  • MARS
  • SCDPM
  • AzureBackupServer
  • AzureSQL
  • AzureStorage
  • AzureWorkload
Type:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.BackupManagementType
Accepted values:AzureVM, MARS, SCDPM, AzureBackupServer, AzureSQL, AzureStorage, AzureWorkload
Position:1
Default value:None
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:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ContainerBase
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-DefaultProfile

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

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
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:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ItemDeleteState
Accepted values:ToBeDeleted, NotDeleted
Position:6
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-FriendlyName

FriendlyName of the backed up item

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

Specifies the name of the container.

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

Protection policy object.

Type:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.PolicyBase
Position:1
Default value:None
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:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ItemProtectionState
Accepted values:IRPending, ProtectionError, Protected, ProtectionStopped
Position:4
Default value:None
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:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ItemProtectionStatus
Accepted values:Healthy, Unhealthy
Position:3
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VaultId

ARM ID of the Recovery Services Vault.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-WorkloadType

Specifies the workload type. The acceptable values for this parameter are:

  • AzureVM
  • AzureSQLDatabase
  • AzureFiles
  • MSSQL
Type:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.WorkloadType
Accepted values:AzureVM, AzureSQLDatabase, AzureFiles, MSSQL
Position:5
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ContainerBase

String

Outputs

Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ItemBase