GetVirtualMachine

Use this data source to access information about an existing Virtual Machine.

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(Azure.Compute.GetVirtualMachine.InvokeAsync(new Azure.Compute.GetVirtualMachineArgs
        {
            Name = "production",
            ResourceGroupName = "networking",
        }));
        this.VirtualMachineId = example.Apply(example => example.Id);
    }

    [Output("virtualMachineId")]
    public Output<string> VirtualMachineId { get; set; }
}
package main

import (
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/compute"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        example, err := compute.LookupVirtualMachine(ctx, &compute.LookupVirtualMachineArgs{
            Name:              "production",
            ResourceGroupName: "networking",
        }, nil)
        if err != nil {
            return err
        }
        ctx.Export("virtualMachineId", example.Id)
        return nil
    })
}
import pulumi
import pulumi_azure as azure

example = azure.compute.get_virtual_machine(name="production",
    resource_group_name="networking")
pulumi.export("virtualMachineId", example.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.compute.getVirtualMachine({
    name: "production",
    resourceGroupName: "networking",
});
export const virtualMachineId = example.then(example => example.id);

Using GetVirtualMachine

function getVirtualMachine(args: GetVirtualMachineArgs, opts?: InvokeOptions): Promise<GetVirtualMachineResult>
function  get_virtual_machine(name=None, resource_group_name=None, opts=None)
func LookupVirtualMachine(ctx *Context, args *LookupVirtualMachineArgs, opts ...InvokeOption) (*LookupVirtualMachineResult, error)

Note: This function is named LookupVirtualMachine in the Go SDK.

public static class GetVirtualMachine {
    public static Task<GetVirtualMachineResult> InvokeAsync(GetVirtualMachineArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string

Specifies the name of the Virtual Machine.

ResourceGroupName string

Specifies the name of the resource group the Virtual Machine is located in.

Name string

Specifies the name of the Virtual Machine.

ResourceGroupName string

Specifies the name of the resource group the Virtual Machine is located in.

name string

Specifies the name of the Virtual Machine.

resourceGroupName string

Specifies the name of the resource group the Virtual Machine is located in.

name str

Specifies the name of the Virtual Machine.

resource_group_name str

Specifies the name of the resource group the Virtual Machine is located in.

GetVirtualMachine Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Identities List<GetVirtualMachineIdentity>

A identity block as defined below.

Location string
Name string
ResourceGroupName string
Id string

The provider-assigned unique ID for this managed resource.

Identities []GetVirtualMachineIdentity

A identity block as defined below.

Location string
Name string
ResourceGroupName string
id string

The provider-assigned unique ID for this managed resource.

identities GetVirtualMachineIdentity[]

A identity block as defined below.

location string
name string
resourceGroupName string
id str

The provider-assigned unique ID for this managed resource.

identities List[GetVirtualMachineIdentity]

A identity block as defined below.

location str
name str
resource_group_name str

Supporting Types

GetVirtualMachineIdentity

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

IdentityIds List<string>

The list of User Managed Identity ID’s which are assigned to the Virtual Machine.

PrincipalId string

The ID of the System Managed Service Principal assigned to the Virtual Machine.

TenantId string

The ID of the Tenant of the System Managed Service Principal assigned to the Virtual Machine.

Type string

The identity type of the Managed Identity assigned to the Virtual Machine.

IdentityIds []string

The list of User Managed Identity ID’s which are assigned to the Virtual Machine.

PrincipalId string

The ID of the System Managed Service Principal assigned to the Virtual Machine.

TenantId string

The ID of the Tenant of the System Managed Service Principal assigned to the Virtual Machine.

Type string

The identity type of the Managed Identity assigned to the Virtual Machine.

identityIds string[]

The list of User Managed Identity ID’s which are assigned to the Virtual Machine.

principalId string

The ID of the System Managed Service Principal assigned to the Virtual Machine.

tenantId string

The ID of the Tenant of the System Managed Service Principal assigned to the Virtual Machine.

type string

The identity type of the Managed Identity assigned to the Virtual Machine.

identityIds List[str]

The list of User Managed Identity ID’s which are assigned to the Virtual Machine.

principal_id str

The ID of the System Managed Service Principal assigned to the Virtual Machine.

tenant_id str

The ID of the Tenant of the System Managed Service Principal assigned to the Virtual Machine.

type str

The identity type of the Managed Identity assigned to the Virtual Machine.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.