VirtualMachine

class VirtualMachine : KotlinCustomResource

API Version: 2022-12-12-preview.

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/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloudServicesNetworkName",
IpAllocationMethod = "Dynamic",
},
CpuCores = 2,
ExtendedLocation = new AzureNative.NetworkCloud.Inputs.ExtendedLocationArgs
{
Name = "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName",
Type = "CustomLocation",
},
Location = "location",
MemorySizeGB = 8,
NetworkAttachments = new[]
{
new AzureNative.NetworkCloud.Inputs.NetworkAttachmentArgs
{
AttachedNetworkId = "/subscriptions/subscriptionId/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/subscriptionId/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/subscriptionId/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",
},
});
});
package main
import (
networkcloud "github.com/pulumi/pulumi-azure-native-sdk/networkcloud"
"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/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloudServicesNetworkName"),
IpAllocationMethod: pulumi.String("Dynamic"),
},
CpuCores: pulumi.Float64(2),
ExtendedLocation: &networkcloud.ExtendedLocationArgs{
Name: pulumi.String("/subscriptions/subscriptionId/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/subscriptionId/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/subscriptionId/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/subscriptionId/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
})
}
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/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloudServicesNetworkName"),
Map.entry("ipAllocationMethod", "Dynamic")
))
.cpuCores(2)
.extendedLocation(Map.ofEntries(
Map.entry("name", "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName"),
Map.entry("type", "CustomLocation")
))
.location("location")
.memorySizeGB(8)
.networkAttachments(Map.ofEntries(
Map.entry("attachedNetworkId", "/subscriptions/subscriptionId/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/subscriptionId/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/subscriptionId/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());
}
}

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

Properties

Link copied to clipboard
val adminUsername: Output<String>

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

Link copied to clipboard

The resource ID of the bare metal machine the virtual machine has landed to.

Link copied to clipboard
val bootMethod: Output<String>?

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
val clusterId: Output<String>

The resource ID of the cluster the virtual machine is created for.

Link copied to clipboard
val cpuCores: Output<Double>

The number of CPU cores in the virtual machine.

Link copied to clipboard
val detailedStatus: Output<String>

The more detailed status of the virtual machine.

Link copied to clipboard

The descriptive message about the current detailed status.

Link copied to clipboard

The extended location of the cluster associated with the resource.

Link copied to clipboard
val id: Output<String>
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>

The geo-location where the resource lives

Link copied to clipboard
val memorySizeGB: Output<Double>

The memory size of the virtual machine in GB.

Link copied to clipboard
val name: Output<String>

The name of the resource

Link copied to clipboard

The list of network attachments to the virtual machine.

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

The Base64 encoded cloud-init network data.

Link copied to clipboard

The scheduling hints for the virtual machine.

Link copied to clipboard
val powerState: Output<String>

The power state of the virtual machine.

Link copied to clipboard

The provisioning state of the virtual machine.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

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

Link copied to clipboard

Azure Resource Manager metadata containing createdBy and modifiedBy information.

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

Resource tags.

Link copied to clipboard
val type: Output<String>

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

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

The Base64 encoded cloud-init user data.

Link copied to clipboard
val virtioInterface: Output<String>?

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

Link copied to clipboard
val vmDeviceModel: Output<String>?

The type of the device model to use.

Link copied to clipboard
val vmImage: Output<String>

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.

Link copied to clipboard
val volumes: Output<List<String>>

The resource IDs of volumes that are attached to the virtual machine.