Actions4
Run Azure Virtual Machine Command
AI-generatedSummary
Executes a script or command on a specified Azure Virtual Machine using the Azure Run Command API.
Inputs
- subscriptionId (required) — The ID of the Azure Subscription.
- managementEndpoint (required) — The Azure Management API endpoint (default: https://management.azure.com).
- apiVersion (required) — The API version to use for Azure requests (default: 2018-04-01).
- resourceGroupName (required) — The name of the resource group containing the virtual machine.
- vmName (required) — The name or ID of the target virtual machine. Can be selected from a dynamic list or specified via expression.
- commandId (required) — The Azure Run Command ID (e.g., RunShellScript, RunPowerShellScript).
- script (required) — The script to run on the virtual machine. Multiple lines are supported.
Output shape
The raw response from the Azure API, typically a list of objects containing status, outputs, and error details of the command execution.
The script is sent as an array of strings. Empty lines are trimmed and removed.
Examples
Example 1: Execute a shell command to check system logs
Set Command ID to 'RunShellScript' and script to 'tail -n 100 /var/log/syslog'.
Example 2: Run a PowerShell script to configure a service
Set Command ID to 'RunPowerShellScript' and script to 'Restart-Service MyService'.