編集

次の方法で共有


Add-AzVmssRunCommand

Adding Run Command to VMSS instances

Syntax

Add-AzVmssRunCommand
   [-ResourceGroupName] <String>
   [-VMScaleSetName] <String>
   [-Location] <String>
   [-CommandId <String>]
   -Name <String>
   [-ScriptPath <String>]
   [-ScriptUri <String>]
   [-Script <String>]
   [-TimeOutInSeconds <String>]
   [-ErrorBlobUri <String>]
   [-OutputBlobUri <String>]
   [-RunAsUser <String>]
   [-RunAsPassword <SecureString>]
   [-Parameter <Hashtable>]
   [-ProtectedParameter <Hashtable>]
   [-AsyncExecution <Boolean>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzVmssRunCommand
   [-CommandId <String>]
   -Name <String>
   [-ScriptPath <String>]
   [-ScriptUri <String>]
   [-Script <String>]
   [-TimeOutInSeconds <String>]
   [-ErrorBlobUri <String>]
   [-OutputBlobUri <String>]
   [-RunAsUser <String>]
   [-RunAsPassword <SecureString>]
   [-Parameter <Hashtable>]
   [-ProtectedParameter <Hashtable>]
   [-AsyncExecution <Boolean>]
   [-VirtualMachineScaleSetVM] <PSVirtualMachineScaleSetVM>
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Adding Run Command to All VMSS Instances

Examples

Example 1

Add-AzVmssRunCommand -ResourceGroupName $rgname -VMScaleSetName $vmssname -Location eastus -Name myruncommand -Script "Write-Host Hello World" -TimeOutInSeconds 3600 -RunAsUser "admin01"

Adding 'myruncommand' to VMSS

Parameters

-AsJob

Run cmdlet in the background

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

-AsyncExecution

Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete.

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

-CommandId

RunCommand Id

Type:String
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: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

-ErrorBlobUri

Specifies the Azure storage blob where script error stream will be uploaded.

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

-Location

Resource location

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

-Name

Resource name

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

-OutputBlobUri

Specifies the Azure storage blob where script output stream will be uploaded.

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

-Parameter

The parameters used by the script.

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

-ProtectedParameter

The parameters used by the script.

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

-ResourceGroupName

Resource Group Name

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

-RunAsPassword

Specifies the user account password on the VM when executing the run command.

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

-RunAsUser

Specifies the user account on the VM when executing the run command.

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

-Script

The source of the run command script.

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

-ScriptPath

The Path of source of the run command script.

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

-ScriptUri

The Uri source of the run command script.

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

-TimeOutInSeconds

The timeout in seconds to execute the run command.

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

-VirtualMachineScaleSetVM

The VirtualMachineScaleSetVM

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

-VMScaleSetName

The VirtualMachineScaleSet

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
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:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

PSVirtualMachineScaleSetVM

Outputs

PSRunCommandResult