PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}/?api-version=2023-09-01

The operation to update the VMSS VM run command.

Servers

Path parameters

Name Type Required Description
vmScaleSetName String Yes

The name of the VM scale set.

instanceId String Yes

The instance ID of the virtual machine.

runCommandName String Yes

The name of the virtual machine run command.

subscriptionId String Yes

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

resourceGroupName String Yes

The name of the resource group.

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
properties Object No

Describes the properties of a Virtual Machine run command.

properties.source Object No

Describes the script sources for run command. Use only one of script, scriptUri, commandId.

properties.source.commandId String No

Specifies a commandId of predefined built-in script.

properties.source.scriptUri String No

Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI.

properties.source.script String No

Specifies the script content to be executed on the VM.

properties.source.scriptUriManagedIdentity Object No

Contains clientId or objectId (use only one, not both) of a user-assigned managed identity that has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object in case of system-assigned identity. Make sure the Azure storage blob exists in case of scriptUri, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment with scriptUri blob and 'Storage Blob Data Contributor' for Append blobs(outputBlobUri, errorBlobUri). In case of user assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged.

properties.source.scriptUriManagedIdentity.objectId String No

Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided.

properties.source.scriptUriManagedIdentity.clientId String No

Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided.

properties.outputBlobUri String No

Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer outputBlobManagedIdentity parameter.

properties.asyncExecution Boolean No

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

Default value: false

properties.outputBlobManagedIdentity Object No

Contains clientId or objectId (use only one, not both) of a user-assigned managed identity that has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object in case of system-assigned identity. Make sure the Azure storage blob exists in case of scriptUri, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment with scriptUri blob and 'Storage Blob Data Contributor' for Append blobs(outputBlobUri, errorBlobUri). In case of user assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged.

properties.outputBlobManagedIdentity.objectId String No

Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided.

properties.outputBlobManagedIdentity.clientId String No

Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided.

properties.runAsUser String No

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

properties.protectedParameters[] Array No

The parameters used by the script.

properties.protectedParameters[].name String Yes

The run command parameter name.

properties.protectedParameters[].value String Yes

The run command parameter value.

properties.instanceView Object No

The instance view of a virtual machine run command.

properties.instanceView.executionMessage String No

Communicate script configuration errors or execution messages.

properties.instanceView.startTime String No

Script start time.

properties.instanceView.exitCode Integer No

Exit code returned from script execution.

properties.instanceView.output String No

Script output stream.

properties.instanceView.error String No

Script error stream.

properties.instanceView.statuses[] Array No

The resource status information.

properties.instanceView.statuses[].time String No

The time of the status.

properties.instanceView.statuses[].displayStatus String No

The short localizable label for the status.

properties.instanceView.statuses[].message String No

The detailed status message, including for alerts and error messages.

properties.instanceView.statuses[].level String No

The level code.

Possible values:

  • "Error"
  • "Warning"
  • "Info"
properties.instanceView.statuses[].code String No

The status code.

properties.instanceView.endTime String No

Script end time.

properties.instanceView.executionState String No

Script execution status.

Possible values:

  • "Running"
  • "TimedOut"
  • "Succeeded"
  • "Unknown"
  • "Pending"
  • "Canceled"
  • "Failed"
properties.treatFailureAsDeploymentFailure Boolean No

Optional. If set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results

Default value: false

properties.parameters[] Array No

The parameters used by the script.

properties.parameters[].name String Yes

The run command parameter name.

properties.parameters[].value String Yes

The run command parameter value.

properties.errorBlobManagedIdentity Object No

Contains clientId or objectId (use only one, not both) of a user-assigned managed identity that has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object in case of system-assigned identity. Make sure the Azure storage blob exists in case of scriptUri, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment with scriptUri blob and 'Storage Blob Data Contributor' for Append blobs(outputBlobUri, errorBlobUri). In case of user assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged.

properties.errorBlobManagedIdentity.objectId String No

Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided.

properties.errorBlobManagedIdentity.clientId String No

Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided.

properties.provisioningState String No

The provisioning state, which only appears in the response. If treatFailureAsDeploymentFailure set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If treatFailureAsDeploymentFailure set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results

properties.timeoutInSeconds Integer No

The timeout in seconds to execute the run command.

properties.errorBlobUri String No

Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer errorBlobManagedIdentity parameter.

properties.runAsPassword String No

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

tags Object No

Resource tags

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.