We recommend using Azure Native.
Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi
azure.devtest.getVirtualNetwork
Explore with Pulumi AI
Use this data source to access information about an existing Dev Test Lab Virtual Network.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.devtest.getVirtualNetwork({
    name: "example-network",
    labName: "examplelab",
    resourceGroupName: "example-resource",
});
export const labSubnetName = example.then(example => example.allowedSubnets?.[0]?.labSubnetName);
import pulumi
import pulumi_azure as azure
example = azure.devtest.get_virtual_network(name="example-network",
    lab_name="examplelab",
    resource_group_name="example-resource")
pulumi.export("labSubnetName", example.allowed_subnets[0].lab_subnet_name)
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/devtest"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := devtest.LookupVirtualNetwork(ctx, &devtest.LookupVirtualNetworkArgs{
			Name:              "example-network",
			LabName:           "examplelab",
			ResourceGroupName: "example-resource",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("labSubnetName", example.AllowedSubnets[0].LabSubnetName)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = Azure.DevTest.GetVirtualNetwork.Invoke(new()
    {
        Name = "example-network",
        LabName = "examplelab",
        ResourceGroupName = "example-resource",
    });
    return new Dictionary<string, object?>
    {
        ["labSubnetName"] = example.Apply(getVirtualNetworkResult => getVirtualNetworkResult.AllowedSubnets[0]?.LabSubnetName),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.devtest.DevtestFunctions;
import com.pulumi.azure.devtest.inputs.GetVirtualNetworkArgs;
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) {
        final var example = DevtestFunctions.getVirtualNetwork(GetVirtualNetworkArgs.builder()
            .name("example-network")
            .labName("examplelab")
            .resourceGroupName("example-resource")
            .build());
        ctx.export("labSubnetName", example.applyValue(getVirtualNetworkResult -> getVirtualNetworkResult.allowedSubnets()[0].labSubnetName()));
    }
}
variables:
  example:
    fn::invoke:
      function: azure:devtest:getVirtualNetwork
      arguments:
        name: example-network
        labName: examplelab
        resourceGroupName: example-resource
outputs:
  labSubnetName: ${example.allowedSubnets[0].labSubnetName}
