Get-AzBatchJob
Gets Batch jobs for a Batch account or job schedule.
Syntax
ODataFilter (Default)
Get-AzBatchJob
-BatchContext <BatchAccountContext>
[-JobScheduleId <String>]
[-Filter <String>]
[-MaxCount <Int32>]
[-Select <String>]
[-Expand <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Id
Get-AzBatchJob
[[-Id] <String>]
-BatchContext <BatchAccountContext>
[-Select <String>]
[-Expand <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ParentObject
Get-AzBatchJob
[[-JobSchedule] <PSCloudJobSchedule>]
-BatchContext <BatchAccountContext>
[-Filter <String>]
[-MaxCount <Int32>]
[-Select <String>]
[-Expand <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzBatchJob cmdlet gets the Azure Batch jobs for the Batch account specified by the BatchAccountContext parameter.
You can use the Id parameter to get a single job.
You can use the Filter parameter to get the jobs that match an Open Data Protocol (OData) filter.
If you supply a job schedule ID or PSCloudJobSchedule instance, this cmdlet returns only the jobs for that job schedule.
Examples
Example 1: Get a Batch job by ID
Get-AzBatchJob -Id "Job01" -BatchContext $Context
CommonEnvironmentSettings :
Constraints : Microsoft.Azure.Commands.Batch.Models.PSJobConstraints
CreationTime : 7/25/2015 9:12:07 PM
DisplayName :
ETag : 0x8D29535B2941439
ExecutionInformation : Microsoft.Azure.Commands.Batch.Models.PSJobExecutionInformation
Id : Job01
JobManagerTask :
JobPreparationTask :
JobReleaseTask :
LastModified : 7/25/2015 9:12:07 PM
Metadata :
PoolInformation : Microsoft.Azure.Commands.Batch.Models.PSPoolInformation
PreviousState :
PreviousStateTransitionTime :
Priority : 0
State : Active
StateTransitionTime : 7/25/2015 9:12:07 PM
Statistics :
Url : https://pfuller.westus.batch.azure.com/jobs/Job01
This command gets the job that has the ID Job01.
Use the Get-AzBatchAccountKey cmdlet to assign a context to the $Context variable.
Example 2: Get all active jobs for a job schedule
Get-AzBatchJob -JobScheduleId "JobSchedule27" -Filter "state eq 'active'" -BatchContext $Context
CommonEnvironmentSettings :
Constraints : Microsoft.Azure.Commands.Batch.Models.PSJobConstraints
CreationTime : 7/25/2015 9:15:44 PM
DisplayName :
ETag : 0x8D2953633DD13E1
ExecutionInformation : Microsoft.Azure.Commands.Batch.Models.PSJobExecutionInformation
Id : JobSchedule27:job-1
JobManagerTask :
JobPreparationTask :
JobReleaseTask :
LastModified : 7/25/2015 9:15:44 PM
Metadata :
PoolInformation : Microsoft.Azure.Commands.Batch.Models.PSPoolInformation
PreviousState :
PreviousStateTransitionTime :
Priority : 0
State : Active
StateTransitionTime : 7/25/2015 9:15:44 PM
Statistics :
Url : https://pfuller.westus.batch.azure.com/jobs/JobSchedule27:job-1
This command gets the active jobs for the job schedule that has the ID JobSchedule27.
Example 3: Gets all jobs under a job schedule by using the pipeline
Get-AzBatchJobSchedule -Id "JobSchedule27" -BatchContext $Context | Get-AzBatchJob -BatchContext $Context
CommonEnvironmentSettings :
Constraints : Microsoft.Azure.Commands.Batch.Models.PSJobConstraints
CreationTime : 7/25/2015 9:15:44 PM
DisplayName :
ETag : 0x8D2953633DD13E1
ExecutionInformation : Microsoft.Azure.Commands.Batch.Models.PSJobExecutionInformation
Id : JobSchedule27:job-1
JobManagerTask :
JobPreparationTask :
JobReleaseTask :
LastModified : 7/25/2015 9:15:44 PM
Metadata :
PoolInformation : Microsoft.Azure.Commands.Batch.Models.PSPoolInformation
PreviousState :
PreviousStateTransitionTime :
Priority : 0
State : Active
StateTransitionTime : 7/25/2015 9:15:44 PM
Statistics :
Url : https://pfuller.westus.batch.azure.com/jobs/JobSchedule27:job-1
This command gets the job schedule that has the ID JobSchedule27 by using the Get-AzBatchJobSchedule cmdlet.
The command passes that job schedule to the current cmdlet by using the pipeline operator.
The command gets all jobs for that job schedule.
Parameters
-BatchContext
Specifies the BatchAccountContext instance that this cmdlet uses to interact with the Batch service.
If you use the Get-AzBatchAccount 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-AzBatchAccountKey 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.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Expand
Specifies an Open Data Protocol (OData) expand clause.
Specify a value for this parameter to get associated entities of the main entity that you get.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Filter
Specifies an OData filter clause for jobs.
If you do not specify a filter, this cmdlet returns all jobs for the Batch account or job schedule.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ODataFilter
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ParentObject
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Id
Specifies the ID of the job that this cmdlet gets.
You cannot specify wildcard characters.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
Id
Position: 0
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-JobSchedule
Specifies a PSCloudJobSchedule object that represents the job schedule which contains the jobs.
To obtain a PSCloudJobSchedule object, use the Get-AzBatchJobSchedule cmdlet.
Parameter properties
Parameter sets
ParentObject
Position: 0
Mandatory: False
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-JobScheduleId
Specifies the ID of the job schedule which contains the jobs.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ODataFilter
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-MaxCount
Specifies the maximum number of jobs to return.
If you specify a value of zero (0) or less, the cmdlet does not use an upper limit.
The default value is 1000.
Parameter properties
Type: Int32
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ODataFilter
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ParentObject
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Select
Specifies an OData select clause.
Specify a value for this parameter to get specific properties rather than all object properties.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs