We recommend using Azure Native.
Azure v6.28.0 published on Friday, Oct 3, 2025 by Pulumi
azure.network.getVirtualNetworkPeering
Start a Neo task
Explain and create an azure.network.getVirtualNetworkPeering resource
Use this data source to access information about an existing virtual network peering.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.network.getVirtualNetwork({
name: "vnet01",
resourceGroupName: "networking",
});
const exampleGetVirtualNetworkPeering = example.then(example => azure.network.getVirtualNetworkPeering({
name: "peer-vnet01-to-vnet02",
virtualNetworkId: example.id,
}));
export const id = exampleGetVirtualNetworkPeering.then(exampleGetVirtualNetworkPeering => exampleGetVirtualNetworkPeering.id);
import pulumi
import pulumi_azure as azure
example = azure.network.get_virtual_network(name="vnet01",
resource_group_name="networking")
example_get_virtual_network_peering = azure.network.get_virtual_network_peering(name="peer-vnet01-to-vnet02",
virtual_network_id=example.id)
pulumi.export("id", example_get_virtual_network_peering.id)
package main
import (
"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 := network.LookupVirtualNetwork(ctx, &network.LookupVirtualNetworkArgs{
Name: "vnet01",
ResourceGroupName: "networking",
}, nil)
if err != nil {
return err
}
exampleGetVirtualNetworkPeering, err := network.LookupVirtualNetworkPeering(ctx, &network.LookupVirtualNetworkPeeringArgs{
Name: "peer-vnet01-to-vnet02",
VirtualNetworkId: example.Id,
}, nil)
if err != nil {
return err
}
ctx.Export("id", exampleGetVirtualNetworkPeering.Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.Network.GetVirtualNetwork.Invoke(new()
{
Name = "vnet01",
ResourceGroupName = "networking",
});
var exampleGetVirtualNetworkPeering = Azure.Network.GetVirtualNetworkPeering.Invoke(new()
{
Name = "peer-vnet01-to-vnet02",
VirtualNetworkId = example.Apply(getVirtualNetworkResult => getVirtualNetworkResult.Id),
});
return new Dictionary<string, object?>
{
["id"] = exampleGetVirtualNetworkPeering.Apply(getVirtualNetworkPeeringResult => getVirtualNetworkPeeringResult.Id),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.network.NetworkFunctions;
import com.pulumi.azure.network.inputs.GetVirtualNetworkArgs;
import com.pulumi.azure.network.inputs.GetVirtualNetworkPeeringArgs;
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 = NetworkFunctions.getVirtualNetwork(GetVirtualNetworkArgs.builder()
.name("vnet01")
.resourceGroupName("networking")
.build());
final var exampleGetVirtualNetworkPeering = NetworkFunctions.getVirtualNetworkPeering(GetVirtualNetworkPeeringArgs.builder()
.name("peer-vnet01-to-vnet02")
.virtualNetworkId(example.id())
.build());
ctx.export("id", exampleGetVirtualNetworkPeering.id());
}
}
variables:
example:
fn::invoke:
function: azure:network:getVirtualNetwork
arguments:
name: vnet01
resourceGroupName: networking
exampleGetVirtualNetworkPeering:
fn::invoke:
function: azure:network:getVirtualNetworkPeering
arguments:
name: peer-vnet01-to-vnet02
virtualNetworkId: ${example.id}
outputs:
id: ${exampleGetVirtualNetworkPeering.id}
API Providers
This data source uses the following Azure API Providers:
Microsoft.Network- 2024-05-01
Using getVirtualNetworkPeering
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 getVirtualNetworkPeering(args: GetVirtualNetworkPeeringArgs, opts?: InvokeOptions): Promise<GetVirtualNetworkPeeringResult>
function getVirtualNetworkPeeringOutput(args: GetVirtualNetworkPeeringOutputArgs, opts?: InvokeOptions): Output<GetVirtualNetworkPeeringResult>def get_virtual_network_peering(name: Optional[str] = None,
virtual_network_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetVirtualNetworkPeeringResult
def get_virtual_network_peering_output(name: Optional[pulumi.Input[str]] = None,
virtual_network_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetVirtualNetworkPeeringResult]func LookupVirtualNetworkPeering(ctx *Context, args *LookupVirtualNetworkPeeringArgs, opts ...InvokeOption) (*LookupVirtualNetworkPeeringResult, error)
func LookupVirtualNetworkPeeringOutput(ctx *Context, args *LookupVirtualNetworkPeeringOutputArgs, opts ...InvokeOption) LookupVirtualNetworkPeeringResultOutput> Note: This function is named LookupVirtualNetworkPeering in the Go SDK.
public static class GetVirtualNetworkPeering
{
public static Task<GetVirtualNetworkPeeringResult> InvokeAsync(GetVirtualNetworkPeeringArgs args, InvokeOptions? opts = null)
public static Output<GetVirtualNetworkPeeringResult> Invoke(GetVirtualNetworkPeeringInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetVirtualNetworkPeeringResult> getVirtualNetworkPeering(GetVirtualNetworkPeeringArgs args, InvokeOptions options)
public static Output<GetVirtualNetworkPeeringResult> getVirtualNetworkPeering(GetVirtualNetworkPeeringArgs args, InvokeOptions options)
fn::invoke:
function: azure:network/getVirtualNetworkPeering:getVirtualNetworkPeering
arguments:
# arguments dictionaryThe following arguments are supported:
- Name string
- The name of this virtual network peering.
- Virtual
Network stringId - The resource ID of the virtual network.
- Name string
- The name of this virtual network peering.
- Virtual
Network stringId - The resource ID of the virtual network.
- name String
- The name of this virtual network peering.
- virtual
Network StringId - The resource ID of the virtual network.
- name string
- The name of this virtual network peering.
- virtual
Network stringId - The resource ID of the virtual network.
- name str
- The name of this virtual network peering.
- virtual_
network_ strid - The resource ID of the virtual network.
- name String
- The name of this virtual network peering.
- virtual
Network StringId - The resource ID of the virtual network.
getVirtualNetworkPeering Result
The following output properties are available:
- Allow
Forwarded boolTraffic - Controls if forwarded traffic from VMs in the remote virtual network is allowed.
- Allow
Gateway boolTransit - Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- Allow
Virtual boolNetwork Access - Controls if the traffic from the local virtual network can reach the remote virtual network.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Only
Ipv6Peering boolEnabled - Specifies whether only IPv6 address space is peered for Subnet peering.
- Peer
Complete boolVirtual Networks Enabled - Specifies whether complete Virtual Network address space is peered.
- Remote
Virtual stringNetwork Id - The full Azure resource ID of the remote virtual network.
- Use
Remote boolGateways - Controls if remote gateways can be used on the local virtual network.
- Virtual
Network stringId
- Allow
Forwarded boolTraffic - Controls if forwarded traffic from VMs in the remote virtual network is allowed.
- Allow
Gateway boolTransit - Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- Allow
Virtual boolNetwork Access - Controls if the traffic from the local virtual network can reach the remote virtual network.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Only
Ipv6Peering boolEnabled - Specifies whether only IPv6 address space is peered for Subnet peering.
- Peer
Complete boolVirtual Networks Enabled - Specifies whether complete Virtual Network address space is peered.
- Remote
Virtual stringNetwork Id - The full Azure resource ID of the remote virtual network.
- Use
Remote boolGateways - Controls if remote gateways can be used on the local virtual network.
- Virtual
Network stringId
- allow
Forwarded BooleanTraffic - Controls if forwarded traffic from VMs in the remote virtual network is allowed.
- allow
Gateway BooleanTransit - Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- allow
Virtual BooleanNetwork Access - Controls if the traffic from the local virtual network can reach the remote virtual network.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- only
Ipv6Peering BooleanEnabled - Specifies whether only IPv6 address space is peered for Subnet peering.
- peer
Complete BooleanVirtual Networks Enabled - Specifies whether complete Virtual Network address space is peered.
- remote
Virtual StringNetwork Id - The full Azure resource ID of the remote virtual network.
- use
Remote BooleanGateways - Controls if remote gateways can be used on the local virtual network.
- virtual
Network StringId
- allow
Forwarded booleanTraffic - Controls if forwarded traffic from VMs in the remote virtual network is allowed.
- allow
Gateway booleanTransit - Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- allow
Virtual booleanNetwork Access - Controls if the traffic from the local virtual network can reach the remote virtual network.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- only
Ipv6Peering booleanEnabled - Specifies whether only IPv6 address space is peered for Subnet peering.
- peer
Complete booleanVirtual Networks Enabled - Specifies whether complete Virtual Network address space is peered.
- remote
Virtual stringNetwork Id - The full Azure resource ID of the remote virtual network.
- use
Remote booleanGateways - Controls if remote gateways can be used on the local virtual network.
- virtual
Network stringId
- allow_
forwarded_ booltraffic - Controls if forwarded traffic from VMs in the remote virtual network is allowed.
- allow_
gateway_ booltransit - Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- allow_
virtual_ boolnetwork_ access - Controls if the traffic from the local virtual network can reach the remote virtual network.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- only_
ipv6_ boolpeering_ enabled - Specifies whether only IPv6 address space is peered for Subnet peering.
- peer_
complete_ boolvirtual_ networks_ enabled - Specifies whether complete Virtual Network address space is peered.
- remote_
virtual_ strnetwork_ id - The full Azure resource ID of the remote virtual network.
- use_
remote_ boolgateways - Controls if remote gateways can be used on the local virtual network.
- virtual_
network_ strid
- allow
Forwarded BooleanTraffic - Controls if forwarded traffic from VMs in the remote virtual network is allowed.
- allow
Gateway BooleanTransit - Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- allow
Virtual BooleanNetwork Access - Controls if the traffic from the local virtual network can reach the remote virtual network.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- only
Ipv6Peering BooleanEnabled - Specifies whether only IPv6 address space is peered for Subnet peering.
- peer
Complete BooleanVirtual Networks Enabled - Specifies whether complete Virtual Network address space is peered.
- remote
Virtual StringNetwork Id - The full Azure resource ID of the remote virtual network.
- use
Remote BooleanGateways - Controls if remote gateways can be used on the local virtual network.
- virtual
Network StringId
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.
