Wait-AzureRmRecoveryServicesBackupJob

Waits for a Backup job to finish.

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

Wait-AzureRmRecoveryServicesBackupJob
    [-Job] <Object>
    [[-Timeout] <Int64>]
    [-VaultId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Wait-AzureRmRecoveryServicesBackupJob cmdlet waits for an Azure Backup job to finish. Backup jobs can take a long time. If you run a backup job as part of a script, you may want to force the script to wait for job to finish before it continues to other tasks. A script that includes this cmdlet can be simpler than one that polls the Backup service for the job status. Set the vault context by using the Set-AzureRmRecoveryServicesVaultContext cmdlet before you use the current cmdlet.

Examples

Example 1: Wait for a job to finish

PS C:\>
$Jobs = Get-AzureRmRecoveryServicesBackupJob -Status InProgress
    $Job = $Jobs[0]
    while ( $Job.Status -ne Completed )
    {
       Write-Host "Waiting for completion..."
       Start-Sleep -Seconds 10
       $Job = Get-AzureRmBackAzureRmRecoveryServicesBackupJob -Job $Job
    }
   Write-Host "Done!"
    Waiting for completion... 
    Waiting for completion... 
    Waiting for completion... 
    Done!

This script polls the first job that is currently in progress until the job has completed.

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

-Job

Specifies the job to wait for. To obtain a BackupJob object, use the Get-AzureRmRecoveryServicesBackupJob cmdlet.

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

-Timeout

Specifies the maximum time, in seconds, that this cmdlet waits for the job to finish. It is recommended to specify a time-out value.

Type:Nullable<T>[Int64]
Position:2
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

Inputs

Object

Parameters: Job (ByValue)

String

Parameters: VaultId (ByValue)

Outputs

JobBase