VirtualMachineArgs

data class VirtualMachineArgs(val adminUsername: Output<String>? = null, val bootMethod: Output<Either<String, VirtualMachineBootMethod>>? = null, val cloudServicesNetworkAttachment: Output<NetworkAttachmentArgs>? = null, val consoleExtendedLocation: Output<ExtendedLocationArgs>? = null, val cpuCores: Output<Double>? = null, val extendedLocation: Output<ExtendedLocationArgs>? = null, val isolateEmulatorThread: Output<Either<String, VirtualMachineIsolateEmulatorThread>>? = null, val location: Output<String>? = null, val memorySizeGB: Output<Double>? = null, val networkAttachments: Output<List<NetworkAttachmentArgs>>? = null, val networkData: Output<String>? = null, val placementHints: Output<List<VirtualMachinePlacementHintArgs>>? = null, val resourceGroupName: Output<String>? = null, val sshPublicKeys: Output<List<SshPublicKeyArgs>>? = null, val storageProfile: Output<StorageProfileArgs>? = null, val tags: Output<Map<String, String>>? = null, val userData: Output<String>? = null, val virtioInterface: Output<Either<String, VirtualMachineVirtioInterfaceType>>? = null, val virtualMachineName: Output<String>? = null, val vmDeviceModel: Output<Either<String, VirtualMachineDeviceModelType>>? = null, val vmImage: Output<String>? = null, val vmImageRepositoryCredentials: Output<ImageRepositoryCredentialsArgs>? = null) : ConvertibleToJava<VirtualMachineArgs>

Uses Azure REST API version 2025-02-01. In version 2.x of the Azure Native provider, it used API version 2023-10-01-preview. Other available API versions: 2023-10-01-preview, 2024-06-01-preview, 2024-07-01, 2024-10-01-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native networkcloud [ApiVersion]. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.

Example Usage

