Stop-AzureRmBackupJob

Cancels an existing Backup job.

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

Stop-AzureRmBackupJob
    -Vault <AzureRMBackupVault>
    -JobID <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Stop-AzureRmBackupJob
    -Job <AzureRMBackupJob>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Stop-AzureRmBackupJob cmdlet cancels an existing Azure Backup job. Use this parameter to stop a job that takes too long and blocks other activities. You can cancel only the following types of jobs:

  • Backup
  • Restore

Examples

Example 1: Stop a backup job by using a job ID

PS C:\>$Vault = Get-AzureRmBackupVault -Name "Vault03" 
PS C:\> $Job = Get-AzureRmBackupJob -Vault $Vault -Operation Backup
PS C:\> Stop-AzureRmBackupJob -Vault $Vault -JobID $Job.InstanceId

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 a backup job from the vault in $Vault by using the Get-AzureRmBackupJob cmdlet. The command stores the job in the $Job variable. In this example, there is only one backup operation in the specified vault. The final command stops the job that has the specified ID.

Example 2: Stop all Restore operations

PS C:\>Get-AzureRmBackupJob -Vault $Vault -Operation Restore | Stop-AzureRmBackupJob

This command gets all the restore operations in the vault in $Vault, and then passes them to the current cmdlet by using the pipeline operator. The current cmdlet stops each job.

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 a job that this cmdlet cancels. To obtain an AzureRmBackupJob object, use the Get-AzureRmBackupJob cmdlet.

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

-JobID

Specifies a job that this cmdlet cancels. To obtain an AzureRmBackupJob object, use the Get-AzureRmBackupJob cmdlet.

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

-Vault

Specifies the Backup vault in which this cmdlet cancels a job. To obtain an AzureRmBackupVault object, use the Get-AzureRmBackupVault cmdlet.

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

Inputs

AzureRMBackupJob

Parameters: Job (ByValue)

Outputs

Void