Set-AzVmssVMRunCommand

The operation to create or update the VMSS VM run command.

Note

This is the previous version of our documentation. Please consult the most recent version for up-to-date information.

Syntax

Set-AzVmssVMRunCommand
   -InstanceId <String>
   -ResourceGroupName <String>
   -RunCommandName <String>
   -VMScaleSetName <String>
   -Location <String>
   [-SubscriptionId <String>]
   [-AsyncExecution]
   [-ErrorBlobUri <String>]
   [-OutputBlobUri <String>]
   [-Parameter <IRunCommandInputParameter[]>]
   [-ProtectedParameter <IRunCommandInputParameter[]>]
   [-RunAsPassword <String>]
   [-RunAsUser <String>]
   [-SourceCommandId <String>]
   [-SourceScript <String>]
   [-SourceScriptUri <String>]
   [-Tag <Hashtable>]
   [-TimeoutInSecond <Int32>]
   [-DefaultProfile <PSObject>]
   [-AsJob]
   [-NoWait]
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]

Description

The operation to create or update the VMSS VM run command.

Examples

Example 1: Set RunCommand by name

Set-AzVmssVMRunCommand -InstanceId 3 -ResourceGroupName $rgname -RunCommandName "first" -VMScaleSetName $vmssname

Location Name  Type
-------- ----  ----
eastus   first Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands

Add RunCommand to an Instance of VMSS.

Parameters

-AsJob

Run the command as a job

Type:SwitchParameter
Position:Named
Default value:None
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:SwitchParameter
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

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

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False
-InstanceId

The instance ID of the virtual machine.

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

Resource location

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

Run the command asynchronously

Type:SwitchParameter
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False
-Parameter

The parameters used by the script. To construct, see NOTES section for PARAMETER properties and create a hash table.

Type:IRunCommandInputParameter[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ProtectedParameter

The parameters used by the script. To construct, see NOTES section for PROTECTEDPARAMETER properties and create a hash table.

Type:IRunCommandInputParameter[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

The name of the resource group.

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

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

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

The name of the virtual machine run command.

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

Specifies a commandId of predefined built-in script.

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

Specifies the script content to be executed on the VM.

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

Specifies the script download location.

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

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Accept pipeline input:False
Accept wildcard characters:False
-Tag

Resource tags

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

The timeout in seconds to execute the run command.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VMScaleSetName

The name of the VM scale set.

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

Outputs

IVirtualMachineRunCommand

Notes

ALIASES

COMPLEX PARAMETER PROPERTIES

To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.

PARAMETER <IRunCommandInputParameter[]>: The parameters used by the script.

  • Name <String>: The run command parameter name.
  • Value <String>: The run command parameter value.

PROTECTEDPARAMETER <IRunCommandInputParameter[]>: The parameters used by the script.

  • Name <String>: The run command parameter name.
  • Value <String>: The run command parameter value.