編輯

共用方式為


New-AzBatchPool

Creates a pool in the Batch service.

Syntax

New-AzBatchPool
   [-Id] <String>
   -VirtualMachineSize <String>
   [-DisplayName <String>]
   [-ResizeTimeout <TimeSpan>]
   [-TargetDedicatedComputeNodes <Int32>]
   [-TargetLowPriorityComputeNodes <Int32>]
   [-TaskSlotsPerNode <Int32>]
   [-UpgradePolicy <PSUpgradePolicy>]
   [-TaskSchedulingPolicy <PSTaskSchedulingPolicy>]
   [-ResourceTag <IDictionary>]
   [-Metadata <IDictionary>]
   [-InterComputeNodeCommunicationEnabled]
   [-StartTask <PSStartTask>]
   [-CertificateReferences <PSCertificateReference[]>]
   [-ApplicationPackageReferences <PSApplicationPackageReference[]>]
   [-ApplicationLicenses <System.Collections.Generic.List`1[System.String]>]
   [-CloudServiceConfiguration <PSCloudServiceConfiguration>]
   [-NetworkConfiguration <PSNetworkConfiguration>]
   [-MountConfiguration <PSMountConfiguration[]>]
   [-UserAccount <PSUserAccount[]>]
   [-CurrentNodeCommunicationMode <NodeCommunicationMode>]
   [-TargetNodeCommunicationMode <NodeCommunicationMode>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBatchPool
   [-Id] <String>
   -VirtualMachineSize <String>
   [-DisplayName <String>]
   [-ResizeTimeout <TimeSpan>]
   [-TargetDedicatedComputeNodes <Int32>]
   [-TargetLowPriorityComputeNodes <Int32>]
   [-TaskSlotsPerNode <Int32>]
   [-UpgradePolicy <PSUpgradePolicy>]
   [-TaskSchedulingPolicy <PSTaskSchedulingPolicy>]
   [-ResourceTag <IDictionary>]
   [-Metadata <IDictionary>]
   [-InterComputeNodeCommunicationEnabled]
   [-StartTask <PSStartTask>]
   [-CertificateReferences <PSCertificateReference[]>]
   [-ApplicationPackageReferences <PSApplicationPackageReference[]>]
   [-ApplicationLicenses <System.Collections.Generic.List`1[System.String]>]
   [-VirtualMachineConfiguration <PSVirtualMachineConfiguration>]
   [-NetworkConfiguration <PSNetworkConfiguration>]
   [-MountConfiguration <PSMountConfiguration[]>]
   [-UserAccount <PSUserAccount[]>]
   [-CurrentNodeCommunicationMode <NodeCommunicationMode>]
   [-TargetNodeCommunicationMode <NodeCommunicationMode>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBatchPool
   [-Id] <String>
   -VirtualMachineSize <String>
   [-DisplayName <String>]
   [-AutoScaleEvaluationInterval <TimeSpan>]
   [-AutoScaleFormula <String>]
   [-TaskSlotsPerNode <Int32>]
   [-UpgradePolicy <PSUpgradePolicy>]
   [-TaskSchedulingPolicy <PSTaskSchedulingPolicy>]
   [-ResourceTag <IDictionary>]
   [-Metadata <IDictionary>]
   [-InterComputeNodeCommunicationEnabled]
   [-StartTask <PSStartTask>]
   [-CertificateReferences <PSCertificateReference[]>]
   [-ApplicationPackageReferences <PSApplicationPackageReference[]>]
   [-ApplicationLicenses <System.Collections.Generic.List`1[System.String]>]
   [-CloudServiceConfiguration <PSCloudServiceConfiguration>]
   [-NetworkConfiguration <PSNetworkConfiguration>]
   [-MountConfiguration <PSMountConfiguration[]>]
   [-UserAccount <PSUserAccount[]>]
   [-CurrentNodeCommunicationMode <NodeCommunicationMode>]
   [-TargetNodeCommunicationMode <NodeCommunicationMode>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBatchPool
   [-Id] <String>
   -VirtualMachineSize <String>
   [-DisplayName <String>]
   [-AutoScaleEvaluationInterval <TimeSpan>]
   [-AutoScaleFormula <String>]
   [-TaskSlotsPerNode <Int32>]
   [-UpgradePolicy <PSUpgradePolicy>]
   [-TaskSchedulingPolicy <PSTaskSchedulingPolicy>]
   [-ResourceTag <IDictionary>]
   [-Metadata <IDictionary>]
   [-InterComputeNodeCommunicationEnabled]
   [-StartTask <PSStartTask>]
   [-CertificateReferences <PSCertificateReference[]>]
   [-ApplicationPackageReferences <PSApplicationPackageReference[]>]
   [-ApplicationLicenses <System.Collections.Generic.List`1[System.String]>]
   [-VirtualMachineConfiguration <PSVirtualMachineConfiguration>]
   [-NetworkConfiguration <PSNetworkConfiguration>]
   [-MountConfiguration <PSMountConfiguration[]>]
   [-UserAccount <PSUserAccount[]>]
   [-CurrentNodeCommunicationMode <NodeCommunicationMode>]
   [-TargetNodeCommunicationMode <NodeCommunicationMode>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-AzBatchPool cmdlet creates a pool in the Azure Batch service under the account specified by the BatchContext parameter.

Examples

Example 1: Create a new pool using the TargetDedicated parameter set using CloudServiceConfiguration

$configuration = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSCloudServiceConfiguration" -ArgumentList @(4,"*")
New-AzBatchPool -Id "MyPool" -VirtualMachineSize "STANDARD_D1_V2" -CloudServiceConfiguration $configuration  -TargetDedicatedComputeNodes 3 -BatchContext $Context

The pool is configured to use STANDARD_D1_V2 virtual machines with operating system version of family four.

Example 2: Create a new pool using the TargetDedicated parameter set using VirtualMachineConfiguration

$imageReference = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSImageReference" -ArgumentList @("WindowsServer", "MicrosoftWindowsServer", "2016-Datacenter", "*")
$configuration = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSVirtualMachineConfiguration" -ArgumentList @($imageReference, "batch.node.windows amd64")
New-AzBatchPool -Id "MyPool" -VirtualMachineSize "STANDARD_D1_V2" -VirtualMachineConfiguration $configuration -TargetDedicatedComputeNodes 3 -BatchContext $Context

This command creates a new pool with ID MyPool using the TargetDedicated parameter set. The target allocation is three compute nodes. The pool is configured to use STANDARD_D1_V2 virtual machines with the Windows-2016-Datacenter operating system image.

Example 3: Create a new pool using the AutoScale parameter set

$imageReference = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSImageReference" -ArgumentList @("WindowsServer", "MicrosoftWindowsServer", "2016-Datacenter", "*")
$configuration = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSVirtualMachineConfiguration" -ArgumentList @($imageReference, "batch.node.windows amd64")
New-AzBatchPool -Id "AutoScalePool" -VirtualMachineSize "STANDARD_D1_V2" -VirtualMachineConfiguration $configuration -AutoScaleFormula '$TargetDedicated=2;' -BatchContext $Context

This command creates a new pool with ID AutoScalePool using the AutoScale parameter set. The pool is configured to use STANDARD_D1_V2 virtual machines with the Windows-2016-Datacenter operating system image, and the target number of compute nodes are determined by the Autoscale formula.

Example 4: Create a pool with nodes in a subnet

$imageReference = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSImageReference" -ArgumentList @("WindowsServer", "MicrosoftWindowsServer", "2016-Datacenter", "*")
$configuration = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSVirtualMachineConfiguration" -ArgumentList @($imageReference, "batch.node.windows amd64")
$networkConfig = New-Object Microsoft.Azure.Commands.Batch.Models.PSNetworkConfiguration
$networkConfig.SubnetId = "/subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}"
New-AzBatchPool -Id "AutoScalePool" -VirtualMachineSize "STANDARD_D1_V2" -VirtualMachineConfiguration $configuration -TargetDedicatedComputeNodes 3 -NetworkConfiguration $networkConfig -BatchContext $Context

Example 5: Create a pool with custom user accounts

$imageReference = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSImageReference" -ArgumentList @("WindowsServer", "MicrosoftWindowsServer", "2016-Datacenter", "*")
$configuration = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSVirtualMachineConfiguration" -ArgumentList @($imageReference, "batch.node.windows amd64")
$userAccount = New-Object Microsoft.Azure.Commands.Batch.Models.PSUserAccount -ArgumentList @("myaccount", "mypassword")
New-AzBatchPool -Id "AutoScalePool" -VirtualMachineSize "STANDARD_D1_V2" -VirtualMachineConfiguration $configuration -TargetDedicatedComputeNodes 3 -UserAccount $userAccount

Parameters

-ApplicationLicenses

The list of application licenses the Batch service will make available on each compute node in the pool.

Type:List<T>[String]
Aliases:ApplicationLicense
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ApplicationPackageReferences

Type:PSApplicationPackageReference[]
Aliases:ApplicationPackageReference
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AutoScaleEvaluationInterval

Specifies the amount of time, in minutes, that elapses before the pool size is automatically adjusted according to the AutoScale formula. The default value is 15 minutes, and the minimum value is 5 minutes.

Type:Nullable<T>[TimeSpan]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AutoScaleFormula

Specifies the formula for automatically scaling the pool.

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

-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.

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

-CertificateReferences

Specifies certificates associated with the pool. The Batch service installs the referenced certificates on each compute node of the pool.

Type:PSCertificateReference[]
Aliases:CertificateReference
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CloudServiceConfiguration

Specifies configuration settings for a pool based on the Azure cloud service platform.

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CurrentNodeCommunicationMode

The current pool communication mode.

Type:NodeCommunicationMode
Accepted values:Default, Classic, Simplified
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisplayName

Specifies the display name of the pool.

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

-Id

Specifies the ID of the pool to create.

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

-InterComputeNodeCommunicationEnabled

Indicates that this cmdlet sets up the pool for direct communication between dedicated compute nodes.

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

-Metadata

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

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

-MountConfiguration

A list of file systems to mount on each node in the pool. This supports Azure Files, NFS, CIFS/SMB, and Blobfuse.

Type:PSMountConfiguration[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-NetworkConfiguration

The network configuration for the pool.

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

-ResizeTimeout

Specifies the time-out for allocating compute nodes to the pool.

Type:Nullable<T>[TimeSpan]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceTag

The user defined tags to be associated with the Azure Batch Pool.When specified, these tags are propagated to the backing Azure resources associated with the pool.This property can only be specified when the Batch account was created with the poolAllocationMode property set to 'UserSubscription'.

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

-StartTask

Specifies the start task specification for the pool. The start task is run when a compute node joins the pool, or when the compute node is rebooted or reimaged.

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

-TargetDedicatedComputeNodes

Specifies the target number of dedicated compute nodes to allocate to the pool.

Type:Nullable<T>[Int32]
Aliases:TargetDedicated
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TargetLowPriorityComputeNodes

Specifies the target number of low-priority compute nodes to allocate to the pool.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TargetNodeCommunicationMode

The desired node communication mode for the pool.

Type:NodeCommunicationMode
Accepted values:Default, Classic, Simplified
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TaskSchedulingPolicy

Specifies the task scheduling policy, such as the ComputeNodeFillType.

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

-TaskSlotsPerNode

The number of task slots that can be used to run concurrent tasks on a single compute node in the pool. The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256.

Type:Nullable<T>[Int32]
Aliases:MaxTasksPerComputeNode
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UpgradePolicy

The upgrade policy for the pool in NewBatchPoolCommand.cs .

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

-UserAccount

The list of user accounts to be created on each node in the pool.

Type:PSUserAccount[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VirtualMachineConfiguration

Specifies configuration settings for a pool on the virtual machines infrastructure.

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

-VirtualMachineSize

Specifies the size of the virtual machines in the pool. For more information about virtual machine sizes, see Sizes for virtual machines in the Microsoft Azure site.

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

BatchAccountContext

Outputs

Void