New-AzureBatchTask

New-AzureBatchTask

Creates a new Batch task under the specified job.

Syntax

Parameter Set: Id
New-AzureBatchTask -BatchContext <BatchAccountContext> -CommandLine <String> -Id <String> -JobId <String> [-AffinityInformation <PSAffinityInformation> ] [-Constraints <PSTaskConstraints> ] [-DisplayName <String> ] [-EnvironmentSettings <IDictionary> ] [-ResourceFiles <IDictionary> ] [-RunElevated] [ <CommonParameters>]

Parameter Set: ParentObject
New-AzureBatchTask -BatchContext <BatchAccountContext> -CommandLine <String> -Id <String> [-AffinityInformation <PSAffinityInformation> ] [-Constraints <PSTaskConstraints> ] [-DisplayName <String> ] [-EnvironmentSettings <IDictionary> ] [-Job <PSCloudJob> ] [-ResourceFiles <IDictionary> ] [-RunElevated] [ <CommonParameters>]

Detailed Description

The New-AzureBatchTask cmdlet creates a new Azure Batch task under the job specified by the JobId parameter or the Job parameter.

Parameters

-AffinityInformation<PSAffinityInformation>

Specifies a locality hint that can be used by the Batch service to select a node on which to start the task.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-BatchContext<BatchAccountContext>

Specifies the BatchAccountContext instance that this cmdlet uses to interact with the Batch service. To obtain a BatchAccountContext object that contains access keys for your subscription, use the Get-AzureRmBatchAccountKeys cmdlet.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByValue)

Accept Wildcard Characters?

false

-CommandLine<String>

Specifies the command-line command for the task.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Constraints<PSTaskConstraints>

Specifies the run constraints for the task.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DisplayName<String>

Specifies the display name of the task.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EnvironmentSettings<IDictionary>

Specifies the environment settings to add to the new task. For each key/value pair, set the key to the environment setting name, and the value to the environment setting.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Id<String>

Specifies the ID of the task to create.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Job<PSCloudJob>

Specifies the PSCloudJob object representing the job to create the task under. Use the Get-AzureBatchJob cmdlet to get a PSCloudJob object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByValue)

Accept Wildcard Characters?

false

-JobId<String>

Specifies the ID of the job to create the task under.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ResourceFiles<IDictionary>

Specifies resource files required by the task. For each key/value pair, set the key to the resource file path, and the value to the resource file blob source.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunElevated

Indicates that the task process runs elevated as Administrator. Otherwise, the process runs without elevation.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Create a new Batch task

This command creates a new task with ID MyTask under job Job-000001. The task will run the command-line "cmd /c dir /s".

PS C:\>New-AzureBatchTask -JobId "Job-000001" -Id "MyTask" -CommandLine "cmd /c dir /s" -BatchContext $Context

Example 2: Create a new Batch task

This command creates a new task with ID MyTask2 under job Job-000001. The task will run the command-line "cmd /c echo hello > newFile.txt" with elevated permissions.

PS C:\>Get-AzureBatchJob -Id "Job-000001" -BatchContext $Context | New-AzureBatchTask -Id "MyTask2" -CommandLine "cmd /c echo hello > newFile.txt" -RunElevated -BatchContext $Context

Get-AzureRmBatchAccountKeys

Get-AzureBatchJob

Get-AzureBatchTask

Remove-AzureBatchTask

RMAzure_Batch_Cmdlets