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
LookupVirtualMachinein 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.
- Resource
Group stringName Specifies the name of the resource group the Virtual Machine is located in.
- Name string
Specifies the name of the Virtual Machine.
- Resource
Group stringName Specifies the name of the resource group the Virtual Machine is located in.
- name string
Specifies the name of the Virtual Machine.
- resource
Group stringName Specifies the name of the resource group the Virtual Machine is located in.
- name str
Specifies the name of the Virtual Machine.
- resource_
group_ strname 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<Get
Virtual Machine Identity> A
identityblock as defined below.- Location string
- Name string
- Resource
Group stringName
- Id string
The provider-assigned unique ID for this managed resource.
- Identities
[]Get
Virtual Machine Identity A
identityblock as defined below.- Location string
- Name string
- Resource
Group stringName
- id string
The provider-assigned unique ID for this managed resource.
- identities
Get
Virtual Machine Identity[] A
identityblock as defined below.- location string
- name string
- resource
Group stringName
- id str
The provider-assigned unique ID for this managed resource.
- identities
List[Get
Virtual Machine Identity] A
identityblock as defined below.- location str
- name str
- resource_
group_ strname
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.
- Identity
Ids List<string> The list of User Managed Identity ID’s which are assigned to the Virtual Machine.
- Principal
Id string The ID of the System Managed Service Principal assigned to the Virtual Machine.
- Tenant
Id 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.
- Identity
Ids []string The list of User Managed Identity ID’s which are assigned to the Virtual Machine.
- Principal
Id string The ID of the System Managed Service Principal assigned to the Virtual Machine.
- Tenant
Id 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.
- identity
Ids string[] The list of User Managed Identity ID’s which are assigned to the Virtual Machine.
- principal
Id string The ID of the System Managed Service Principal assigned to the Virtual Machine.
- tenant
Id 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.
- identity
Ids 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
azurermTerraform Provider.