Virtual Machine Args
data class VirtualMachineArgs(val adminUsername: Output<String>? = null, val bootMethod: Output<Either<String, VirtualMachineBootMethod>>? = null, val cloudServicesNetworkAttachment: Output<NetworkAttachmentArgs>? = 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>
Azure REST API version: 2023-05-01-preview. Prior API version in Azure Native 1.x: 2022-12-12-preview. Other available API versions: 2023-07-01.
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 = "UEFI",
CloudServicesNetworkAttachment = new AzureNative.NetworkCloud.Inputs.NetworkAttachmentArgs
{
AttachedNetworkId = "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloudServicesNetworkName",
IpAllocationMethod = "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 = "True",
IpAllocationMethod = "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 = "Affinity",
ResourceId = "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/racks/rackName",
SchedulingExecution = "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 = "Ephemeral",
DeleteOption = "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 = "T2",
VmImage = "myacr.azurecr.io/foobar:latest",
VmImageRepositoryCredentials = new AzureNative.NetworkCloud.Inputs.ImageRepositoryCredentialsArgs
{
Password = "{password}",
RegistryUrl = "myacr.azurecr.io",
Username = "myuser",
},
});
});
Content copied to clipboard
package main
import (
"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("UEFI"),
CloudServicesNetworkAttachment: &networkcloud.NetworkAttachmentArgs{
AttachedNetworkId: pulumi.String("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloudServicesNetworkName"),
IpAllocationMethod: pulumi.String("Dynamic"),
},
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.NetworkAttachmentArgs{
{
AttachedNetworkId: pulumi.String("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/l3Networks/l3NetworkName"),
DefaultGateway: pulumi.String("True"),
IpAllocationMethod: pulumi.String("Dynamic"),
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.VirtualMachinePlacementHintArgs{
{
HintType: pulumi.String("Affinity"),
ResourceId: pulumi.String("/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/racks/rackName"),
SchedulingExecution: pulumi.String("Hard"),
Scope: pulumi.String(""),
},
},
ResourceGroupName: pulumi.String("resourceGroupName"),
SshPublicKeys: []networkcloud.SshPublicKeyArgs{
{
KeyData: pulumi.String("ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"),
},
},
StorageProfile: networkcloud.StorageProfileResponse{
OsDisk: &networkcloud.OsDiskArgs{
CreateOption: pulumi.String("Ephemeral"),
DeleteOption: pulumi.String("Delete"),
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("T2"),
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
})
}
Content copied to clipboard
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 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(Map.ofEntries(
Map.entry("attachedNetworkId", "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloudServicesNetworkName"),
Map.entry("ipAllocationMethod", "Dynamic")
))
.cpuCores(2)
.extendedLocation(Map.ofEntries(
Map.entry("name", "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName"),
Map.entry("type", "CustomLocation")
))
.location("location")
.memorySizeGB(8)
.networkAttachments(Map.ofEntries(
Map.entry("attachedNetworkId", "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/l3Networks/l3NetworkName"),
Map.entry("defaultGateway", "True"),
Map.entry("ipAllocationMethod", "Dynamic"),
Map.entry("ipv4Address", "198.51.100.1"),
Map.entry("ipv6Address", "2001:0db8:0000:0000:0000:0000:0000:0000"),
Map.entry("networkAttachmentName", "netAttachName01")
))
.networkData("bmV0d29ya0RhdGVTYW1wbGU=")
.placementHints(Map.ofEntries(
Map.entry("hintType", "Affinity"),
Map.entry("resourceId", "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/racks/rackName"),
Map.entry("schedulingExecution", "Hard"),
Map.entry("scope", "")
))
.resourceGroupName("resourceGroupName")
.sshPublicKeys(Map.of("keyData", "ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"))
.storageProfile(Map.ofEntries(
Map.entry("osDisk", Map.ofEntries(
Map.entry("createOption", "Ephemeral"),
Map.entry("deleteOption", "Delete"),
Map.entry("diskSizeGB", 120)
)),
Map.entry("volumeAttachments", "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName")
))
.tags(Map.ofEntries(
Map.entry("key1", "myvalue1"),
Map.entry("key2", "myvalue2")
))
.userData("dXNlckRhdGVTYW1wbGU=")
.virtualMachineName("virtualMachineName")
.vmDeviceModel("T2")
.vmImage("myacr.azurecr.io/foobar:latest")
.vmImageRepositoryCredentials(Map.ofEntries(
Map.entry("password", "{password}"),
Map.entry("registryUrl", "myacr.azurecr.io"),
Map.entry("username", "myuser")
))
.build());
}
}
Content copied to clipboard
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}
Content copied to clipboard
Constructors
Link copied to clipboard
fun VirtualMachineArgs(adminUsername: Output<String>? = null, bootMethod: Output<Either<String, VirtualMachineBootMethod>>? = null, cloudServicesNetworkAttachment: Output<NetworkAttachmentArgs>? = 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)
Functions
Properties
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard