Redigera

Dela via


New-AzBatchComputeNodeUser

Creates a user account on a Batch compute node.

Syntax

New-AzBatchComputeNodeUser
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   -Name <String>
   -Password <SecureString>
   [-ExpiryTime <DateTime>]
   [-IsAdmin]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
New-AzBatchComputeNodeUser
   [[-ComputeNode] <PSComputeNode>]
   -Name <String>
   -Password <SecureString>
   [-ExpiryTime <DateTime>]
   [-IsAdmin]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The New-AzBatchComputeNodeUser cmdlet creates a user account on an Azure Batch compute node.

Examples

Example 1: Create a user account that has administrative credentials

New-AzBatchComputeNodeUser -PoolId "MyPool01" -ComputeNodeId "ComputeNode01" -Name "TestUser" -Password "Password" -ExpiryTime ([DateTime]::Now.AddDays(7)) -IsAdmin -BatchContext $Context

This command creates a user account on the compute node that has the ID ComputeNode01. The node is in the pool that has the ID MyPool01. The user name is TestUser, the password is Password, the account expires in seven days, and the account is has administrative credentials.

Example 2: Create a user account on a compute node by using the pipeline

Get-AzBatchComputeNode "MyPool01" -Id "ComputeNode01" -BatchContext $Context | New-AzBatchComputeNodeUser -Name "TestUser" -Password "Password" -BatchContext $Context

This command gets the compute node named ComputeNode01 by using the Get-AzBatchComputeNode cmdlet. That node is in the pool that has the ID MyPool01. The command passes that compute node to the current cmdlet by using the pipeline operator. The command creates a user account that has the user name TestUser and the password Password.

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.

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

-ComputeNode

Specifies the compute node, as a PSComputeNode object, on which this cmdlet creates a user account.

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

-ComputeNodeId

Specifies the ID of the compute node on which this cmdlet creates a user account.

Type:String
Position:1
Default value:None
Required:True
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

-ExpiryTime

Specifies the expiry time for the new user account.

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

-IsAdmin

Indicates that the cmdlet creates a user account that has administrative credentials.

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

-Name

Specifies the name of the new local Windows account.

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

-Password

Specifies the user account password.

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

-PoolId

Specifies the ID of the pool that contains the compute node on which to create the user account.

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

Inputs

PSComputeNode

BatchAccountContext

Outputs

Void