< Back

New-AzureBatchJob

Tue Jan 29, 2019 9:35 pm

NAME New-AzureBatchJob



SYNOPSIS

Creates a job in the Batch service.





SYNTAX

New-AzureBatchJob [-Id] <String> -BatchContext <BatchAccountContext> [-CommonEnvironmentSettings <IDictionary>] [-Constraints <PSJobConstraints>]

[-DefaultProfile <IAzureContextContainer>] [-DisplayName <String>] [-JobManagerTask <PSJobManagerTask>] [-JobPreparationTask

<PSJobPreparationTask>] [-JobReleaseTask <PSJobReleaseTask>] [-Metadata <IDictionary>] [-OnAllTasksComplete {NoAction | TerminateJob}]

[-OnTaskFailure {NoAction | PerformExitOptionsJobAction}] -PoolInformation <PSPoolInformation> [-Priority <Int32>] [-UsesTaskDependencies]

[<CommonParameters>]





DESCRIPTION

The New-AzureBatchJob cmdlet creates a job in the Azure Batch service in the account specified by the BatchAccountContext parameter.





PARAMETERS

-BatchContext <BatchAccountContext>

Specifies the BatchAccountContext instance that this cmdlet uses to interact with the Batch service. If you use the Get-AzureRmBatchAccount

cmdlet to get your BatchAccountContext, then Azure Active Directory 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.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-CommonEnvironmentSettings <IDictionary>

Specifies the common environment variables, as key/value pairs, that this cmdlet sets for all tasks in the job. The key is the environment

variable name. The value is the environment variable value.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Constraints <PSJobConstraints>

Specifies the execution constraints for the job.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DisplayName <String>

Specifies the display name for the job.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Id <String>

Specifies an ID for the job.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-JobManagerTask <PSJobManagerTask>

Specifies the Job Manager task. The Batch service runs the Job Manager task when the job is started.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-JobPreparationTask <PSJobPreparationTask>

Specifies the Job Preparation task. The Batch service runs the Job Preparation task on a compute node before it starts any tasks of that job

on that compute node.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-JobReleaseTask <PSJobReleaseTask>

Specifies the Job Release task. The Batch service runs the Job Release task when the job ends. The Batch service runs the Job Release task on

each compute node where it ran any task of the job.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Metadata <IDictionary>

Specifies metadata, as key/value pairs, to add to the job. The key is the metadata name. The value is the metadata value.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-OnAllTasksComplete <OnAllTasksComplete>

Specifies an action the Batch service takes if all tasks in the job are in the completed state.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-OnTaskFailure <OnTaskFailure>

Specifies an action the Batch service takes if any task in the job fails.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-PoolInformation <PSPoolInformation>

Specifies the details of the pool on which the Batch service runs the tasks of the job.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Priority <Int32>

Specifies the priority of the job. Valid values are: integers from -1000 to 1000. A value of -1000 is the lowest priority. A value of 1000 is

the highest priority. The default value is 0.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-UsesTaskDependencies [<SwitchParameter>]





Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

BatchAccountContext

Parameter 'BatchContext' accepts value of type 'BatchAccountContext' from the pipeline





OUTPUTS



NOTES









Example 1: Create a job



PS C:\\>$PoolInformation = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSPoolInformation"

PS C:\\> $PoolInformation.PoolId = "Pool22"

PS C:\\> New-AzureBatchJob -Id "ContosoJob35" -PoolInformation $PoolInformation -BatchContext $Context



The first command creates a PSPoolInformation object by using the New-Object cmdlet. The command stores that object in the $PoolInformation

variable.



The second command assigns the ID Pool22 to the PoolId property of the object in $PoolInformation.



The final command creates a job that has the ID ContosoJob35. Tasks added to the job run on the pool that has the ID Pool22. Use the

Get-AzureRmBatchAccountKeys cmdlet to assign a context to the $Context variable.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... rebatchjob

Disable-AzureBatchJob

Enable-AzureBatchJob

Get-AzureRmBatchAccountKeys

Get-AzureBatchJob

Get-AzureBatchJobSchedule

Remove-AzureBatchJob

Stop-AzureBatchJob

Azure Batch Cmdlets