1. Packages
  2. Azure Classic
  3. API Docs
  4. devtest
  5. getVirtualNetwork

We recommend using Azure Native.

Azure Classic v5.70.0 published on Wednesday, Mar 27, 2024 by Pulumi

azure.devtest.getVirtualNetwork

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.70.0 published on Wednesday, Mar 27, 2024 by Pulumi

    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/v5/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)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azure:devtest/getVirtualNetwork:getVirtualNetwork
      arguments:
        # arguments dictionary

    The following arguments are supported:

    LabName string
    Specifies the name of the Dev Test Lab.
    Name string
    Specifies the name of the Virtual Network.
    ResourceGroupName string
    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.
    ResourceGroupName string
    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.
    resourceGroupName String
    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.
    resourceGroupName string
    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_name str
    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.
    resourceGroupName String
    Specifies the name of the resource group that contains the Virtual Network.

    getVirtualNetwork Result

    The following output properties are available:

    AllowedSubnets List<GetVirtualNetworkAllowedSubnet>
    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
    ResourceGroupName string
    SubnetOverrides List<GetVirtualNetworkSubnetOverride>
    The list of permission overrides for the subnets as defined below.
    UniqueIdentifier string
    The unique immutable identifier of the virtual network.
    AllowedSubnets []GetVirtualNetworkAllowedSubnet
    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
    ResourceGroupName string
    SubnetOverrides []GetVirtualNetworkSubnetOverride
    The list of permission overrides for the subnets as defined below.
    UniqueIdentifier string
    The unique immutable identifier of the virtual network.
    allowedSubnets List<GetVirtualNetworkAllowedSubnet>
    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
    resourceGroupName String
    subnetOverrides List<GetVirtualNetworkSubnetOverride>
    The list of permission overrides for the subnets as defined below.
    uniqueIdentifier String
    The unique immutable identifier of the virtual network.
    allowedSubnets GetVirtualNetworkAllowedSubnet[]
    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
    resourceGroupName string
    subnetOverrides GetVirtualNetworkSubnetOverride[]
    The list of permission overrides for the subnets as defined below.
    uniqueIdentifier string
    The unique immutable identifier of the virtual network.
    allowed_subnets Sequence[GetVirtualNetworkAllowedSubnet]
    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_name str
    subnet_overrides Sequence[GetVirtualNetworkSubnetOverride]
    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
    resourceGroupName String
    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

    AllowPublicIp string
    Indicates if this subnet allows public IP addresses. Possible values are Allow, Default and Deny.
    LabSubnetName string
    The name of the subnet.
    ResourceId string
    The resource identifier for the subnet.
    AllowPublicIp string
    Indicates if this subnet allows public IP addresses. Possible values are Allow, Default and Deny.
    LabSubnetName string
    The name of the subnet.
    ResourceId string
    The resource identifier for the subnet.
    allowPublicIp String
    Indicates if this subnet allows public IP addresses. Possible values are Allow, Default and Deny.
    labSubnetName String
    The name of the subnet.
    resourceId String
    The resource identifier for the subnet.
    allowPublicIp string
    Indicates if this subnet allows public IP addresses. Possible values are Allow, Default and Deny.
    labSubnetName string
    The name of the subnet.
    resourceId string
    The resource identifier for the subnet.
    allow_public_ip str
    Indicates if this subnet allows public IP addresses. Possible values are Allow, Default and Deny.
    lab_subnet_name str
    The name of the subnet.
    resource_id str
    The resource identifier for the subnet.
    allowPublicIp String
    Indicates if this subnet allows public IP addresses. Possible values are Allow, Default and Deny.
    labSubnetName String
    The name of the subnet.
    resourceId String
    The resource identifier for the subnet.

    GetVirtualNetworkSubnetOverride

    LabSubnetName string
    The name of the subnet.
    ResourceId string
    The resource identifier for the subnet.
    UseInVmCreationPermission string
    Indicates if the subnet can be used for VM creation. Possible values are Allow, Default and Deny.
    UsePublicIpAddressPermission string
    VirtualNetworkPoolName string
    The virtual network pool associated with this subnet.
    LabSubnetName string
    The name of the subnet.
    ResourceId string
    The resource identifier for the subnet.
    UseInVmCreationPermission string
    Indicates if the subnet can be used for VM creation. Possible values are Allow, Default and Deny.
    UsePublicIpAddressPermission string
    VirtualNetworkPoolName string
    The virtual network pool associated with this subnet.
    labSubnetName String
    The name of the subnet.
    resourceId String
    The resource identifier for the subnet.
    useInVmCreationPermission String
    Indicates if the subnet can be used for VM creation. Possible values are Allow, Default and Deny.
    usePublicIpAddressPermission String
    virtualNetworkPoolName String
    The virtual network pool associated with this subnet.
    labSubnetName string
    The name of the subnet.
    resourceId string
    The resource identifier for the subnet.
    useInVmCreationPermission string
    Indicates if the subnet can be used for VM creation. Possible values are Allow, Default and Deny.
    usePublicIpAddressPermission string
    virtualNetworkPoolName string
    The virtual network pool associated with this subnet.
    lab_subnet_name str
    The name of the subnet.
    resource_id str
    The resource identifier for the subnet.
    use_in_vm_creation_permission str
    Indicates if the subnet can be used for VM creation. Possible values are Allow, Default and Deny.
    use_public_ip_address_permission str
    virtual_network_pool_name str
    The virtual network pool associated with this subnet.
    labSubnetName String
    The name of the subnet.
    resourceId String
    The resource identifier for the subnet.
    useInVmCreationPermission String
    Indicates if the subnet can be used for VM creation. Possible values are Allow, Default and Deny.
    usePublicIpAddressPermission String
    virtualNetworkPoolName String
    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 azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.70.0 published on Wednesday, Mar 27, 2024 by Pulumi