virtual_machine_run_commands
Creates, updates, deletes, gets or lists a virtual_machine_run_commands resource.
Overview
| Name | virtual_machine_run_commands |
| Type | Resource |
| Id | azure.compute.virtual_machine_run_commands |
Fields
The following fields are returned by SELECT queries:
- get_by_virtual_machine
- get
- list_by_virtual_machine
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
asyncExecution | boolean | Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. |
errorBlobManagedIdentity | object | User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. 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 _. |
errorBlobUri | string | 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. |
instanceView | object | The virtual machine run command instance view. |
location | string | The geo-location where the resource lives. Required. |
outputBlobManagedIdentity | object | User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. 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 _. |
outputBlobUri | string | 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. |
parameters | array | The parameters used by the script. |
protectedParameters | array | The parameters used by the script. |
provisioningState | string | 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 _. |
runAsPassword | string | Specifies the user account password on the VM when executing the run command. |
runAsUser | string | Specifies the user account on the VM when executing the run command. |
source | object | The source of the run command script. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeoutInSeconds | integer | The timeout in seconds to execute the run command. |
treatFailureAsDeploymentFailure | boolean | 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 _. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | The VM run command id. Required. |
$schema | string | The VM run command schema. Required. |
description | string | The VM run command description. Required. |
label | string | The VM run command label. Required. |
osType | string | The Operating System type. Required. Known values are: "Windows" and "Linux". (Windows, Linux) |
parameters | array | The parameters used by the script. |
script | array | The script to be executed. Required. |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
asyncExecution | boolean | Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. |
errorBlobManagedIdentity | object | User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. 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 _. |
errorBlobUri | string | 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. |
instanceView | object | The virtual machine run command instance view. |
location | string | The geo-location where the resource lives. Required. |
outputBlobManagedIdentity | object | User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. 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 _. |
outputBlobUri | string | 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. |
parameters | array | The parameters used by the script. |
protectedParameters | array | The parameters used by the script. |
provisioningState | string | 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 _. |
runAsPassword | string | Specifies the user account password on the VM when executing the run command. |
runAsUser | string | Specifies the user account on the VM when executing the run command. |
source | object | The source of the run command script. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeoutInSeconds | integer | The timeout in seconds to execute the run command. |
treatFailureAsDeploymentFailure | boolean | 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 _. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | The VM run command id. Required. |
$schema | string | The VM run command schema. Required. |
description | string | The VM run command description. Required. |
label | string | The VM run command label. Required. |
osType | string | The Operating System type. Required. Known values are: "Windows" and "Linux". (Windows, Linux) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_by_virtual_machine | select | resource_group_name, vm_name, run_command_name, subscription_id | $expand | The operation to get the run command. |
get | select | location, command_id, subscription_id | Gets specific run command for a subscription in a location. | |
list_by_virtual_machine | select | resource_group_name, vm_name, subscription_id | $expand | The operation to get all run commands of a Virtual Machine. |
list | select | location, subscription_id | Lists all available run commands for a subscription in a location. | |
create_or_update | insert | resource_group_name, vm_name, run_command_name, subscription_id, location | The operation to create or update the run command. | |
update | update | resource_group_name, vm_name, run_command_name, subscription_id | The operation to update the run command. | |
create_or_update | replace | resource_group_name, vm_name, run_command_name, subscription_id, location | The operation to create or update the run command. | |
delete | delete | resource_group_name, vm_name, run_command_name, subscription_id | The operation to delete the run command. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
command_id | string | Specifies a commandId of predefined built-in script. Command IDs available for Linux are listed at https://aka.ms/RunCommandManagedLinux#available-commands , Windows at https://aka.ms/RunCommandManagedWindows#available-commands . Required. |
location | string | The location name. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
run_command_name | string | The name of the VirtualMachineRunCommand. Required. |
subscription_id | string | |
vm_name | string | The name of the VirtualMachine. Required. |
$expand | string | The expand expression to apply on the operation. Default value is None. |
SELECT examples
- get_by_virtual_machine
- get
- list_by_virtual_machine
- list
The operation to get the run command.
SELECT
id,
name,
asyncExecution,
errorBlobManagedIdentity,
errorBlobUri,
instanceView,
location,
outputBlobManagedIdentity,
outputBlobUri,
parameters,
protectedParameters,
provisioningState,
runAsPassword,
runAsUser,
source,
systemData,
tags,
timeoutInSeconds,
treatFailureAsDeploymentFailure,
type
FROM azure.compute.virtual_machine_run_commands
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND vm_name = '{{ vm_name }}' -- required
AND run_command_name = '{{ run_command_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
;
Gets specific run command for a subscription in a location.
SELECT
id,
$schema,
description,
label,
osType,
parameters,
script
FROM azure.compute.virtual_machine_run_commands
WHERE location = '{{ location }}' -- required
AND command_id = '{{ command_id }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
The operation to get all run commands of a Virtual Machine.
SELECT
id,
name,
asyncExecution,
errorBlobManagedIdentity,
errorBlobUri,
instanceView,
location,
outputBlobManagedIdentity,
outputBlobUri,
parameters,
protectedParameters,
provisioningState,
runAsPassword,
runAsUser,
source,
systemData,
tags,
timeoutInSeconds,
treatFailureAsDeploymentFailure,
type
FROM azure.compute.virtual_machine_run_commands
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND vm_name = '{{ vm_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
;
Lists all available run commands for a subscription in a location.
SELECT
id,
$schema,
description,
label,
osType
FROM azure.compute.virtual_machine_run_commands
WHERE location = '{{ location }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
INSERT examples
- create_or_update
- Manifest
The operation to create or update the run command.
INSERT INTO azure.compute.virtual_machine_run_commands (
tags,
location,
properties,
resource_group_name,
vm_name,
run_command_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ resource_group_name }}',
'{{ vm_name }}',
'{{ run_command_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
location,
properties,
systemData,
tags,
type
;
# Description fields are for documentation purposes
- name: virtual_machine_run_commands
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the virtual_machine_run_commands resource.
- name: vm_name
value: "{{ vm_name }}"
description: Required parameter for the virtual_machine_run_commands resource.
- name: run_command_name
value: "{{ run_command_name }}"
description: Required parameter for the virtual_machine_run_commands resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the virtual_machine_run_commands resource.
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
- name: location
value: "{{ location }}"
description: |
The geo-location where the resource lives. Required.
- name: properties
description: |
Describes the properties of a Virtual Machine run command.
value:
source:
script: "{{ script }}"
scriptUri: "{{ scriptUri }}"
commandId: "{{ commandId }}"
scriptUriManagedIdentity:
clientId: "{{ clientId }}"
objectId: "{{ objectId }}"
scriptShell: "{{ scriptShell }}"
galleryScriptReferenceId: "{{ galleryScriptReferenceId }}"
parameters:
- name: "{{ name }}"
value: "{{ value }}"
protectedParameters:
- name: "{{ name }}"
value: "{{ value }}"
asyncExecution: {{ asyncExecution }}
runAsUser: "{{ runAsUser }}"
runAsPassword: "{{ runAsPassword }}"
timeoutInSeconds: {{ timeoutInSeconds }}
outputBlobUri: "{{ outputBlobUri }}"
errorBlobUri: "{{ errorBlobUri }}"
outputBlobManagedIdentity:
clientId: "{{ clientId }}"
objectId: "{{ objectId }}"
errorBlobManagedIdentity:
clientId: "{{ clientId }}"
objectId: "{{ objectId }}"
provisioningState: "{{ provisioningState }}"
instanceView:
executionState: "{{ executionState }}"
executionMessage: "{{ executionMessage }}"
exitCode: {{ exitCode }}
output: "{{ output }}"
error: "{{ error }}"
startTime: "{{ startTime }}"
endTime: "{{ endTime }}"
statuses:
- code: "{{ code }}"
level: "{{ level }}"
displayStatus: "{{ displayStatus }}"
message: "{{ message }}"
time: "{{ time }}"
treatFailureAsDeploymentFailure: {{ treatFailureAsDeploymentFailure }}
UPDATE examples
- update
The operation to update the run command.
UPDATE azure.compute.virtual_machine_run_commands
SET
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND vm_name = '{{ vm_name }}' --required
AND run_command_name = '{{ run_command_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
location,
properties,
systemData,
tags,
type;
REPLACE examples
- create_or_update
The operation to create or update the run command.
REPLACE azure.compute.virtual_machine_run_commands
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND vm_name = '{{ vm_name }}' --required
AND run_command_name = '{{ run_command_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND location = '{{ location }}' --required
RETURNING
id,
name,
location,
properties,
systemData,
tags,
type;
DELETE examples
- delete
The operation to delete the run command.
DELETE FROM azure.compute.virtual_machine_run_commands
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND vm_name = '{{ vm_name }}' --required
AND run_command_name = '{{ run_command_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;