Machine Run Command Args
Describes a Run Command Uses Azure REST API version 2024-07-31-preview. In version 2.x of the Azure Native provider, it used API version 2023-10-03-preview. Other available API versions: 2023-10-03-preview, 2024-03-31-preview, 2024-05-20-preview, 2024-09-10-preview, 2024-11-10-preview, 2025-01-13, 2025-02-19-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native hybridcompute [ApiVersion]
. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.
Example Usage
Create or Update a Run Command
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var machineRunCommand = new AzureNative.HybridCompute.MachineRunCommand("machineRunCommand", new()
{
AsyncExecution = false,
ErrorBlobUri = "https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt",
Location = "eastus2",
MachineName = "myMachine",
OutputBlobUri = "https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt",
Parameters = new[]
{
new AzureNative.HybridCompute.Inputs.RunCommandInputParameterArgs
{
Name = "param1",
Value = "value1",
},
new AzureNative.HybridCompute.Inputs.RunCommandInputParameterArgs
{
Name = "param2",
Value = "value2",
},
},
ResourceGroupName = "myResourceGroup",
RunAsPassword = "<runAsPassword>",
RunAsUser = "user1",
RunCommandName = "myRunCommand",
Source = new AzureNative.HybridCompute.Inputs.MachineRunCommandScriptSourceArgs
{
Script = "Write-Host Hello World!",
},
TimeoutInSeconds = 3600,
});
});
package main
import (
hybridcompute "github.com/pulumi/pulumi-azure-native-sdk/hybridcompute/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := hybridcompute.NewMachineRunCommand(ctx, "machineRunCommand", &hybridcompute.MachineRunCommandArgs{
AsyncExecution: pulumi.Bool(false),
ErrorBlobUri: pulumi.String("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"),
Location: pulumi.String("eastus2"),
MachineName: pulumi.String("myMachine"),
OutputBlobUri: pulumi.String("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"),
Parameters: hybridcompute.RunCommandInputParameterArray{
&hybridcompute.RunCommandInputParameterArgs{
Name: pulumi.String("param1"),
Value: pulumi.String("value1"),
},
&hybridcompute.RunCommandInputParameterArgs{
Name: pulumi.String("param2"),
Value: pulumi.String("value2"),
},
},
ResourceGroupName: pulumi.String("myResourceGroup"),
RunAsPassword: pulumi.String("<runAsPassword>"),
RunAsUser: pulumi.String("user1"),
RunCommandName: pulumi.String("myRunCommand"),
Source: &hybridcompute.MachineRunCommandScriptSourceArgs{
Script: pulumi.String("Write-Host Hello World!"),
},
TimeoutInSeconds: pulumi.Int(3600),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.hybridcompute.MachineRunCommand;
import com.pulumi.azurenative.hybridcompute.MachineRunCommandArgs;
import com.pulumi.azurenative.hybridcompute.inputs.RunCommandInputParameterArgs;
import com.pulumi.azurenative.hybridcompute.inputs.MachineRunCommandScriptSourceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var machineRunCommand = new MachineRunCommand("machineRunCommand", MachineRunCommandArgs.builder()
.asyncExecution(false)
.errorBlobUri("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt")
.location("eastus2")
.machineName("myMachine")
.outputBlobUri("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt")
.parameters(
RunCommandInputParameterArgs.builder()
.name("param1")
.value("value1")
.build(),
RunCommandInputParameterArgs.builder()
.name("param2")
.value("value2")
.build())
.resourceGroupName("myResourceGroup")
.runAsPassword("<runAsPassword>")
.runAsUser("user1")
.runCommandName("myRunCommand")
.source(MachineRunCommandScriptSourceArgs.builder()
.script("Write-Host Hello World!")
.build())
.timeoutInSeconds(3600)
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:hybridcompute:MachineRunCommand myRunCommand /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}
Constructors
Properties
Optional. If set to true, provisioning will complete as soon as script starts and will not wait for script to complete.
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
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.
The name of the hybrid machine.
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
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.
The parameters used by the script.
The parameters used by the script.
The name of the resource group. The name is case insensitive.
Specifies the user account password on the machine when executing the run command.
The name of the run command.
The source of the run command script.
The timeout in seconds to execute the run command.