Skip to main content

machine_run_commands

Creates, updates, deletes, gets or lists a machine_run_commands resource.

Overview

Namemachine_run_commands
TypeResource
Idazure.hybrid_compute.machine_run_commands

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
asyncExecutionbooleanOptional. If set to true, provisioning will complete as soon as script starts and will not wait for script to complete.
errorBlobManagedIdentityobjectUser-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 _.
errorBlobUristringSpecifies 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.
instanceViewobjectThe machine run command instance view.
locationstringThe geo-location where the resource lives. Required.
outputBlobManagedIdentityobjectUser-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 _.
outputBlobUristringSpecifies 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.
parametersarrayThe parameters used by the script.
protectedParametersarrayThe parameters used by the script.
provisioningStatestringThe provisioning state, which only appears in the response.
runAsPasswordstringSpecifies the user account password on the machine when executing the run command.
runAsUserstringSpecifies the user account on the machine when executing the run command.
sourceobjectThe source of the run command script.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectResource tags.
timeoutInSecondsintegerThe timeout in seconds to execute the run command.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, machine_name, run_command_name, subscription_idThe operation to get a run command.
listselectresource_group_name, machine_name, subscription_id$expandThe operation to get all the run commands of a non-Azure machine.
create_or_updateinsertresource_group_name, machine_name, run_command_name, subscription_id, locationThe operation to create or update a run command.
create_or_updatereplaceresource_group_name, machine_name, run_command_name, subscription_id, locationThe operation to create or update a run command.
deletedeleteresource_group_name, machine_name, run_command_name, subscription_idThe 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.

NameDatatypeDescription
machine_namestringThe name of the hybrid machine. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
run_command_namestringThe name of the run command. Required.
subscription_idstring
$expandstringThe expand expression to apply on the operation. Default value is None.

SELECT examples

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
;

INSERT examples

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
;

REPLACE examples

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

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
;