Using getVirtualNetwork
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getVirtualNetwork(args: GetVirtualNetworkArgs, opts?: InvokeOptions): Promise<GetVirtualNetworkResult>
function getVirtualNetworkOutput(args: GetVirtualNetworkOutputArgs, opts?: InvokeOptions): Output<GetVirtualNetworkResult>def get_virtual_network(lab_name: Optional[str] = None,
                        name: Optional[str] = None,
                        resource_group_name: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetVirtualNetworkResult
def get_virtual_network_output(lab_name: Optional[pulumi.Input[str]] = None,
                        name: Optional[pulumi.Input[str]] = None,
                        resource_group_name: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetVirtualNetworkResult]func LookupVirtualNetwork(ctx *Context, args *LookupVirtualNetworkArgs, opts ...InvokeOption) (*LookupVirtualNetworkResult, error)
func LookupVirtualNetworkOutput(ctx *Context, args *LookupVirtualNetworkOutputArgs, opts ...InvokeOption) LookupVirtualNetworkResultOutput> Note: This function is named LookupVirtualNetwork in the Go SDK.
public static class GetVirtualNetwork 
{
    public static Task<GetVirtualNetworkResult> InvokeAsync(GetVirtualNetworkArgs args, InvokeOptions? opts = null)
    public static Output<GetVirtualNetworkResult> Invoke(GetVirtualNetworkInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetVirtualNetworkResult> getVirtualNetwork(GetVirtualNetworkArgs args, InvokeOptions options)
public static Output<GetVirtualNetworkResult> getVirtualNetwork(GetVirtualNetworkArgs args, InvokeOptions options)
fn::invoke:
  function: azure:devtest/getVirtualNetwork:getVirtualNetwork
  arguments:
    # arguments dictionaryThe following arguments are supported:
- LabName string
- Specifies the name of the Dev Test Lab.
- Name string
- Specifies the name of the Virtual Network.
- ResourceGroup stringName 
- Specifies the name of the resource group that contains the Virtual Network.
- LabName string
- Specifies the name of the Dev Test Lab.
- Name string
- Specifies the name of the Virtual Network.
- ResourceGroup stringName 
- Specifies the name of the resource group that contains the Virtual Network.
- labName String
- Specifies the name of the Dev Test Lab.
- name String
- Specifies the name of the Virtual Network.
- resourceGroup StringName 
- Specifies the name of the resource group that contains the Virtual Network.
- labName string
- Specifies the name of the Dev Test Lab.
- name string
- Specifies the name of the Virtual Network.
- resourceGroup stringName 
- Specifies the name of the resource group that contains the Virtual Network.
- lab_name str
- Specifies the name of the Dev Test Lab.
- name str
- Specifies the name of the Virtual Network.
- resource_group_ strname 
- Specifies the name of the resource group that contains the Virtual Network.
- labName String
- Specifies the name of the Dev Test Lab.
- name String
- Specifies the name of the Virtual Network.
- resourceGroup StringName 
- Specifies the name of the resource group that contains the Virtual Network.
getVirtualNetwork Result
The following output properties are available:
- AllowedSubnets List<GetVirtual Network Allowed Subnet> 
- The list of subnets enabled for the virtual network as defined below.
- Id string
- The provider-assigned unique ID for this managed resource.
- LabName string
- Name string
- ResourceGroup stringName 
- SubnetOverrides List<GetVirtual Network Subnet Override> 
- The list of permission overrides for the subnets as defined below.
- UniqueIdentifier string
- The unique immutable identifier of the virtual network.
- AllowedSubnets []GetVirtual Network Allowed Subnet 
- The list of subnets enabled for the virtual network as defined below.
- Id string
- The provider-assigned unique ID for this managed resource.
- LabName string
- Name string
- ResourceGroup stringName 
- SubnetOverrides []GetVirtual Network Subnet Override 
- The list of permission overrides for the subnets as defined below.
- UniqueIdentifier string
- The unique immutable identifier of the virtual network.
- allowedSubnets List<GetVirtual Network Allowed Subnet> 
- The list of subnets enabled for the virtual network as defined below.
- id String
- The provider-assigned unique ID for this managed resource.
- labName String
- name String
- resourceGroup StringName 
- subnetOverrides List<GetVirtual Network Subnet Override> 
- The list of permission overrides for the subnets as defined below.
- uniqueIdentifier String
- The unique immutable identifier of the virtual network.
- allowedSubnets GetVirtual Network Allowed Subnet[] 
- The list of subnets enabled for the virtual network as defined below.
- id string
- The provider-assigned unique ID for this managed resource.
- labName string
- name string
- resourceGroup stringName 
- subnetOverrides GetVirtual Network Subnet Override[] 
- The list of permission overrides for the subnets as defined below.
- uniqueIdentifier string
- The unique immutable identifier of the virtual network.
- allowed_subnets Sequence[GetVirtual Network Allowed Subnet] 
- The list of subnets enabled for the virtual network as defined below.
- id str
- The provider-assigned unique ID for this managed resource.
- lab_name str
- name str
- resource_group_ strname 
- subnet_overrides Sequence[GetVirtual Network Subnet Override] 
- The list of permission overrides for the subnets as defined below.
- unique_identifier str
- The unique immutable identifier of the virtual network.
- allowedSubnets List<Property Map>
- The list of subnets enabled for the virtual network as defined below.
- id String
- The provider-assigned unique ID for this managed resource.
- labName String
- name String
- resourceGroup StringName 
- subnetOverrides List<Property Map>
- The list of permission overrides for the subnets as defined below.
- uniqueIdentifier String
- The unique immutable identifier of the virtual network.
Supporting Types
GetVirtualNetworkAllowedSubnet    
- AllowPublic stringIp 
- Indicates if this subnet allows public IP addresses. Possible values are Allow,DefaultandDeny.
- LabSubnet stringName 
- The name of the subnet.
- ResourceId string
- The resource identifier for the subnet.
- AllowPublic stringIp 
- Indicates if this subnet allows public IP addresses. Possible values are Allow,DefaultandDeny.
- LabSubnet stringName 
- The name of the subnet.
- ResourceId string
- The resource identifier for the subnet.
- allowPublic StringIp 
- Indicates if this subnet allows public IP addresses. Possible values are Allow,DefaultandDeny.
- labSubnet StringName 
- The name of the subnet.
- resourceId String
- The resource identifier for the subnet.
- allowPublic stringIp 
- Indicates if this subnet allows public IP addresses. Possible values are Allow,DefaultandDeny.
- labSubnet stringName 
- The name of the subnet.
- resourceId string
- The resource identifier for the subnet.
- allow_public_ strip 
- Indicates if this subnet allows public IP addresses. Possible values are Allow,DefaultandDeny.
- lab_subnet_ strname 
- The name of the subnet.
- resource_id str
- The resource identifier for the subnet.
- allowPublic StringIp 
- Indicates if this subnet allows public IP addresses. Possible values are Allow,DefaultandDeny.
- labSubnet StringName 
- The name of the subnet.
- resourceId String
- The resource identifier for the subnet.
GetVirtualNetworkSubnetOverride    
- LabSubnet stringName 
- The name of the subnet.
- ResourceId string
- The resource identifier for the subnet.
- UseIn stringVm Creation Permission 
- Indicates if the subnet can be used for VM creation. Possible values are Allow,DefaultandDeny.
- UsePublic stringIp Address Permission 
- VirtualNetwork stringPool Name 
- The virtual network pool associated with this subnet.
- LabSubnet stringName 
- The name of the subnet.
- ResourceId string
- The resource identifier for the subnet.
- UseIn stringVm Creation Permission 
- Indicates if the subnet can be used for VM creation. Possible values are Allow,DefaultandDeny.
- UsePublic stringIp Address Permission 
- VirtualNetwork stringPool Name 
- The virtual network pool associated with this subnet.
- labSubnet StringName 
- The name of the subnet.
- resourceId String
- The resource identifier for the subnet.
- useIn StringVm Creation Permission 
- Indicates if the subnet can be used for VM creation. Possible values are Allow,DefaultandDeny.
- usePublic StringIp Address Permission 
- virtualNetwork StringPool Name 
- The virtual network pool associated with this subnet.
- labSubnet stringName 
- The name of the subnet.
- resourceId string
- The resource identifier for the subnet.
- useIn stringVm Creation Permission 
- Indicates if the subnet can be used for VM creation. Possible values are Allow,DefaultandDeny.
- usePublic stringIp Address Permission 
- virtualNetwork stringPool Name 
- The virtual network pool associated with this subnet.
- lab_subnet_ strname 
- The name of the subnet.
- resource_id str
- The resource identifier for the subnet.
- use_in_ strvm_ creation_ permission 
- Indicates if the subnet can be used for VM creation. Possible values are Allow,DefaultandDeny.
- use_public_ strip_ address_ permission 
- virtual_network_ strpool_ name 
- The virtual network pool associated with this subnet.
- labSubnet StringName 
- The name of the subnet.
- resourceId String
- The resource identifier for the subnet.
- useIn StringVm Creation Permission 
- Indicates if the subnet can be used for VM creation. Possible values are Allow,DefaultandDeny.
- usePublic StringIp Address Permission 
- virtualNetwork StringPool Name 
- The virtual network pool associated with this subnet.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.