Create or update virtual machine

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var virtualMachine = new AzureNative.NetworkCloud.VirtualMachine("virtualMachine", new()
{
AdminUsername = "username",
BootMethod = AzureNative.NetworkCloud.VirtualMachineBootMethod.UEFI,
CloudServicesNetworkAttachment = new AzureNative.NetworkCloud.Inputs.NetworkAttachmentArgs
{
AttachedNetworkId = "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloudServicesNetworkName",
IpAllocationMethod = AzureNative.NetworkCloud.VirtualMachineIPAllocationMethod.Dynamic,
},
CpuCores = 2,
ExtendedLocation = new AzureNative.NetworkCloud.Inputs.ExtendedLocationArgs
{
Name = "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName",
Type = "CustomLocation",
},
Location = "location",
MemorySizeGB = 8,
NetworkAttachments = new[]
{
new AzureNative.NetworkCloud.Inputs.NetworkAttachmentArgs
{
AttachedNetworkId = "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/l3Networks/l3NetworkName",
DefaultGateway = AzureNative.NetworkCloud.DefaultGateway.True,
IpAllocationMethod = AzureNative.NetworkCloud.VirtualMachineIPAllocationMethod.Dynamic,
Ipv4Address = "198.51.100.1",
Ipv6Address = "2001:0db8:0000:0000:0000:0000:0000:0000",
NetworkAttachmentName = "netAttachName01",
},
},
NetworkData = "bmV0d29ya0RhdGVTYW1wbGU=",
PlacementHints = new[]
{
new AzureNative.NetworkCloud.Inputs.VirtualMachinePlacementHintArgs
{
HintType = AzureNative.NetworkCloud.VirtualMachinePlacementHintType.Affinity,
ResourceId = "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/racks/rackName",
SchedulingExecution = AzureNative.NetworkCloud.VirtualMachineSchedulingExecution.Hard,
Scope = "",
},
},
ResourceGroupName = "resourceGroupName",
SshPublicKeys = new[]
{
new AzureNative.NetworkCloud.Inputs.SshPublicKeyArgs
{
KeyData = "ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm",
},
},
StorageProfile = new AzureNative.NetworkCloud.Inputs.StorageProfileArgs
{
OsDisk = new AzureNative.NetworkCloud.Inputs.OsDiskArgs
{
CreateOption = AzureNative.NetworkCloud.OsDiskCreateOption.Ephemeral,
DeleteOption = AzureNative.NetworkCloud.OsDiskDeleteOption.Delete,
DiskSizeGB = 120,
},
VolumeAttachments = new[]
{
"/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName",
},
},
Tags =
{
{ "key1", "myvalue1" },
{ "key2", "myvalue2" },
},
UserData = "dXNlckRhdGVTYW1wbGU=",
VirtualMachineName = "virtualMachineName",
VmDeviceModel = AzureNative.NetworkCloud.VirtualMachineDeviceModelType.T2,
VmImage = "myacr.azurecr.io/foobar:latest",
VmImageRepositoryCredentials = new AzureNative.NetworkCloud.Inputs.ImageRepositoryCredentialsArgs
{
Password = "{password}",
RegistryUrl = "myacr.azurecr.io",
Username = "myuser",
},
});
});
package main
import (
networkcloud "github.com/pulumi/pulumi-azure-native-sdk/networkcloud/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := networkcloud.NewVirtualMachine(ctx, "virtualMachine", &networkcloud.VirtualMachineArgs{
AdminUsername: pulumi.String("username"),
BootMethod: pulumi.String(networkcloud.VirtualMachineBootMethodUEFI),
CloudServicesNetworkAttachment: &networkcloud.NetworkAttachmentArgs{
AttachedNetworkId: pulumi.String("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloudServicesNetworkName"),
IpAllocationMethod: pulumi.String(networkcloud.VirtualMachineIPAllocationMethodDynamic),
},
CpuCores: pulumi.Float64(2),
ExtendedLocation: &networkcloud.ExtendedLocationArgs{
Name: pulumi.String("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName"),
Type: pulumi.String("CustomLocation"),
},
Location: pulumi.String("location"),
MemorySizeGB: pulumi.Float64(8),
NetworkAttachments: networkcloud.NetworkAttachmentArray{
&networkcloud.NetworkAttachmentArgs{
AttachedNetworkId: pulumi.String("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/l3Networks/l3NetworkName"),
DefaultGateway: pulumi.String(networkcloud.DefaultGatewayTrue),
IpAllocationMethod: pulumi.String(networkcloud.VirtualMachineIPAllocationMethodDynamic),
Ipv4Address: pulumi.String("198.51.100.1"),
Ipv6Address: pulumi.String("2001:0db8:0000:0000:0000:0000:0000:0000"),
NetworkAttachmentName: pulumi.String("netAttachName01"),
},
},
NetworkData: pulumi.String("bmV0d29ya0RhdGVTYW1wbGU="),
PlacementHints: networkcloud.VirtualMachinePlacementHintArray{
&networkcloud.VirtualMachinePlacementHintArgs{
HintType: pulumi.String(networkcloud.VirtualMachinePlacementHintTypeAffinity),
ResourceId: pulumi.String("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/racks/rackName"),
SchedulingExecution: pulumi.String(networkcloud.VirtualMachineSchedulingExecutionHard),
Scope: pulumi.String(""),
},
},
ResourceGroupName: pulumi.String("resourceGroupName"),
SshPublicKeys: networkcloud.SshPublicKeyArray{
&networkcloud.SshPublicKeyArgs{
KeyData: pulumi.String("ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"),
},
},
StorageProfile: &networkcloud.StorageProfileArgs{
OsDisk: &networkcloud.OsDiskArgs{
CreateOption: pulumi.String(networkcloud.OsDiskCreateOptionEphemeral),
DeleteOption: pulumi.String(networkcloud.OsDiskDeleteOptionDelete),
DiskSizeGB: pulumi.Float64(120),
},
VolumeAttachments: pulumi.StringArray{
pulumi.String("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName"),
},
},
Tags: pulumi.StringMap{
"key1": pulumi.String("myvalue1"),
"key2": pulumi.String("myvalue2"),
},
UserData: pulumi.String("dXNlckRhdGVTYW1wbGU="),
VirtualMachineName: pulumi.String("virtualMachineName"),
VmDeviceModel: pulumi.String(networkcloud.VirtualMachineDeviceModelTypeT2),
VmImage: pulumi.String("myacr.azurecr.io/foobar:latest"),
VmImageRepositoryCredentials: &networkcloud.ImageRepositoryCredentialsArgs{
Password: pulumi.String("{password}"),
RegistryUrl: pulumi.String("myacr.azurecr.io"),
Username: pulumi.String("myuser"),
},
})
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.networkcloud.VirtualMachine;
import com.pulumi.azurenative.networkcloud.VirtualMachineArgs;
import com.pulumi.azurenative.networkcloud.inputs.NetworkAttachmentArgs;
import com.pulumi.azurenative.networkcloud.inputs.ExtendedLocationArgs;
import com.pulumi.azurenative.networkcloud.inputs.VirtualMachinePlacementHintArgs;
import com.pulumi.azurenative.networkcloud.inputs.SshPublicKeyArgs;
import com.pulumi.azurenative.networkcloud.inputs.StorageProfileArgs;
import com.pulumi.azurenative.networkcloud.inputs.OsDiskArgs;
import com.pulumi.azurenative.networkcloud.inputs.ImageRepositoryCredentialsArgs;
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 virtualMachine = new VirtualMachine("virtualMachine", VirtualMachineArgs.builder()
.adminUsername("username")
.bootMethod("UEFI")
.cloudServicesNetworkAttachment(NetworkAttachmentArgs.builder()
.attachedNetworkId("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloudServicesNetworkName")
.ipAllocationMethod("Dynamic")
.build())
.cpuCores(2)
.extendedLocation(ExtendedLocationArgs.builder()
.name("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName")
.type("CustomLocation")
.build())
.location("location")
.memorySizeGB(8)
.networkAttachments(NetworkAttachmentArgs.builder()
.attachedNetworkId("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/l3Networks/l3NetworkName")
.defaultGateway("True")
.ipAllocationMethod("Dynamic")
.ipv4Address("198.51.100.1")
.ipv6Address("2001:0db8:0000:0000:0000:0000:0000:0000")
.networkAttachmentName("netAttachName01")
.build())
.networkData("bmV0d29ya0RhdGVTYW1wbGU=")
.placementHints(VirtualMachinePlacementHintArgs.builder()
.hintType("Affinity")
.resourceId("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/racks/rackName")
.schedulingExecution("Hard")
.scope("")
.build())
.resourceGroupName("resourceGroupName")
.sshPublicKeys(SshPublicKeyArgs.builder()
.keyData("ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm")
.build())
.storageProfile(StorageProfileArgs.builder()
.osDisk(OsDiskArgs.builder()
.createOption("Ephemeral")
.deleteOption("Delete")
.diskSizeGB(120)
.build())
.volumeAttachments("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName")
.build())
.tags(Map.ofEntries(
Map.entry("key1", "myvalue1"),
Map.entry("key2", "myvalue2")
))
.userData("dXNlckRhdGVTYW1wbGU=")
.virtualMachineName("virtualMachineName")
.vmDeviceModel("T2")
.vmImage("myacr.azurecr.io/foobar:latest")
.vmImageRepositoryCredentials(ImageRepositoryCredentialsArgs.builder()
.password("{password}")
.registryUrl("myacr.azurecr.io")
.username("myuser")
.build())
.build());
}
}

