GetVirtualNetwork
Use this data source to access information about an existing Virtual Network.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var example = Output.Create(Azure.Network.GetVirtualNetwork.InvokeAsync(new Azure.Network.GetVirtualNetworkArgs
{
Name = "production",
ResourceGroupName = "networking",
}));
this.VirtualNetworkId = example.Apply(example => example.Id);
}
[Output("virtualNetworkId")]
public Output<string> VirtualNetworkId { get; set; }
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/network"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := network.LookupVirtualNetwork(ctx, &network.LookupVirtualNetworkArgs{
Name: "production",
ResourceGroupName: "networking",
}, nil)
if err != nil {
return err
}
ctx.Export("virtualNetworkId", example.Id)
return nil
})
}import pulumi
import pulumi_azure as azure
example = azure.network.get_virtual_network(name="production",
resource_group_name="networking")
pulumi.export("virtualNetworkId", example.id)import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.network.getVirtualNetwork({
name: "production",
resourceGroupName: "networking",
});
export const virtualNetworkId = example.then(example => example.id);Using GetVirtualNetwork
function getVirtualNetwork(args: GetVirtualNetworkArgs, opts?: InvokeOptions): Promise<GetVirtualNetworkResult>function get_virtual_network(name=None, resource_group_name=None, opts=None)func LookupVirtualNetwork(ctx *Context, args *LookupVirtualNetworkArgs, opts ...InvokeOption) (*LookupVirtualNetworkResult, error)Note: This function is named
LookupVirtualNetworkin the Go SDK.
public static class GetVirtualNetwork {
public static Task<GetVirtualNetworkResult> InvokeAsync(GetVirtualNetworkArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Name string
Specifies the name of the Virtual Network.
- Resource
Group stringName Specifies the name of the resource group the Virtual Network is located in.
- Name string
Specifies the name of the Virtual Network.
- Resource
Group stringName Specifies the name of the resource group the Virtual Network is located in.
- name string
Specifies the name of the Virtual Network.
- resource
Group stringName Specifies the name of the resource group the Virtual Network is located in.
- name str
Specifies the name of the Virtual Network.
- resource_
group_ strname Specifies the name of the resource group the Virtual Network is located in.
GetVirtualNetwork Result
The following output properties are available:
- Address
Spaces List<string> The list of address spaces used by the virtual network.
- Dns
Servers List<string> The list of DNS servers used by the virtual network.
- Guid string
The GUID of the virtual network.
- Id string
The provider-assigned unique ID for this managed resource.
- Location string
Location of the virtual network.
- Name string
- Resource
Group stringName - Subnets List<string>
The list of name of the subnets that are attached to this virtual network.
- Vnet
Peerings Dictionary<string, string> A mapping of name - virtual network id of the virtual network peerings.
- Address
Spaces []string The list of address spaces used by the virtual network.
- Dns
Servers []string The list of DNS servers used by the virtual network.
- Guid string
The GUID of the virtual network.
- Id string
The provider-assigned unique ID for this managed resource.
- Location string
Location of the virtual network.
- Name string
- Resource
Group stringName - Subnets []string
The list of name of the subnets that are attached to this virtual network.
- Vnet
Peerings map[string]string A mapping of name - virtual network id of the virtual network peerings.
- address
Spaces string[] The list of address spaces used by the virtual network.
- dns
Servers string[] The list of DNS servers used by the virtual network.
- guid string
The GUID of the virtual network.
- id string
The provider-assigned unique ID for this managed resource.
- location string
Location of the virtual network.
- name string
- resource
Group stringName - subnets string[]
The list of name of the subnets that are attached to this virtual network.
- vnet
Peerings {[key: string]: string} A mapping of name - virtual network id of the virtual network peerings.
- address_
spaces List[str] The list of address spaces used by the virtual network.
- dns_
servers List[str] The list of DNS servers used by the virtual network.
- guid str
The GUID of the virtual network.
- id str
The provider-assigned unique ID for this managed resource.
- location str
Location of the virtual network.
- name str
- resource_
group_ strname - subnets List[str]
The list of name of the subnets that are attached to this virtual network.
- vnet_
peerings Dict[str, str] A mapping of name - virtual network id of the virtual network peerings.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.