machine_run_commands
Creates, updates, deletes, gets or lists a machine_run_commands resource.
Overview
| Name | machine_run_commands |
| Type | Resource |
| Id | azure.hybrid_compute.machine_run_commands |
Fields
The following fields are returned by SELECT queries:
- get
- 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 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 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. |
runAsPassword | string | Specifies the user account password on the machine when executing the run command. |
runAsUser | string | Specifies the user account on the machine 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. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| 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 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 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. |
runAsPassword | string | Specifies the user account password on the machine when executing the run command. |
runAsUser | string | Specifies the user account on the machine 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. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_group_name, machine_name, run_command_name, subscription_id | The operation to get a run command. | |
list | select | resource_group_name, machine_name, subscription_id | $expand | The operation to get all the run commands of a non-Azure machine. |
create_or_update | insert | resource_group_name, machine_name, run_command_name, subscription_id, location | The operation to create or update a run command. | |
create_or_update | replace | resource_group_name, machine_name, run_command_name, subscription_id, location | The operation to create or update a run command. | |
delete | delete | resource_group_name, machine_name, run_command_name, subscription_id | The operation to delete a 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 |
|---|---|---|
machine_name | string | The name of the hybrid machine. 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 run command. Required. |
subscription_id | string | |
$expand | string | The expand expression to apply on the operation. Default value is None. |
SELECT examples
- get
- list
The operation to get a run command.
SELECT
id,
name,
asyncExecution,
errorBlobManagedIdentity,
errorBlobUri,
instanceView,
location,
outputBlobManagedIdentity,
outputBlobUri,
parameters,
protectedParameters,
provisioningState,
runAsPassword,
runAsUser,
source,
systemData,
tags,
timeoutInSeconds,
type
FROM azure.hybrid_compute.machine_run_commands
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND machine_name = '{{ machine_name }}' -- required
AND run_command_name = '{{ run_command_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
The operation to get all the run commands of a non-Azure machine.
SELECT
id,
name,
asyncExecution,
errorBlobManagedIdentity,
errorBlobUri,
instanceView,
location,
outputBlobManagedIdentity,
outputBlobUri,
parameters,
protectedParameters,
provisioningState,
runAsPassword,
runAsUser,
source,
systemData,
tags,
timeoutInSeconds,
type
FROM azure.hybrid_compute.machine_run_commands
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND machine_name = '{{ machine_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
;
INSERT examples
- create_or_update
- Manifest
The operation to create or update a run command.
INSERT INTO azure.hybrid_compute.machine_run_commands (
tags,
location,
properties,
resource_group_name,
machine_name,
run_command_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ resource_group_name }}',
'{{ machine_name }}',
'{{ run_command_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
location,
properties,
systemData,
tags,
type
;
# Description fields are for documentation purposes
- name: machine_run_commands
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the machine_run_commands resource.
- name: machine_name
value: "{{ machine_name }}"
description: Required parameter for the machine_run_commands resource.
- name: run_command_name
value: "{{ run_command_name }}"
description: Required parameter for the machine_run_commands resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the 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 Run Command Properties.
value:
source:
script: "{{ script }}"
scriptUri: "{{ scriptUri }}"
commandId: "{{ commandId }}"
scriptUriManagedIdentity:
clientId: "{{ clientId }}"
objectId: "{{ objectId }}"
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 }}"
REPLACE examples
- create_or_update
The operation to create or update a run command.
REPLACE azure.hybrid_compute.machine_run_commands
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND machine_name = '{{ machine_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 a run command.
DELETE FROM azure.hybrid_compute.machine_run_commands
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND machine_name = '{{ machine_name }}' --required
AND run_command_name = '{{ run_command_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;