Get-AzureBatchTaskCounts

Gets the task counts for the specified 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

Get-AzureBatchTaskCounts
   [-JobId] <String>
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzureBatchTaskCounts
   [[-Job] <PSCloudJob>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzureBatchTaskCounts cmdlet gets the Azure Batch tasks count for a Batch job. Specify a job by either the JobId parameter or the Job parameter. Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. If the validationStatus is unvalidated, then the Batch service has not been able to check state counts against the task states as reported in the List Tasks API. The validationStatus may be unvalidated if the job contains more than 200,000 tasks.

Examples

Example 1: Get task counts by ID

PS C:\> Get-AzureBatchTaskCounts -JobId "Job01" -Id "Task03" -BatchContext $Context
Active              : 1
Completed           : 0
Failed              : 0
Running             : 1
Succeeded           : 5
ValidationStatus    : Validated

This command gets the task counts for job Job01. Use the Get-AzureRmBatchAccountKeys cmdlet to assign a context to the $Context variable.

Parameters

-BatchContext

The BatchAccountContext instance to use when interacting with the Batch service. If you use the Get-AzureRmBatchAccount cmdlet to get your BatchAccountContext, then Microsoft Entra authentication will be used when interacting with the Batch service. To use shared key authentication instead, use the Get-AzureRmBatchAccountKeys cmdlet to get a BatchAccountContext object with its access keys populated. When using shared key authentication, the primary access key is used by default. To change the key to use, set the BatchAccountContext.KeyInUse property.

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

-Job

Specifies the job that contains tasks that this cmdlet gets. To obtain a PSCloudJob object, use the Get-AzureBatchJob cmdlet.

Type:PSCloudJob
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-JobId

The id of the job for which to get task counts.

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

Inputs

String

PSCloudJob

Parameters: Job (ByValue)

BatchAccountContext

Parameters: BatchContext (ByValue)

Outputs

PSTaskCounts