Hello, how do I look up the resource ID of a virtu...
# dotnet
t
Hello, how do I look up the resource ID of a virtual network? For example, a resource with the name "vnet-mei-dev-01" is a pre-existing virtual network that we are not creating via Pulumi. We would get "vnet-mei-dev-01" from the stack. What's is the best way of looking this resource up in Pulumi so that we can use the fully qualified ID for the remoteVirtualNetworkId property when creating an A_zure_.network.VirtualNetworkPeering. Example of the fully qualified ID: "/subscriptions/52e39ec9-0204-44ae-8abe-2401582a288d/resourceGroups/rg-mei-dev-01/providers/Microsoft.Network/virtualNetworks/vnet-mei-dev-01". Thanks
t
Try something like
Copy code
var vnet = await Pulumi.Azure.Network.Invokes.GetVirtualNetwork(new GetVirtualNetworkArgs
{
    ResourceGroupName = "rg-mei-dev-01",
    Name = "vnet-mei-dev-01",
});

var id = vnet.Id;
t
Thanks Mikhail..will give it a go. Appreciate the quick response.