1. Packages
  2. Azure Classic
  3. API Docs
  4. network
  5. VirtualNetworkPeering

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.network.VirtualNetworkPeering

Explore with Pulumi AI

Manages a virtual network peering which allows resources to access other resources in the linked virtual network.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {
    name: "peeredvnets-rg",
    location: "West Europe",
});
const example_1 = new azure.network.VirtualNetwork("example-1", {
    name: "peternetwork1",
    resourceGroupName: example.name,
    addressSpaces: ["10.0.1.0/24"],
    location: example.location,
});
const example_2 = new azure.network.VirtualNetwork("example-2", {
    name: "peternetwork2",
    resourceGroupName: example.name,
    addressSpaces: ["10.0.2.0/24"],
    location: example.location,
});
const example_1VirtualNetworkPeering = new azure.network.VirtualNetworkPeering("example-1", {
    name: "peer1to2",
    resourceGroupName: example.name,
    virtualNetworkName: example_1.name,
    remoteVirtualNetworkId: example_2.id,
});
const example_2VirtualNetworkPeering = new azure.network.VirtualNetworkPeering("example-2", {
    name: "peer2to1",
    resourceGroupName: example.name,
    virtualNetworkName: example_2.name,
    remoteVirtualNetworkId: example_1.id,
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="peeredvnets-rg",
    location="West Europe")
example_1 = azure.network.VirtualNetwork("example-1",
    name="peternetwork1",
    resource_group_name=example.name,
    address_spaces=["10.0.1.0/24"],
    location=example.location)
example_2 = azure.network.VirtualNetwork("example-2",
    name="peternetwork2",
    resource_group_name=example.name,
    address_spaces=["10.0.2.0/24"],
    location=example.location)
example_1_virtual_network_peering = azure.network.VirtualNetworkPeering("example-1",
    name="peer1to2",
    resource_group_name=example.name,
    virtual_network_name=example_1.name,
    remote_virtual_network_id=example_2.id)
example_2_virtual_network_peering = azure.network.VirtualNetworkPeering("example-2",
    name="peer2to1",
    resource_group_name=example.name,
    virtual_network_name=example_2.name,
    remote_virtual_network_id=example_1.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("peeredvnets-rg"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		example_1, err := network.NewVirtualNetwork(ctx, "example-1", &network.VirtualNetworkArgs{
			Name:              pulumi.String("peternetwork1"),
			ResourceGroupName: example.Name,
			AddressSpaces: pulumi.StringArray{
				pulumi.String("10.0.1.0/24"),
			},
			Location: example.Location,
		})
		if err != nil {
			return err
		}
		example_2, err := network.NewVirtualNetwork(ctx, "example-2", &network.VirtualNetworkArgs{
			Name:              pulumi.String("peternetwork2"),
			ResourceGroupName: example.Name,
			AddressSpaces: pulumi.StringArray{
				pulumi.String("10.0.2.0/24"),
			},
			Location: example.Location,
		})
		if err != nil {
			return err
		}
		_, err = network.NewVirtualNetworkPeering(ctx, "example-1", &network.VirtualNetworkPeeringArgs{
			Name:                   pulumi.String("peer1to2"),
			ResourceGroupName:      example.Name,
			VirtualNetworkName:     example_1.Name,
			RemoteVirtualNetworkId: example_2.ID(),
		})
		if err != nil {
			return err
		}
		_, err = network.NewVirtualNetworkPeering(ctx, "example-2", &network.VirtualNetworkPeeringArgs{
			Name:                   pulumi.String("peer2to1"),
			ResourceGroupName:      example.Name,
			VirtualNetworkName:     example_2.Name,
			RemoteVirtualNetworkId: example_1.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "peeredvnets-rg",
        Location = "West Europe",
    });

    var example_1 = new Azure.Network.VirtualNetwork("example-1", new()
    {
        Name = "peternetwork1",
        ResourceGroupName = example.Name,
        AddressSpaces = new[]
        {
            "10.0.1.0/24",
        },
        Location = example.Location,
    });

    var example_2 = new Azure.Network.VirtualNetwork("example-2", new()
    {
        Name = "peternetwork2",
        ResourceGroupName = example.Name,
        AddressSpaces = new[]
        {
            "10.0.2.0/24",
        },
        Location = example.Location,
    });

    var example_1VirtualNetworkPeering = new Azure.Network.VirtualNetworkPeering("example-1", new()
    {
        Name = "peer1to2",
        ResourceGroupName = example.Name,
        VirtualNetworkName = example_1.Name,
        RemoteVirtualNetworkId = example_2.Id,
    });

    var example_2VirtualNetworkPeering = new Azure.Network.VirtualNetworkPeering("example-2", new()
    {
        Name = "peer2to1",
        ResourceGroupName = example.Name,
        VirtualNetworkName = example_2.Name,
        RemoteVirtualNetworkId = example_1.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.VirtualNetworkPeering;
import com.pulumi.azure.network.VirtualNetworkPeeringArgs;
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) {
        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("peeredvnets-rg")
            .location("West Europe")
            .build());

        var example_1 = new VirtualNetwork("example-1", VirtualNetworkArgs.builder()
            .name("peternetwork1")
            .resourceGroupName(example.name())
            .addressSpaces("10.0.1.0/24")
            .location(example.location())
            .build());

        var example_2 = new VirtualNetwork("example-2", VirtualNetworkArgs.builder()
            .name("peternetwork2")
            .resourceGroupName(example.name())
            .addressSpaces("10.0.2.0/24")
            .location(example.location())
            .build());

        var example_1VirtualNetworkPeering = new VirtualNetworkPeering("example-1VirtualNetworkPeering", VirtualNetworkPeeringArgs.builder()
            .name("peer1to2")
            .resourceGroupName(example.name())
            .virtualNetworkName(example_1.name())
            .remoteVirtualNetworkId(example_2.id())
            .build());

        var example_2VirtualNetworkPeering = new VirtualNetworkPeering("example-2VirtualNetworkPeering", VirtualNetworkPeeringArgs.builder()
            .name("peer2to1")
            .resourceGroupName(example.name())
            .virtualNetworkName(example_2.name())
            .remoteVirtualNetworkId(example_1.id())
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: peeredvnets-rg
      location: West Europe
  example-1:
    type: azure:network:VirtualNetwork
    properties:
      name: peternetwork1
      resourceGroupName: ${example.name}
      addressSpaces:
        - 10.0.1.0/24
      location: ${example.location}
  example-2:
    type: azure:network:VirtualNetwork
    properties:
      name: peternetwork2
      resourceGroupName: ${example.name}
      addressSpaces:
        - 10.0.2.0/24
      location: ${example.location}
  example-1VirtualNetworkPeering:
    type: azure:network:VirtualNetworkPeering
    name: example-1
    properties:
      name: peer1to2
      resourceGroupName: ${example.name}
      virtualNetworkName: ${["example-1"].name}
      remoteVirtualNetworkId: ${["example-2"].id}
  example-2VirtualNetworkPeering:
    type: azure:network:VirtualNetworkPeering
    name: example-2
    properties:
      name: peer2to1
      resourceGroupName: ${example.name}
      virtualNetworkName: ${["example-2"].name}
      remoteVirtualNetworkId: ${["example-1"].id}
Copy

Triggers)

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as std from "@pulumi/std";

const example = new azure.core.ResourceGroup("example", {
    name: "peeredvnets-rg",
    location: "West Europe",
});
const example_1 = new azure.network.VirtualNetwork("example-1", {
    name: "peternetwork1",
    resourceGroupName: example.name,
    addressSpaces: ["10.0.1.0/24"],
    location: example.location,
});
const example_2 = new azure.network.VirtualNetwork("example-2", {
    name: "peternetwork2",
    resourceGroupName: example.name,
    addressSpaces: ["10.0.2.0/24"],
    location: example.location,
});
const example_1VirtualNetworkPeering = new azure.network.VirtualNetworkPeering("example-1", {
    name: "peer1to2",
    resourceGroupName: example.name,
    virtualNetworkName: example_1.name,
    remoteVirtualNetworkId: example_2.id,
    triggers: {
        remote_address_space: std.joinOutput({
            separator: ",",
            input: example_2.addressSpaces,
        }).apply(invoke => invoke.result),
    },
});
const example_2VirtualNetworkPeering = new azure.network.VirtualNetworkPeering("example-2", {
    name: "peer2to1",
    resourceGroupName: example.name,
    virtualNetworkName: example_2.name,
    remoteVirtualNetworkId: example_1.id,
    triggers: {
        remote_address_space: std.joinOutput({
            separator: ",",
            input: example_1.addressSpaces,
        }).apply(invoke => invoke.result),
    },
});
Copy
import pulumi
import pulumi_azure as azure
import pulumi_std as std

example = azure.core.ResourceGroup("example",
    name="peeredvnets-rg",
    location="West Europe")
example_1 = azure.network.VirtualNetwork("example-1",
    name="peternetwork1",
    resource_group_name=example.name,
    address_spaces=["10.0.1.0/24"],
    location=example.location)
example_2 = azure.network.VirtualNetwork("example-2",
    name="peternetwork2",
    resource_group_name=example.name,
    address_spaces=["10.0.2.0/24"],
    location=example.location)
example_1_virtual_network_peering = azure.network.VirtualNetworkPeering("example-1",
    name="peer1to2",
    resource_group_name=example.name,
    virtual_network_name=example_1.name,
    remote_virtual_network_id=example_2.id,
    triggers={
        "remote_address_space": std.join_output(separator=",",
            input=example_2.address_spaces).apply(lambda invoke: invoke.result),
    })
example_2_virtual_network_peering = azure.network.VirtualNetworkPeering("example-2",
    name="peer2to1",
    resource_group_name=example.name,
    virtual_network_name=example_2.name,
    remote_virtual_network_id=example_1.id,
    triggers={
        "remote_address_space": std.join_output(separator=",",
            input=example_1.address_spaces).apply(lambda invoke: invoke.result),
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
	"github.com/pulumi/pulumi-std/sdk/go/std"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("peeredvnets-rg"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		example_1, err := network.NewVirtualNetwork(ctx, "example-1", &network.VirtualNetworkArgs{
			Name:              pulumi.String("peternetwork1"),
			ResourceGroupName: example.Name,
			AddressSpaces: pulumi.StringArray{
				pulumi.String("10.0.1.0/24"),
			},
			Location: example.Location,
		})
		if err != nil {
			return err
		}
		example_2, err := network.NewVirtualNetwork(ctx, "example-2", &network.VirtualNetworkArgs{
			Name:              pulumi.String("peternetwork2"),
			ResourceGroupName: example.Name,
			AddressSpaces: pulumi.StringArray{
				pulumi.String("10.0.2.0/24"),
			},
			Location: example.Location,
		})
		if err != nil {
			return err
		}
		_, err = network.NewVirtualNetworkPeering(ctx, "example-1", &network.VirtualNetworkPeeringArgs{
			Name:                   pulumi.String("peer1to2"),
			ResourceGroupName:      example.Name,
			VirtualNetworkName:     example_1.Name,
			RemoteVirtualNetworkId: example_2.ID(),
			Triggers: pulumi.StringMap{
				"remote_address_space": pulumi.String(std.JoinOutput(ctx, std.JoinOutputArgs{
					Separator: pulumi.String(","),
					Input:     example_2.AddressSpaces,
				}, nil).ApplyT(func(invoke std.JoinResult) (*string, error) {
					return invoke.Result, nil
				}).(pulumi.StringPtrOutput)),
			},
		})
		if err != nil {
			return err
		}
		_, err = network.NewVirtualNetworkPeering(ctx, "example-2", &network.VirtualNetworkPeeringArgs{
			Name:                   pulumi.String("peer2to1"),
			ResourceGroupName:      example.Name,
			VirtualNetworkName:     example_2.Name,
			RemoteVirtualNetworkId: example_1.ID(),
			Triggers: pulumi.StringMap{
				"remote_address_space": pulumi.String(std.JoinOutput(ctx, std.JoinOutputArgs{
					Separator: pulumi.String(","),
					Input:     example_1.AddressSpaces,
				}, nil).ApplyT(func(invoke std.JoinResult) (*string, error) {
					return invoke.Result, nil
				}).(pulumi.StringPtrOutput)),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "peeredvnets-rg",
        Location = "West Europe",
    });

    var example_1 = new Azure.Network.VirtualNetwork("example-1", new()
    {
        Name = "peternetwork1",
        ResourceGroupName = example.Name,
        AddressSpaces = new[]
        {
            "10.0.1.0/24",
        },
        Location = example.Location,
    });

    var example_2 = new Azure.Network.VirtualNetwork("example-2", new()
    {
        Name = "peternetwork2",
        ResourceGroupName = example.Name,
        AddressSpaces = new[]
        {
            "10.0.2.0/24",
        },
        Location = example.Location,
    });

    var example_1VirtualNetworkPeering = new Azure.Network.VirtualNetworkPeering("example-1", new()
    {
        Name = "peer1to2",
        ResourceGroupName = example.Name,
        VirtualNetworkName = example_1.Name,
        RemoteVirtualNetworkId = example_2.Id,
        Triggers = 
        {
            { "remote_address_space", Std.Join.Invoke(new()
            {
                Separator = ",",
                Input = example_2.AddressSpaces,
            }).Apply(invoke => invoke.Result) },
        },
    });

    var example_2VirtualNetworkPeering = new Azure.Network.VirtualNetworkPeering("example-2", new()
    {
        Name = "peer2to1",
        ResourceGroupName = example.Name,
        VirtualNetworkName = example_2.Name,
        RemoteVirtualNetworkId = example_1.Id,
        Triggers = 
        {
            { "remote_address_space", Std.Join.Invoke(new()
            {
                Separator = ",",
                Input = example_1.AddressSpaces,
            }).Apply(invoke => invoke.Result) },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.VirtualNetworkPeering;
import com.pulumi.azure.network.VirtualNetworkPeeringArgs;
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) {
        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("peeredvnets-rg")
            .location("West Europe")
            .build());

        var example_1 = new VirtualNetwork("example-1", VirtualNetworkArgs.builder()
            .name("peternetwork1")
            .resourceGroupName(example.name())
            .addressSpaces("10.0.1.0/24")
            .location(example.location())
            .build());

        var example_2 = new VirtualNetwork("example-2", VirtualNetworkArgs.builder()
            .name("peternetwork2")
            .resourceGroupName(example.name())
            .addressSpaces("10.0.2.0/24")
            .location(example.location())
            .build());

        var example_1VirtualNetworkPeering = new VirtualNetworkPeering("example-1VirtualNetworkPeering", VirtualNetworkPeeringArgs.builder()
            .name("peer1to2")
            .resourceGroupName(example.name())
            .virtualNetworkName(example_1.name())
            .remoteVirtualNetworkId(example_2.id())
            .triggers(Map.of("remote_address_space", StdFunctions.join().applyValue(invoke -> invoke.result())))
            .build());

        var example_2VirtualNetworkPeering = new VirtualNetworkPeering("example-2VirtualNetworkPeering", VirtualNetworkPeeringArgs.builder()
            .name("peer2to1")
            .resourceGroupName(example.name())
            .virtualNetworkName(example_2.name())
            .remoteVirtualNetworkId(example_1.id())
            .triggers(Map.of("remote_address_space", StdFunctions.join().applyValue(invoke -> invoke.result())))
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: peeredvnets-rg
      location: West Europe
  example-1:
    type: azure:network:VirtualNetwork
    properties:
      name: peternetwork1
      resourceGroupName: ${example.name}
      addressSpaces:
        - 10.0.1.0/24
      location: ${example.location}
  example-2:
    type: azure:network:VirtualNetwork
    properties:
      name: peternetwork2
      resourceGroupName: ${example.name}
      addressSpaces:
        - 10.0.2.0/24
      location: ${example.location}
  example-1VirtualNetworkPeering:
    type: azure:network:VirtualNetworkPeering
    name: example-1
    properties:
      name: peer1to2
      resourceGroupName: ${example.name}
      virtualNetworkName: ${["example-1"].name}
      remoteVirtualNetworkId: ${["example-2"].id}
      triggers:
        remote_address_space:
          fn::invoke:
            function: std:join
            arguments:
              separator: ','
              input: ${["example-2"].addressSpaces}
            return: result
  example-2VirtualNetworkPeering:
    type: azure:network:VirtualNetworkPeering
    name: example-2
    properties:
      name: peer2to1
      resourceGroupName: ${example.name}
      virtualNetworkName: ${["example-2"].name}
      remoteVirtualNetworkId: ${["example-1"].id}
      triggers:
        remote_address_space:
          fn::invoke:
            function: std:join
            arguments:
              separator: ','
              input: ${["example-1"].addressSpaces}
            return: result
Copy

Note

Virtual Network peerings cannot be created, updated or deleted concurrently.

Create VirtualNetworkPeering Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new VirtualNetworkPeering(name: string, args: VirtualNetworkPeeringArgs, opts?: CustomResourceOptions);
@overload
def VirtualNetworkPeering(resource_name: str,
                          args: VirtualNetworkPeeringArgs,
                          opts: Optional[ResourceOptions] = None)

@overload
def VirtualNetworkPeering(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          remote_virtual_network_id: Optional[str] = None,
                          virtual_network_name: Optional[str] = None,
                          resource_group_name: Optional[str] = None,
                          local_subnet_names: Optional[Sequence[str]] = None,
                          name: Optional[str] = None,
                          only_ipv6_peering_enabled: Optional[bool] = None,
                          peer_complete_virtual_networks_enabled: Optional[bool] = None,
                          remote_subnet_names: Optional[Sequence[str]] = None,
                          allow_forwarded_traffic: Optional[bool] = None,
                          allow_virtual_network_access: Optional[bool] = None,
                          triggers: Optional[Mapping[str, str]] = None,
                          use_remote_gateways: Optional[bool] = None,
                          allow_gateway_transit: Optional[bool] = None)
func NewVirtualNetworkPeering(ctx *Context, name string, args VirtualNetworkPeeringArgs, opts ...ResourceOption) (*VirtualNetworkPeering, error)
public VirtualNetworkPeering(string name, VirtualNetworkPeeringArgs args, CustomResourceOptions? opts = null)
public VirtualNetworkPeering(String name, VirtualNetworkPeeringArgs args)
public VirtualNetworkPeering(String name, VirtualNetworkPeeringArgs args, CustomResourceOptions options)
type: azure:network:VirtualNetworkPeering
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. VirtualNetworkPeeringArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. VirtualNetworkPeeringArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. VirtualNetworkPeeringArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. VirtualNetworkPeeringArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. VirtualNetworkPeeringArgs
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 azureVirtualNetworkPeeringResource = new Azure.Network.VirtualNetworkPeering("azureVirtualNetworkPeeringResource", new()
{
    RemoteVirtualNetworkId = "string",
    VirtualNetworkName = "string",
    ResourceGroupName = "string",
    LocalSubnetNames = new[]
    {
        "string",
    },
    Name = "string",
    OnlyIpv6PeeringEnabled = false,
    PeerCompleteVirtualNetworksEnabled = false,
    RemoteSubnetNames = new[]
    {
        "string",
    },
    AllowForwardedTraffic = false,
    AllowVirtualNetworkAccess = false,
    Triggers = 
    {
        { "string", "string" },
    },
    UseRemoteGateways = false,
    AllowGatewayTransit = false,
});
Copy
example, err := network.NewVirtualNetworkPeering(ctx, "azureVirtualNetworkPeeringResource", &network.VirtualNetworkPeeringArgs{
	RemoteVirtualNetworkId: pulumi.String("string"),
	VirtualNetworkName:     pulumi.String("string"),
	ResourceGroupName:      pulumi.String("string"),
	LocalSubnetNames: pulumi.StringArray{
		pulumi.String("string"),
	},
	Name:                               pulumi.String("string"),
	OnlyIpv6PeeringEnabled:             pulumi.Bool(false),
	PeerCompleteVirtualNetworksEnabled: pulumi.Bool(false),
	RemoteSubnetNames: pulumi.StringArray{
		pulumi.String("string"),
	},
	AllowForwardedTraffic:     pulumi.Bool(false),
	AllowVirtualNetworkAccess: pulumi.Bool(false),
	Triggers: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	UseRemoteGateways:   pulumi.Bool(false),
	AllowGatewayTransit: pulumi.Bool(false),
})
Copy
var azureVirtualNetworkPeeringResource = new VirtualNetworkPeering("azureVirtualNetworkPeeringResource", VirtualNetworkPeeringArgs.builder()
    .remoteVirtualNetworkId("string")
    .virtualNetworkName("string")
    .resourceGroupName("string")
    .localSubnetNames("string")
    .name("string")
    .onlyIpv6PeeringEnabled(false)
    .peerCompleteVirtualNetworksEnabled(false)
    .remoteSubnetNames("string")
    .allowForwardedTraffic(false)
    .allowVirtualNetworkAccess(false)
    .triggers(Map.of("string", "string"))
    .useRemoteGateways(false)
    .allowGatewayTransit(false)
    .build());
Copy
azure_virtual_network_peering_resource = azure.network.VirtualNetworkPeering("azureVirtualNetworkPeeringResource",
    remote_virtual_network_id="string",
    virtual_network_name="string",
    resource_group_name="string",
    local_subnet_names=["string"],
    name="string",
    only_ipv6_peering_enabled=False,
    peer_complete_virtual_networks_enabled=False,
    remote_subnet_names=["string"],
    allow_forwarded_traffic=False,
    allow_virtual_network_access=False,
    triggers={
        "string": "string",
    },
    use_remote_gateways=False,
    allow_gateway_transit=False)
Copy
const azureVirtualNetworkPeeringResource = new azure.network.VirtualNetworkPeering("azureVirtualNetworkPeeringResource", {
    remoteVirtualNetworkId: "string",
    virtualNetworkName: "string",
    resourceGroupName: "string",
    localSubnetNames: ["string"],
    name: "string",
    onlyIpv6PeeringEnabled: false,
    peerCompleteVirtualNetworksEnabled: false,
    remoteSubnetNames: ["string"],
    allowForwardedTraffic: false,
    allowVirtualNetworkAccess: false,
    triggers: {
        string: "string",
    },
    useRemoteGateways: false,
    allowGatewayTransit: false,
});
Copy
type: azure:network:VirtualNetworkPeering
properties:
    allowForwardedTraffic: false
    allowGatewayTransit: false
    allowVirtualNetworkAccess: false
    localSubnetNames:
        - string
    name: string
    onlyIpv6PeeringEnabled: false
    peerCompleteVirtualNetworksEnabled: false
    remoteSubnetNames:
        - string
    remoteVirtualNetworkId: string
    resourceGroupName: string
    triggers:
        string: string
    useRemoteGateways: false
    virtualNetworkName: string
Copy

VirtualNetworkPeering 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 VirtualNetworkPeering resource accepts the following input properties:

RemoteVirtualNetworkId
This property is required.
Changes to this property will trigger replacement.
string
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
VirtualNetworkName
This property is required.
Changes to this property will trigger replacement.
string
The name of the virtual network. Changing this forces a new resource to be created.
AllowForwardedTraffic bool
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
AllowGatewayTransit bool
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
AllowVirtualNetworkAccess bool
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
LocalSubnetNames List<string>
A list of local Subnet names that are Subnet peered with remote Virtual Network.
Name Changes to this property will trigger replacement. string
The name of the virtual network peering. Changing this forces a new resource to be created.
OnlyIpv6PeeringEnabled Changes to this property will trigger replacement. bool
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
PeerCompleteVirtualNetworksEnabled Changes to this property will trigger replacement. bool
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
RemoteSubnetNames List<string>
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
Triggers Dictionary<string, string>
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
UseRemoteGateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

RemoteVirtualNetworkId
This property is required.
Changes to this property will trigger replacement.
string
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
VirtualNetworkName
This property is required.
Changes to this property will trigger replacement.
string
The name of the virtual network. Changing this forces a new resource to be created.
AllowForwardedTraffic bool
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
AllowGatewayTransit bool
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
AllowVirtualNetworkAccess bool
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
LocalSubnetNames []string
A list of local Subnet names that are Subnet peered with remote Virtual Network.
Name Changes to this property will trigger replacement. string
The name of the virtual network peering. Changing this forces a new resource to be created.
OnlyIpv6PeeringEnabled Changes to this property will trigger replacement. bool
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
PeerCompleteVirtualNetworksEnabled Changes to this property will trigger replacement. bool
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
RemoteSubnetNames []string
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
Triggers map[string]string
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
UseRemoteGateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

remoteVirtualNetworkId
This property is required.
Changes to this property will trigger replacement.
String
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
virtualNetworkName
This property is required.
Changes to this property will trigger replacement.
String
The name of the virtual network. Changing this forces a new resource to be created.
allowForwardedTraffic Boolean
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
allowGatewayTransit Boolean
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
allowVirtualNetworkAccess Boolean
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
localSubnetNames List<String>
A list of local Subnet names that are Subnet peered with remote Virtual Network.
name Changes to this property will trigger replacement. String
The name of the virtual network peering. Changing this forces a new resource to be created.
onlyIpv6PeeringEnabled Changes to this property will trigger replacement. Boolean
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
peerCompleteVirtualNetworksEnabled Changes to this property will trigger replacement. Boolean
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
remoteSubnetNames List<String>
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
triggers Map<String,String>
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
useRemoteGateways Boolean

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

remoteVirtualNetworkId
This property is required.
Changes to this property will trigger replacement.
string
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
virtualNetworkName
This property is required.
Changes to this property will trigger replacement.
string
The name of the virtual network. Changing this forces a new resource to be created.
allowForwardedTraffic boolean
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
allowGatewayTransit boolean
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
allowVirtualNetworkAccess boolean
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
localSubnetNames string[]
A list of local Subnet names that are Subnet peered with remote Virtual Network.
name Changes to this property will trigger replacement. string
The name of the virtual network peering. Changing this forces a new resource to be created.
onlyIpv6PeeringEnabled Changes to this property will trigger replacement. boolean
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
peerCompleteVirtualNetworksEnabled Changes to this property will trigger replacement. boolean
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
remoteSubnetNames string[]
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
triggers {[key: string]: string}
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
useRemoteGateways boolean

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

remote_virtual_network_id
This property is required.
Changes to this property will trigger replacement.
str
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
virtual_network_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the virtual network. Changing this forces a new resource to be created.
allow_forwarded_traffic bool
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
allow_gateway_transit bool
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
allow_virtual_network_access bool
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
local_subnet_names Sequence[str]
A list of local Subnet names that are Subnet peered with remote Virtual Network.
name Changes to this property will trigger replacement. str
The name of the virtual network peering. Changing this forces a new resource to be created.
only_ipv6_peering_enabled Changes to this property will trigger replacement. bool
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
peer_complete_virtual_networks_enabled Changes to this property will trigger replacement. bool
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
remote_subnet_names Sequence[str]
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
triggers Mapping[str, str]
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
use_remote_gateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

remoteVirtualNetworkId
This property is required.
Changes to this property will trigger replacement.
String
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
virtualNetworkName
This property is required.
Changes to this property will trigger replacement.
String
The name of the virtual network. Changing this forces a new resource to be created.
allowForwardedTraffic Boolean
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
allowGatewayTransit Boolean
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
allowVirtualNetworkAccess Boolean
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
localSubnetNames List<String>
A list of local Subnet names that are Subnet peered with remote Virtual Network.
name Changes to this property will trigger replacement. String
The name of the virtual network peering. Changing this forces a new resource to be created.
onlyIpv6PeeringEnabled Changes to this property will trigger replacement. Boolean
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
peerCompleteVirtualNetworksEnabled Changes to this property will trigger replacement. Boolean
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
remoteSubnetNames List<String>
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
triggers Map<String>
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
useRemoteGateways Boolean

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

Outputs

All input properties are implicitly available as output properties. Additionally, the VirtualNetworkPeering resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing VirtualNetworkPeering Resource

Get an existing VirtualNetworkPeering 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?: VirtualNetworkPeeringState, opts?: CustomResourceOptions): VirtualNetworkPeering
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        allow_forwarded_traffic: Optional[bool] = None,
        allow_gateway_transit: Optional[bool] = None,
        allow_virtual_network_access: Optional[bool] = None,
        local_subnet_names: Optional[Sequence[str]] = None,
        name: Optional[str] = None,
        only_ipv6_peering_enabled: Optional[bool] = None,
        peer_complete_virtual_networks_enabled: Optional[bool] = None,
        remote_subnet_names: Optional[Sequence[str]] = None,
        remote_virtual_network_id: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        triggers: Optional[Mapping[str, str]] = None,
        use_remote_gateways: Optional[bool] = None,
        virtual_network_name: Optional[str] = None) -> VirtualNetworkPeering
func GetVirtualNetworkPeering(ctx *Context, name string, id IDInput, state *VirtualNetworkPeeringState, opts ...ResourceOption) (*VirtualNetworkPeering, error)
public static VirtualNetworkPeering Get(string name, Input<string> id, VirtualNetworkPeeringState? state, CustomResourceOptions? opts = null)
public static VirtualNetworkPeering get(String name, Output<String> id, VirtualNetworkPeeringState state, CustomResourceOptions options)
resources:  _:    type: azure:network:VirtualNetworkPeering    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
AllowForwardedTraffic bool
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
AllowGatewayTransit bool
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
AllowVirtualNetworkAccess bool
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
LocalSubnetNames List<string>
A list of local Subnet names that are Subnet peered with remote Virtual Network.
Name Changes to this property will trigger replacement. string
The name of the virtual network peering. Changing this forces a new resource to be created.
OnlyIpv6PeeringEnabled Changes to this property will trigger replacement. bool
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
PeerCompleteVirtualNetworksEnabled Changes to this property will trigger replacement. bool
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
RemoteSubnetNames List<string>
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
RemoteVirtualNetworkId Changes to this property will trigger replacement. string
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
Triggers Dictionary<string, string>
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
UseRemoteGateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

VirtualNetworkName Changes to this property will trigger replacement. string
The name of the virtual network. Changing this forces a new resource to be created.
AllowForwardedTraffic bool
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
AllowGatewayTransit bool
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
AllowVirtualNetworkAccess bool
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
LocalSubnetNames []string
A list of local Subnet names that are Subnet peered with remote Virtual Network.
Name Changes to this property will trigger replacement. string
The name of the virtual network peering. Changing this forces a new resource to be created.
OnlyIpv6PeeringEnabled Changes to this property will trigger replacement. bool
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
PeerCompleteVirtualNetworksEnabled Changes to this property will trigger replacement. bool
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
RemoteSubnetNames []string
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
RemoteVirtualNetworkId Changes to this property will trigger replacement. string
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
Triggers map[string]string
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
UseRemoteGateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

VirtualNetworkName Changes to this property will trigger replacement. string
The name of the virtual network. Changing this forces a new resource to be created.
allowForwardedTraffic Boolean
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
allowGatewayTransit Boolean
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
allowVirtualNetworkAccess Boolean
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
localSubnetNames List<String>
A list of local Subnet names that are Subnet peered with remote Virtual Network.
name Changes to this property will trigger replacement. String
The name of the virtual network peering. Changing this forces a new resource to be created.
onlyIpv6PeeringEnabled Changes to this property will trigger replacement. Boolean
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
peerCompleteVirtualNetworksEnabled Changes to this property will trigger replacement. Boolean
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
remoteSubnetNames List<String>
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
remoteVirtualNetworkId Changes to this property will trigger replacement. String
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
triggers Map<String,String>
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
useRemoteGateways Boolean

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

virtualNetworkName Changes to this property will trigger replacement. String
The name of the virtual network. Changing this forces a new resource to be created.
allowForwardedTraffic boolean
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
allowGatewayTransit boolean
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
allowVirtualNetworkAccess boolean
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
localSubnetNames string[]
A list of local Subnet names that are Subnet peered with remote Virtual Network.
name Changes to this property will trigger replacement. string
The name of the virtual network peering. Changing this forces a new resource to be created.
onlyIpv6PeeringEnabled Changes to this property will trigger replacement. boolean
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
peerCompleteVirtualNetworksEnabled Changes to this property will trigger replacement. boolean
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
remoteSubnetNames string[]
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
remoteVirtualNetworkId Changes to this property will trigger replacement. string
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
triggers {[key: string]: string}
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
useRemoteGateways boolean

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

virtualNetworkName Changes to this property will trigger replacement. string
The name of the virtual network. Changing this forces a new resource to be created.
allow_forwarded_traffic bool
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
allow_gateway_transit bool
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
allow_virtual_network_access bool
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
local_subnet_names Sequence[str]
A list of local Subnet names that are Subnet peered with remote Virtual Network.
name Changes to this property will trigger replacement. str
The name of the virtual network peering. Changing this forces a new resource to be created.
only_ipv6_peering_enabled Changes to this property will trigger replacement. bool
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
peer_complete_virtual_networks_enabled Changes to this property will trigger replacement. bool
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
remote_subnet_names Sequence[str]
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
remote_virtual_network_id Changes to this property will trigger replacement. str
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
resource_group_name Changes to this property will trigger replacement. str
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
triggers Mapping[str, str]
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
use_remote_gateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

virtual_network_name Changes to this property will trigger replacement. str
The name of the virtual network. Changing this forces a new resource to be created.
allowForwardedTraffic Boolean
Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
allowGatewayTransit Boolean
Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false.
allowVirtualNetworkAccess Boolean
Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to true.
localSubnetNames List<String>
A list of local Subnet names that are Subnet peered with remote Virtual Network.
name Changes to this property will trigger replacement. String
The name of the virtual network peering. Changing this forces a new resource to be created.
onlyIpv6PeeringEnabled Changes to this property will trigger replacement. Boolean
Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
peerCompleteVirtualNetworksEnabled Changes to this property will trigger replacement. Boolean
Specifies whether complete Virtual Network address space is peered. Defaults to true. Changing this forces a new resource to be created.
remoteSubnetNames List<String>
A list of remote Subnet names from remote Virtual Network that are Subnet peered.
remoteVirtualNetworkId Changes to this property will trigger replacement. String
The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
triggers Map<String>
A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.
useRemoteGateways Boolean

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

NOTE: use_remote_gateways must be set to false if using Global Virtual Network Peerings.

virtualNetworkName Changes to this property will trigger replacement. String
The name of the virtual network. Changing this forces a new resource to be created.

Import

Virtual Network Peerings can be imported using the resource id, e.g.

$ pulumi import azure:network/virtualNetworkPeering:VirtualNetworkPeering examplePeering /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/virtualNetworkPeerings/myvnet1peering
Copy

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 azurerm Terraform Provider.