VirtualMachineRunCommandByVirtualMachineArgs

data class VirtualMachineRunCommandByVirtualMachineArgs(val asyncExecution: Output<Boolean>? = null, val errorBlobManagedIdentity: Output<RunCommandManagedIdentityArgs>? = null, val errorBlobUri: Output<String>? = null, val location: Output<String>? = null, val outputBlobManagedIdentity: Output<RunCommandManagedIdentityArgs>? = null, val outputBlobUri: Output<String>? = null, val parameters: Output<List<RunCommandInputParameterArgs>>? = null, val protectedParameters: Output<List<RunCommandInputParameterArgs>>? = null, val resourceGroupName: Output<String>? = null, val runAsPassword: Output<String>? = null, val runAsUser: Output<String>? = null, val runCommandName: Output<String>? = null, val source: Output<VirtualMachineRunCommandScriptSourceArgs>? = null, val tags: Output<Map<String, String>>? = null, val timeoutInSeconds: Output<Int>? = null, val treatFailureAsDeploymentFailure: Output<Boolean>? = null, val vmName: Output<String>? = null) : ConvertibleToJava<VirtualMachineRunCommandByVirtualMachineArgs>

Describes a Virtual Machine run command. Uses Azure REST API version 2024-11-01. In version 2.x of the Azure Native provider, it used API version 2023-03-01. Other available API versions: 2022-08-01, 2022-11-01, 2023-03-01, 2023-07-01, 2023-09-01, 2024-03-01, 2024-07-01. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native compute [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 virtualMachineRunCommandByVirtualMachine = new AzureNative.Compute.VirtualMachineRunCommandByVirtualMachine("virtualMachineRunCommandByVirtualMachine", new()
{
AsyncExecution = false,
ErrorBlobUri = "https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI",
Location = "West US",
OutputBlobManagedIdentity = new AzureNative.Compute.Inputs.RunCommandManagedIdentityArgs
{
ClientId = "22d35efb-0c99-4041-8c5b-6d24db33a69a",
},
OutputBlobUri = "https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt",
Parameters = new[]
{
new AzureNative.Compute.Inputs.RunCommandInputParameterArgs
{
Name = "param1",
Value = "value1",
},
new AzureNative.Compute.Inputs.RunCommandInputParameterArgs
{
Name = "param2",
Value = "value2",
},
},
ResourceGroupName = "myResourceGroup",
RunAsPassword = "<runAsPassword>",
RunAsUser = "user1",
RunCommandName = "myRunCommand",
Source = new AzureNative.Compute.Inputs.VirtualMachineRunCommandScriptSourceArgs
{
ScriptUri = "https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI",
},
TimeoutInSeconds = 3600,
TreatFailureAsDeploymentFailure = false,
VmName = "myVM",
});
});
package main
import (
compute "github.com/pulumi/pulumi-azure-native-sdk/compute/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewVirtualMachineRunCommandByVirtualMachine(ctx, "virtualMachineRunCommandByVirtualMachine", &compute.VirtualMachineRunCommandByVirtualMachineArgs{
AsyncExecution: pulumi.Bool(false),
ErrorBlobUri: pulumi.String("https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI"),
Location: pulumi.String("West US"),
OutputBlobManagedIdentity: &compute.RunCommandManagedIdentityArgs{
ClientId: pulumi.String("22d35efb-0c99-4041-8c5b-6d24db33a69a"),
},
OutputBlobUri: pulumi.String("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"),
Parameters: compute.RunCommandInputParameterArray{
&compute.RunCommandInputParameterArgs{
Name: pulumi.String("param1"),
Value: pulumi.String("value1"),
},
&compute.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: &compute.VirtualMachineRunCommandScriptSourceArgs{
ScriptUri: pulumi.String("https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI"),
},
TimeoutInSeconds: pulumi.Int(3600),
TreatFailureAsDeploymentFailure: pulumi.Bool(false),
VmName: pulumi.String("myVM"),
})
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.compute.VirtualMachineRunCommandByVirtualMachine;
import com.pulumi.azurenative.compute.VirtualMachineRunCommandByVirtualMachineArgs;
import com.pulumi.azurenative.compute.inputs.RunCommandManagedIdentityArgs;
import com.pulumi.azurenative.compute.inputs.RunCommandInputParameterArgs;
import com.pulumi.azurenative.compute.inputs.VirtualMachineRunCommandScriptSourceArgs;
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 virtualMachineRunCommandByVirtualMachine = new VirtualMachineRunCommandByVirtualMachine("virtualMachineRunCommandByVirtualMachine", VirtualMachineRunCommandByVirtualMachineArgs.builder()
.asyncExecution(false)
.errorBlobUri("https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI")
.location("West US")
.outputBlobManagedIdentity(RunCommandManagedIdentityArgs.builder()
.clientId("22d35efb-0c99-4041-8c5b-6d24db33a69a")
.build())
.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(VirtualMachineRunCommandScriptSourceArgs.builder()
.scriptUri("https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI")
.build())
.timeoutInSeconds(3600)
.treatFailureAsDeploymentFailure(false)
.vmName("myVM")
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:compute:VirtualMachineRunCommandByVirtualMachine myRunCommand /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}

Constructors

constructor(asyncExecution: Output<Boolean>? = null, errorBlobManagedIdentity: Output<RunCommandManagedIdentityArgs>? = null, errorBlobUri: Output<String>? = null, location: Output<String>? = null, outputBlobManagedIdentity: Output<RunCommandManagedIdentityArgs>? = null, outputBlobUri: Output<String>? = null, parameters: Output<List<RunCommandInputParameterArgs>>? = null, protectedParameters: Output<List<RunCommandInputParameterArgs>>? = null, resourceGroupName: Output<String>? = null, runAsPassword: Output<String>? = null, runAsUser: Output<String>? = null, runCommandName: Output<String>? = null, source: Output<VirtualMachineRunCommandScriptSourceArgs>? = null, tags: Output<Map<String, String>>? = null, timeoutInSeconds: Output<Int>? = null, treatFailureAsDeploymentFailure: Output<Boolean>? = null, vmName: Output<String>? = null)

Properties

Link copied to clipboard
val asyncExecution: Output<Boolean>? = null

Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete.

Link copied to clipboard

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

Link copied to clipboard
val errorBlobUri: Output<String>? = null

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.

Link copied to clipboard
val location: Output<String>? = null

Resource location

Link copied to clipboard

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

Link copied to clipboard
val outputBlobUri: Output<String>? = null

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.

Link copied to clipboard

The parameters used by the script.

Link copied to clipboard

The parameters used by the script.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group.

Link copied to clipboard
val runAsPassword: Output<String>? = null

Specifies the user account password on the VM when executing the run command.

Link copied to clipboard
val runAsUser: Output<String>? = null

Specifies the user account on the VM when executing the run command.

Link copied to clipboard
val runCommandName: Output<String>? = null

The name of the virtual machine run command.

Link copied to clipboard

The source of the run command script.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Resource tags

Link copied to clipboard
val timeoutInSeconds: Output<Int>? = null

The timeout in seconds to execute the run command.

Link copied to clipboard

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

Link copied to clipboard
val vmName: Output<String>? = null

The name of the virtual machine where the run command should be created or updated.

Functions

Link copied to clipboard
open override fun toJava(): VirtualMachineRunCommandByVirtualMachineArgs