We recommend using Azure Native.
Azure v6.28.0 published on Friday, Oct 3, 2025 by Pulumi
azure.devtest.getVirtualNetwork
Start a Neo task
Explain and create an azure.devtest.getVirtualNetwork resource
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.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}
API Providers
This data source uses the following Azure API Providers:
Microsoft.DevTestLab- 2018-09-15
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:
- Lab
Name string - Specifies the name of the Dev Test Lab.
- Name string
- Specifies the name of the Virtual Network.
- Resource
Group stringName - Specifies the name of the resource group that contains the Virtual Network.
- Lab
Name string - Specifies the name of the Dev Test Lab.
- Name string
- Specifies the name of the Virtual Network.
- Resource
Group stringName - Specifies the name of the resource group that contains the Virtual Network.
- lab
Name String - Specifies the name of the Dev Test Lab.
- name String
- Specifies the name of the Virtual Network.
- resource
Group StringName - Specifies the name of the resource group that contains the Virtual Network.
- lab
Name string - Specifies the name of the Dev Test Lab.
- name string
- Specifies the name of the Virtual Network.
- resource
Group 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.
- lab
Name String - Specifies the name of the Dev Test Lab.
- name String
- Specifies the name of the Virtual Network.
- resource
Group StringName - Specifies the name of the resource group that contains the Virtual Network.
getVirtualNetwork Result
The following output properties are available:
- Allowed
Subnets 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.
- Lab
Name string - Name string
- Resource
Group stringName - Subnet
Overrides List<GetVirtual Network Subnet Override> - The list of permission overrides for the subnets as defined below.
- Unique
Identifier string - The unique immutable identifier of the virtual network.
- Allowed
Subnets []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.
- Lab
Name string - Name string
- Resource
Group stringName - Subnet
Overrides []GetVirtual Network Subnet Override - The list of permission overrides for the subnets as defined below.
- Unique
Identifier string - The unique immutable identifier of the virtual network.
- allowed
Subnets 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.
- lab
Name String - name String
- resource
Group StringName - subnet
Overrides List<GetVirtual Network Subnet Override> - The list of permission overrides for the subnets as defined below.
- unique
Identifier String - The unique immutable identifier of the virtual network.
- allowed
Subnets 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.
- lab
Name string - name string
- resource
Group stringName - subnet
Overrides GetVirtual Network Subnet Override[] - The list of permission overrides for the subnets as defined below.
- unique
Identifier 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.
- allowed
Subnets 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.
- lab
Name String - name String
- resource
Group StringName - subnet
Overrides List<Property Map> - The list of permission overrides for the subnets as defined below.
- unique
Identifier String - The unique immutable identifier of the virtual network.
Supporting Types
GetVirtualNetworkAllowedSubnet
- Allow
Public stringIp - Indicates if this subnet allows public IP addresses. Possible values are
Allow,DefaultandDeny. - Lab
Subnet stringName - The name of the subnet.
- Resource
Id string - The resource identifier for the subnet.
- Allow
Public stringIp - Indicates if this subnet allows public IP addresses. Possible values are
Allow,DefaultandDeny. - Lab
Subnet stringName - The name of the subnet.
- Resource
Id string - The resource identifier for the subnet.
- allow
Public StringIp - Indicates if this subnet allows public IP addresses. Possible values are
Allow,DefaultandDeny. - lab
Subnet StringName - The name of the subnet.
- resource
Id String - The resource identifier for the subnet.
- allow
Public stringIp - Indicates if this subnet allows public IP addresses. Possible values are
Allow,DefaultandDeny. - lab
Subnet stringName - The name of the subnet.
- resource
Id 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.
- allow
Public StringIp - Indicates if this subnet allows public IP addresses. Possible values are
Allow,DefaultandDeny. - lab
Subnet StringName - The name of the subnet.
- resource
Id String - The resource identifier for the subnet.
GetVirtualNetworkSubnetOverride
- Lab
Subnet stringName - The name of the subnet.
- Resource
Id string - The resource identifier for the subnet.
- Use
In stringVm Creation Permission - Indicates if the subnet can be used for VM creation. Possible values are
Allow,DefaultandDeny. - Use
Public stringIp Address Permission - Virtual
Network stringPool Name - The virtual network pool associated with this subnet.
- Lab
Subnet stringName - The name of the subnet.
- Resource
Id string - The resource identifier for the subnet.
- Use
In stringVm Creation Permission - Indicates if the subnet can be used for VM creation. Possible values are
Allow,DefaultandDeny. - Use
Public stringIp Address Permission - Virtual
Network stringPool Name - The virtual network pool associated with this subnet.
- lab
Subnet StringName - The name of the subnet.
- resource
Id String - The resource identifier for the subnet.
- use
In StringVm Creation Permission - Indicates if the subnet can be used for VM creation. Possible values are
Allow,DefaultandDeny. - use
Public StringIp Address Permission - virtual
Network StringPool Name - The virtual network pool associated with this subnet.
- lab
Subnet stringName - The name of the subnet.
- resource
Id string - The resource identifier for the subnet.
- use
In stringVm Creation Permission - Indicates if the subnet can be used for VM creation. Possible values are
Allow,DefaultandDeny. - use
Public stringIp Address Permission - virtual
Network 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.
- lab
Subnet StringName - The name of the subnet.
- resource
Id String - The resource identifier for the subnet.
- use
In StringVm Creation Permission - Indicates if the subnet can be used for VM creation. Possible values are
Allow,DefaultandDeny. - use
Public StringIp Address Permission - virtual
Network 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.