Import

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

$ pulumi import azure-native:networkcloud:VirtualMachine virtualMachineName /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}

Constructors

Link copied to clipboard
constructor(adminUsername: Output<String>? = null, bootMethod: Output<Either<String, VirtualMachineBootMethod>>? = null, cloudServicesNetworkAttachment: Output<NetworkAttachmentArgs>? = null, consoleExtendedLocation: Output<ExtendedLocationArgs>? = null, cpuCores: Output<Double>? = null, extendedLocation: Output<ExtendedLocationArgs>? = null, isolateEmulatorThread: Output<Either<String, VirtualMachineIsolateEmulatorThread>>? = null, location: Output<String>? = null, memorySizeGB: Output<Double>? = null, networkAttachments: Output<List<NetworkAttachmentArgs>>? = null, networkData: Output<String>? = null, placementHints: Output<List<VirtualMachinePlacementHintArgs>>? = null, resourceGroupName: Output<String>? = null, sshPublicKeys: Output<List<SshPublicKeyArgs>>? = null, storageProfile: Output<StorageProfileArgs>? = null, tags: Output<Map<String, String>>? = null, userData: Output<String>? = null, virtioInterface: Output<Either<String, VirtualMachineVirtioInterfaceType>>? = null, virtualMachineName: Output<String>? = null, vmDeviceModel: Output<Either<String, VirtualMachineDeviceModelType>>? = null, vmImage: Output<String>? = null, vmImageRepositoryCredentials: Output<ImageRepositoryCredentialsArgs>? = null)

Properties

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

The name of the administrator to which the ssh public keys will be added into the authorized keys.

Link copied to clipboard
val bootMethod: Output<Either<String, VirtualMachineBootMethod>>? = null

Selects the boot method for the virtual machine.

Link copied to clipboard

The cloud service network that provides platform-level services for the virtual machine.

Link copied to clipboard

The extended location to use for creation of a VM console resource.

Link copied to clipboard
val cpuCores: Output<Double>? = null

The number of CPU cores in the virtual machine.

Link copied to clipboard

The extended location of the cluster associated with the resource.

Link copied to clipboard

Field Deprecated, the value will be ignored if provided. The indicator of whether one of the specified CPU cores is isolated to run the emulator thread for this virtual machine.

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

The geo-location where the resource lives

Link copied to clipboard
val memorySizeGB: Output<Double>? = null

The memory size of the virtual machine. Allocations are measured in gibibytes.

Link copied to clipboard

The list of network attachments to the virtual machine.

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

The Base64 encoded cloud-init network data.

Link copied to clipboard

The scheduling hints for the virtual machine.

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

The name of the resource group. The name is case insensitive.

Link copied to clipboard
val sshPublicKeys: Output<List<SshPublicKeyArgs>>? = null

The list of ssh public keys. Each key will be added to the virtual machine using the cloud-init ssh_authorized_keys mechanism for the adminUsername.

Link copied to clipboard
val storageProfile: Output<StorageProfileArgs>? = null

The storage profile that specifies size and other parameters about the disks related to the virtual machine.

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

Resource tags.

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

The Base64 encoded cloud-init user data.

Link copied to clipboard

Field Deprecated, use virtualizationModel instead. The type of the virtio interface.

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

The name of the virtual machine.

Link copied to clipboard
val vmDeviceModel: Output<Either<String, VirtualMachineDeviceModelType>>? = null

The type of the device model to use.

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

The virtual machine image that is currently provisioned to the OS disk, using the full url and tag notation used to pull the image.

Link copied to clipboard

The credentials used to login to the image repository that has access to the specified image.

Functions

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