We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
Manages a Virtual Network within a DevTest Lab.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var exampleLab = new Azure.DevTest.Lab("exampleLab", new Azure.DevTest.LabArgs
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
Tags =
{
{ "Sydney", "Australia" },
},
});
var exampleVirtualNetwork = new Azure.DevTest.VirtualNetwork("exampleVirtualNetwork", new Azure.DevTest.VirtualNetworkArgs
{
LabName = exampleLab.Name,
ResourceGroupName = exampleResourceGroup.Name,
Subnet = new Azure.DevTest.Inputs.VirtualNetworkSubnetArgs
{
UsePublicIpAddress = "Allow",
UseInVirtualMachineCreation = "Allow",
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/devtest"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleLab, err := devtest.NewLab(ctx, "exampleLab", &devtest.LabArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
Tags: pulumi.StringMap{
"Sydney": pulumi.String("Australia"),
},
})
if err != nil {
return err
}
_, err = devtest.NewVirtualNetwork(ctx, "exampleVirtualNetwork", &devtest.VirtualNetworkArgs{
LabName: exampleLab.Name,
ResourceGroupName: exampleResourceGroup.Name,
Subnet: &devtest.VirtualNetworkSubnetArgs{
UsePublicIpAddress: pulumi.String("Allow"),
UseInVirtualMachineCreation: pulumi.String("Allow"),
},
})
if err != nil {
return err
}
return nil
})
}
Example coming soon!
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleLab = new azure.devtest.Lab("exampleLab", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
tags: {
Sydney: "Australia",
},
});
const exampleVirtualNetwork = new azure.devtest.VirtualNetwork("exampleVirtualNetwork", {
labName: exampleLab.name,
resourceGroupName: exampleResourceGroup.name,
subnet: {
usePublicIpAddress: "Allow",
useInVirtualMachineCreation: "Allow",
},
});
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_lab = azure.devtest.Lab("exampleLab",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
tags={
"Sydney": "Australia",
})
example_virtual_network = azure.devtest.VirtualNetwork("exampleVirtualNetwork",
lab_name=example_lab.name,
resource_group_name=example_resource_group.name,
subnet=azure.devtest.VirtualNetworkSubnetArgs(
use_public_ip_address="Allow",
use_in_virtual_machine_creation="Allow",
))
Example coming soon!
Create VirtualNetwork Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new VirtualNetwork(name: string, args: VirtualNetworkArgs, opts?: CustomResourceOptions);@overload
def VirtualNetwork(resource_name: str,
args: VirtualNetworkArgs,
opts: Optional[ResourceOptions] = None)
@overload
def VirtualNetwork(resource_name: str,
opts: Optional[ResourceOptions] = None,
lab_name: Optional[str] = None,
resource_group_name: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None,
subnet: Optional[VirtualNetworkSubnetArgs] = None,
tags: Optional[Mapping[str, str]] = None)func NewVirtualNetwork(ctx *Context, name string, args VirtualNetworkArgs, opts ...ResourceOption) (*VirtualNetwork, error)public VirtualNetwork(string name, VirtualNetworkArgs args, CustomResourceOptions? opts = null)
public VirtualNetwork(String name, VirtualNetworkArgs args)
public VirtualNetwork(String name, VirtualNetworkArgs args, CustomResourceOptions options)
type: azure:devtest:VirtualNetwork
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args VirtualNetworkArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args VirtualNetworkArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args VirtualNetworkArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VirtualNetworkArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VirtualNetworkArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var virtualNetworkResource = new Azure.DevTest.VirtualNetwork("virtualNetworkResource", new()
{
LabName = "string",
ResourceGroupName = "string",
Description = "string",
Name = "string",
Subnet = new Azure.DevTest.Inputs.VirtualNetworkSubnetArgs
{
Name = "string",
UseInVirtualMachineCreation = "string",
UsePublicIpAddress = "string",
},
Tags =
{
{ "string", "string" },
},
});
example, err := devtest.NewVirtualNetwork(ctx, "virtualNetworkResource", &devtest.VirtualNetworkArgs{
LabName: pulumi.String("string"),
ResourceGroupName: pulumi.String("string"),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
Subnet: &devtest.VirtualNetworkSubnetArgs{
Name: pulumi.String("string"),
UseInVirtualMachineCreation: pulumi.String("string"),
UsePublicIpAddress: pulumi.String("string"),
},
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var virtualNetworkResource = new com.pulumi.azure.devtest.VirtualNetwork("virtualNetworkResource", com.pulumi.azure.devtest.VirtualNetworkArgs.builder()
.labName("string")
.resourceGroupName("string")
.description("string")
.name("string")
.subnet(VirtualNetworkSubnetArgs.builder()
.name("string")
.useInVirtualMachineCreation("string")
.usePublicIpAddress("string")
.build())
.tags(Map.of("string", "string"))
.build());
virtual_network_resource = azure.devtest.VirtualNetwork("virtualNetworkResource",
lab_name="string",
resource_group_name="string",
description="string",
name="string",
subnet={
"name": "string",
"use_in_virtual_machine_creation": "string",
"use_public_ip_address": "string",
},
tags={
"string": "string",
})
const virtualNetworkResource = new azure.devtest.VirtualNetwork("virtualNetworkResource", {
labName: "string",
resourceGroupName: "string",
description: "string",
name: "string",
subnet: {
name: "string",
useInVirtualMachineCreation: "string",
usePublicIpAddress: "string",
},
tags: {
string: "string",
},
});
type: azure:devtest:VirtualNetwork
properties:
description: string
labName: string
name: string
resourceGroupName: string
subnet:
name: string
useInVirtualMachineCreation: string
usePublicIpAddress: string
tags:
string: string
VirtualNetwork Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The VirtualNetwork resource accepts the following input properties:
- Lab
Name string - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- Resource
Group stringName - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- Description string
- A description for the Virtual Network.
- Name string
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- Subnet
Virtual
Network Subnet - A
subnetblock as defined below. - Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Lab
Name string - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- Resource
Group stringName - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- Description string
- A description for the Virtual Network.
- Name string
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- Subnet
Virtual
Network Subnet Args - A
subnetblock as defined below. - map[string]string
- A mapping of tags to assign to the resource.
- lab
Name String - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- resource
Group StringName - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- description String
- A description for the Virtual Network.
- name String
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- subnet
Virtual
Network Subnet - A
subnetblock as defined below. - Map<String,String>
- A mapping of tags to assign to the resource.
- lab
Name string - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- resource
Group stringName - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- description string
- A description for the Virtual Network.
- name string
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- subnet
Virtual
Network Subnet - A
subnetblock as defined below. - {[key: string]: string}
- A mapping of tags to assign to the resource.
- lab_
name str - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- resource_
group_ strname - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- description str
- A description for the Virtual Network.
- name str
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- subnet
Virtual
Network Subnet Args - A
subnetblock as defined below. - Mapping[str, str]
- A mapping of tags to assign to the resource.
- lab
Name String - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- resource
Group StringName - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- description String
- A description for the Virtual Network.
- name String
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- subnet Property Map
- A
subnetblock as defined below. - Map<String>
- A mapping of tags to assign to the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the VirtualNetwork resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Unique
Identifier string - The unique immutable identifier of the Dev Test Virtual Network.
- Id string
- The provider-assigned unique ID for this managed resource.
- Unique
Identifier string - The unique immutable identifier of the Dev Test Virtual Network.
- id String
- The provider-assigned unique ID for this managed resource.
- unique
Identifier String - The unique immutable identifier of the Dev Test Virtual Network.
- id string
- The provider-assigned unique ID for this managed resource.
- unique
Identifier string - The unique immutable identifier of the Dev Test Virtual Network.
- id str
- The provider-assigned unique ID for this managed resource.
- unique_
identifier str - The unique immutable identifier of the Dev Test Virtual Network.
- id String
- The provider-assigned unique ID for this managed resource.
- unique
Identifier String - The unique immutable identifier of the Dev Test Virtual Network.
Look up Existing VirtualNetwork Resource
Get an existing VirtualNetwork resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: VirtualNetworkState, opts?: CustomResourceOptions): VirtualNetwork@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
lab_name: Optional[str] = None,
name: Optional[str] = None,
resource_group_name: Optional[str] = None,
subnet: Optional[VirtualNetworkSubnetArgs] = None,
tags: Optional[Mapping[str, str]] = None,
unique_identifier: Optional[str] = None) -> VirtualNetworkfunc GetVirtualNetwork(ctx *Context, name string, id IDInput, state *VirtualNetworkState, opts ...ResourceOption) (*VirtualNetwork, error)public static VirtualNetwork Get(string name, Input<string> id, VirtualNetworkState? state, CustomResourceOptions? opts = null)public static VirtualNetwork get(String name, Output<String> id, VirtualNetworkState state, CustomResourceOptions options)resources: _: type: azure:devtest:VirtualNetwork get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Description string
- A description for the Virtual Network.
- Lab
Name string - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- Name string
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- Resource
Group stringName - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- Subnet
Virtual
Network Subnet - A
subnetblock as defined below. - Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Unique
Identifier string - The unique immutable identifier of the Dev Test Virtual Network.
- Description string
- A description for the Virtual Network.
- Lab
Name string - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- Name string
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- Resource
Group stringName - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- Subnet
Virtual
Network Subnet Args - A
subnetblock as defined below. - map[string]string
- A mapping of tags to assign to the resource.
- Unique
Identifier string - The unique immutable identifier of the Dev Test Virtual Network.
- description String
- A description for the Virtual Network.
- lab
Name String - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- name String
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- resource
Group StringName - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- subnet
Virtual
Network Subnet - A
subnetblock as defined below. - Map<String,String>
- A mapping of tags to assign to the resource.
- unique
Identifier String - The unique immutable identifier of the Dev Test Virtual Network.
- description string
- A description for the Virtual Network.
- lab
Name string - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- name string
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- resource
Group stringName - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- subnet
Virtual
Network Subnet - A
subnetblock as defined below. - {[key: string]: string}
- A mapping of tags to assign to the resource.
- unique
Identifier string - The unique immutable identifier of the Dev Test Virtual Network.
- description str
- A description for the Virtual Network.
- lab_
name str - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- name str
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- resource_
group_ strname - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- subnet
Virtual
Network Subnet Args - A
subnetblock as defined below. - Mapping[str, str]
- A mapping of tags to assign to the resource.
- unique_
identifier str - The unique immutable identifier of the Dev Test Virtual Network.
- description String
- A description for the Virtual Network.
- lab
Name String - Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.
- name String
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- resource
Group StringName - The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
- subnet Property Map
- A
subnetblock as defined below. - Map<String>
- A mapping of tags to assign to the resource.
- unique
Identifier String - The unique immutable identifier of the Dev Test Virtual Network.
Supporting Types
VirtualNetworkSubnet, VirtualNetworkSubnetArgs
- Name string
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- Use
In stringVirtual Machine Creation - Can this subnet be used for creating Virtual Machines? Possible values are
Allow,DefaultandDeny. - Use
Public stringIp Address - Can Virtual Machines in this Subnet use Public IP Addresses? Possible values are
Allow,DefaultandDeny.
- Name string
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- Use
In stringVirtual Machine Creation - Can this subnet be used for creating Virtual Machines? Possible values are
Allow,DefaultandDeny. - Use
Public stringIp Address - Can Virtual Machines in this Subnet use Public IP Addresses? Possible values are
Allow,DefaultandDeny.
- name String
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- use
In StringVirtual Machine Creation - Can this subnet be used for creating Virtual Machines? Possible values are
Allow,DefaultandDeny. - use
Public StringIp Address - Can Virtual Machines in this Subnet use Public IP Addresses? Possible values are
Allow,DefaultandDeny.
- name string
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- use
In stringVirtual Machine Creation - Can this subnet be used for creating Virtual Machines? Possible values are
Allow,DefaultandDeny. - use
Public stringIp Address - Can Virtual Machines in this Subnet use Public IP Addresses? Possible values are
Allow,DefaultandDeny.
- name str
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- use_
in_ strvirtual_ machine_ creation - Can this subnet be used for creating Virtual Machines? Possible values are
Allow,DefaultandDeny. - use_
public_ strip_ address - Can Virtual Machines in this Subnet use Public IP Addresses? Possible values are
Allow,DefaultandDeny.
- name String
- Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.
- use
In StringVirtual Machine Creation - Can this subnet be used for creating Virtual Machines? Possible values are
Allow,DefaultandDeny. - use
Public StringIp Address - Can Virtual Machines in this Subnet use Public IP Addresses? Possible values are
Allow,DefaultandDeny.
Import
DevTest Virtual Networks can be imported using the resource id, e.g.
$ pulumi import azure:devtest/virtualNetwork:VirtualNetwork network1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualnetworks/network1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
