1. Packages
  2. Azure Classic
  3. API Docs
  4. siterecovery
  5. NetworkMapping

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Manages a site recovery network mapping on Azure. A network mapping decides how to translate connected netwroks when a VM is migrated from one region to another.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var primaryResourceGroup = new Azure.Core.ResourceGroup("primaryResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "West US",
            });
            var secondaryResourceGroup = new Azure.Core.ResourceGroup("secondaryResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "East US",
            });
            var vault = new Azure.RecoveryServices.Vault("vault", new Azure.RecoveryServices.VaultArgs
            {
                Location = secondaryResourceGroup.Location,
                ResourceGroupName = secondaryResourceGroup.Name,
                Sku = "Standard",
            });
            var primaryFabric = new Azure.SiteRecovery.Fabric("primaryFabric", new Azure.SiteRecovery.FabricArgs
            {
                ResourceGroupName = secondaryResourceGroup.Name,
                RecoveryVaultName = vault.Name,
                Location = primaryResourceGroup.Location,
            });
            var secondaryFabric = new Azure.SiteRecovery.Fabric("secondaryFabric", new Azure.SiteRecovery.FabricArgs
            {
                ResourceGroupName = secondaryResourceGroup.Name,
                RecoveryVaultName = vault.Name,
                Location = secondaryResourceGroup.Location,
            }, new CustomResourceOptions
            {
                DependsOn = 
                {
                    primaryFabric,
                },
            });
            // Avoids issues with creating fabrics simultaneously
            var primaryVirtualNetwork = new Azure.Network.VirtualNetwork("primaryVirtualNetwork", new Azure.Network.VirtualNetworkArgs
            {
                ResourceGroupName = primaryResourceGroup.Name,
                AddressSpaces = 
                {
                    "192.168.1.0/24",
                },
                Location = primaryResourceGroup.Location,
            });
            var secondaryVirtualNetwork = new Azure.Network.VirtualNetwork("secondaryVirtualNetwork", new Azure.Network.VirtualNetworkArgs
            {
                ResourceGroupName = secondaryResourceGroup.Name,
                AddressSpaces = 
                {
                    "192.168.2.0/24",
                },
                Location = secondaryResourceGroup.Location,
            });
            var recovery_mapping = new Azure.SiteRecovery.NetworkMapping("recovery-mapping", new Azure.SiteRecovery.NetworkMappingArgs
            {
                ResourceGroupName = secondaryResourceGroup.Name,
                RecoveryVaultName = vault.Name,
                SourceRecoveryFabricName = "primary-fabric",
                TargetRecoveryFabricName = "secondary-fabric",
                SourceNetworkId = primaryVirtualNetwork.Id,
                TargetNetworkId = secondaryVirtualNetwork.Id,
            });
        }
    
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/network"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/recoveryservices"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/siterecovery"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		primaryResourceGroup, err := core.NewResourceGroup(ctx, "primaryResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West US"),
    		})
    		if err != nil {
    			return err
    		}
    		secondaryResourceGroup, err := core.NewResourceGroup(ctx, "secondaryResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("East US"),
    		})
    		if err != nil {
    			return err
    		}
    		vault, err := recoveryservices.NewVault(ctx, "vault", &recoveryservices.VaultArgs{
    			Location:          secondaryResourceGroup.Location,
    			ResourceGroupName: secondaryResourceGroup.Name,
    			Sku:               pulumi.String("Standard"),
    		})
    		if err != nil {
    			return err
    		}
    		primaryFabric, err := siterecovery.NewFabric(ctx, "primaryFabric", &siterecovery.FabricArgs{
    			ResourceGroupName: secondaryResourceGroup.Name,
    			RecoveryVaultName: vault.Name,
    			Location:          primaryResourceGroup.Location,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = siterecovery.NewFabric(ctx, "secondaryFabric", &siterecovery.FabricArgs{
    			ResourceGroupName: secondaryResourceGroup.Name,
    			RecoveryVaultName: vault.Name,
    			Location:          secondaryResourceGroup.Location,
    		}, pulumi.DependsOn([]pulumi.Resource{
    			primaryFabric,
    		}))
    		if err != nil {
    			return err
    		}
    		primaryVirtualNetwork, err := network.NewVirtualNetwork(ctx, "primaryVirtualNetwork", &network.VirtualNetworkArgs{
    			ResourceGroupName: primaryResourceGroup.Name,
    			AddressSpaces: pulumi.StringArray{
    				pulumi.String("192.168.1.0/24"),
    			},
    			Location: primaryResourceGroup.Location,
    		})
    		if err != nil {
    			return err
    		}
    		secondaryVirtualNetwork, err := network.NewVirtualNetwork(ctx, "secondaryVirtualNetwork", &network.VirtualNetworkArgs{
    			ResourceGroupName: secondaryResourceGroup.Name,
    			AddressSpaces: pulumi.StringArray{
    				pulumi.String("192.168.2.0/24"),
    			},
    			Location: secondaryResourceGroup.Location,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = siterecovery.NewNetworkMapping(ctx, "recovery-mapping", &siterecovery.NetworkMappingArgs{
    			ResourceGroupName:        secondaryResourceGroup.Name,
    			RecoveryVaultName:        vault.Name,
    			SourceRecoveryFabricName: pulumi.String("primary-fabric"),
    			TargetRecoveryFabricName: pulumi.String("secondary-fabric"),
    			SourceNetworkId:          primaryVirtualNetwork.ID(),
    			TargetNetworkId:          secondaryVirtualNetwork.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const primaryResourceGroup = new azure.core.ResourceGroup("primaryResourceGroup", {location: "West US"});
    const secondaryResourceGroup = new azure.core.ResourceGroup("secondaryResourceGroup", {location: "East US"});
    const vault = new azure.recoveryservices.Vault("vault", {
        location: secondaryResourceGroup.location,
        resourceGroupName: secondaryResourceGroup.name,
        sku: "Standard",
    });
    const primaryFabric = new azure.siterecovery.Fabric("primaryFabric", {
        resourceGroupName: secondaryResourceGroup.name,
        recoveryVaultName: vault.name,
        location: primaryResourceGroup.location,
    });
    const secondaryFabric = new azure.siterecovery.Fabric("secondaryFabric", {
        resourceGroupName: secondaryResourceGroup.name,
        recoveryVaultName: vault.name,
        location: secondaryResourceGroup.location,
    }, {
        dependsOn: [primaryFabric],
    });
    // Avoids issues with creating fabrics simultaneously
    const primaryVirtualNetwork = new azure.network.VirtualNetwork("primaryVirtualNetwork", {
        resourceGroupName: primaryResourceGroup.name,
        addressSpaces: ["192.168.1.0/24"],
        location: primaryResourceGroup.location,
    });
    const secondaryVirtualNetwork = new azure.network.VirtualNetwork("secondaryVirtualNetwork", {
        resourceGroupName: secondaryResourceGroup.name,
        addressSpaces: ["192.168.2.0/24"],
        location: secondaryResourceGroup.location,
    });
    const recovery_mapping = new azure.siterecovery.NetworkMapping("recovery-mapping", {
        resourceGroupName: secondaryResourceGroup.name,
        recoveryVaultName: vault.name,
        sourceRecoveryFabricName: "primary-fabric",
        targetRecoveryFabricName: "secondary-fabric",
        sourceNetworkId: primaryVirtualNetwork.id,
        targetNetworkId: secondaryVirtualNetwork.id,
    });
    
    import pulumi
    import pulumi_azure as azure
    
    primary_resource_group = azure.core.ResourceGroup("primaryResourceGroup", location="West US")
    secondary_resource_group = azure.core.ResourceGroup("secondaryResourceGroup", location="East US")
    vault = azure.recoveryservices.Vault("vault",
        location=secondary_resource_group.location,
        resource_group_name=secondary_resource_group.name,
        sku="Standard")
    primary_fabric = azure.siterecovery.Fabric("primaryFabric",
        resource_group_name=secondary_resource_group.name,
        recovery_vault_name=vault.name,
        location=primary_resource_group.location)
    secondary_fabric = azure.siterecovery.Fabric("secondaryFabric",
        resource_group_name=secondary_resource_group.name,
        recovery_vault_name=vault.name,
        location=secondary_resource_group.location,
        opts=pulumi.ResourceOptions(depends_on=[primary_fabric]))
    # Avoids issues with creating fabrics simultaneously
    primary_virtual_network = azure.network.VirtualNetwork("primaryVirtualNetwork",
        resource_group_name=primary_resource_group.name,
        address_spaces=["192.168.1.0/24"],
        location=primary_resource_group.location)
    secondary_virtual_network = azure.network.VirtualNetwork("secondaryVirtualNetwork",
        resource_group_name=secondary_resource_group.name,
        address_spaces=["192.168.2.0/24"],
        location=secondary_resource_group.location)
    recovery_mapping = azure.siterecovery.NetworkMapping("recovery-mapping",
        resource_group_name=secondary_resource_group.name,
        recovery_vault_name=vault.name,
        source_recovery_fabric_name="primary-fabric",
        target_recovery_fabric_name="secondary-fabric",
        source_network_id=primary_virtual_network.id,
        target_network_id=secondary_virtual_network.id)
    

    Example coming soon!

    Create NetworkMapping Resource

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

    Constructor syntax

    new NetworkMapping(name: string, args: NetworkMappingArgs, opts?: CustomResourceOptions);
    @overload
    def NetworkMapping(resource_name: str,
                       args: NetworkMappingArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def NetworkMapping(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       recovery_vault_name: Optional[str] = None,
                       resource_group_name: Optional[str] = None,
                       source_network_id: Optional[str] = None,
                       source_recovery_fabric_name: Optional[str] = None,
                       target_network_id: Optional[str] = None,
                       target_recovery_fabric_name: Optional[str] = None,
                       name: Optional[str] = None)
    func NewNetworkMapping(ctx *Context, name string, args NetworkMappingArgs, opts ...ResourceOption) (*NetworkMapping, error)
    public NetworkMapping(string name, NetworkMappingArgs args, CustomResourceOptions? opts = null)
    public NetworkMapping(String name, NetworkMappingArgs args)
    public NetworkMapping(String name, NetworkMappingArgs args, CustomResourceOptions options)
    
    type: azure:siterecovery:NetworkMapping
    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 NetworkMappingArgs
    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 NetworkMappingArgs
    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 NetworkMappingArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NetworkMappingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NetworkMappingArgs
    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 networkMappingResource = new Azure.SiteRecovery.NetworkMapping("networkMappingResource", new()
    {
        RecoveryVaultName = "string",
        ResourceGroupName = "string",
        SourceNetworkId = "string",
        SourceRecoveryFabricName = "string",
        TargetNetworkId = "string",
        TargetRecoveryFabricName = "string",
        Name = "string",
    });
    
    example, err := siterecovery.NewNetworkMapping(ctx, "networkMappingResource", &siterecovery.NetworkMappingArgs{
    	RecoveryVaultName:        pulumi.String("string"),
    	ResourceGroupName:        pulumi.String("string"),
    	SourceNetworkId:          pulumi.String("string"),
    	SourceRecoveryFabricName: pulumi.String("string"),
    	TargetNetworkId:          pulumi.String("string"),
    	TargetRecoveryFabricName: pulumi.String("string"),
    	Name:                     pulumi.String("string"),
    })
    
    var networkMappingResource = new NetworkMapping("networkMappingResource", NetworkMappingArgs.builder()
        .recoveryVaultName("string")
        .resourceGroupName("string")
        .sourceNetworkId("string")
        .sourceRecoveryFabricName("string")
        .targetNetworkId("string")
        .targetRecoveryFabricName("string")
        .name("string")
        .build());
    
    network_mapping_resource = azure.siterecovery.NetworkMapping("networkMappingResource",
        recovery_vault_name="string",
        resource_group_name="string",
        source_network_id="string",
        source_recovery_fabric_name="string",
        target_network_id="string",
        target_recovery_fabric_name="string",
        name="string")
    
    const networkMappingResource = new azure.siterecovery.NetworkMapping("networkMappingResource", {
        recoveryVaultName: "string",
        resourceGroupName: "string",
        sourceNetworkId: "string",
        sourceRecoveryFabricName: "string",
        targetNetworkId: "string",
        targetRecoveryFabricName: "string",
        name: "string",
    });
    
    type: azure:siterecovery:NetworkMapping
    properties:
        name: string
        recoveryVaultName: string
        resourceGroupName: string
        sourceNetworkId: string
        sourceRecoveryFabricName: string
        targetNetworkId: string
        targetRecoveryFabricName: string
    

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

    RecoveryVaultName string
    The name of the vault that should be updated.
    ResourceGroupName string
    Name of the resource group where the vault that should be updated is located.
    SourceNetworkId string
    The id of the primary network.
    SourceRecoveryFabricName string
    Specifies the ASR fabric where mapping should be created.
    TargetNetworkId string
    The id of the recovery network.
    TargetRecoveryFabricName string
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    Name string
    The name of the network mapping.
    RecoveryVaultName string
    The name of the vault that should be updated.
    ResourceGroupName string
    Name of the resource group where the vault that should be updated is located.
    SourceNetworkId string
    The id of the primary network.
    SourceRecoveryFabricName string
    Specifies the ASR fabric where mapping should be created.
    TargetNetworkId string
    The id of the recovery network.
    TargetRecoveryFabricName string
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    Name string
    The name of the network mapping.
    recoveryVaultName String
    The name of the vault that should be updated.
    resourceGroupName String
    Name of the resource group where the vault that should be updated is located.
    sourceNetworkId String
    The id of the primary network.
    sourceRecoveryFabricName String
    Specifies the ASR fabric where mapping should be created.
    targetNetworkId String
    The id of the recovery network.
    targetRecoveryFabricName String
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    name String
    The name of the network mapping.
    recoveryVaultName string
    The name of the vault that should be updated.
    resourceGroupName string
    Name of the resource group where the vault that should be updated is located.
    sourceNetworkId string
    The id of the primary network.
    sourceRecoveryFabricName string
    Specifies the ASR fabric where mapping should be created.
    targetNetworkId string
    The id of the recovery network.
    targetRecoveryFabricName string
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    name string
    The name of the network mapping.
    recovery_vault_name str
    The name of the vault that should be updated.
    resource_group_name str
    Name of the resource group where the vault that should be updated is located.
    source_network_id str
    The id of the primary network.
    source_recovery_fabric_name str
    Specifies the ASR fabric where mapping should be created.
    target_network_id str
    The id of the recovery network.
    target_recovery_fabric_name str
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    name str
    The name of the network mapping.
    recoveryVaultName String
    The name of the vault that should be updated.
    resourceGroupName String
    Name of the resource group where the vault that should be updated is located.
    sourceNetworkId String
    The id of the primary network.
    sourceRecoveryFabricName String
    Specifies the ASR fabric where mapping should be created.
    targetNetworkId String
    The id of the recovery network.
    targetRecoveryFabricName String
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    name String
    The name of the network mapping.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the NetworkMapping 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 NetworkMapping Resource

    Get an existing NetworkMapping 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?: NetworkMappingState, opts?: CustomResourceOptions): NetworkMapping
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            recovery_vault_name: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            source_network_id: Optional[str] = None,
            source_recovery_fabric_name: Optional[str] = None,
            target_network_id: Optional[str] = None,
            target_recovery_fabric_name: Optional[str] = None) -> NetworkMapping
    func GetNetworkMapping(ctx *Context, name string, id IDInput, state *NetworkMappingState, opts ...ResourceOption) (*NetworkMapping, error)
    public static NetworkMapping Get(string name, Input<string> id, NetworkMappingState? state, CustomResourceOptions? opts = null)
    public static NetworkMapping get(String name, Output<String> id, NetworkMappingState state, CustomResourceOptions options)
    resources:  _:    type: azure:siterecovery:NetworkMapping    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.
    The following state arguments are supported:
    Name string
    The name of the network mapping.
    RecoveryVaultName string
    The name of the vault that should be updated.
    ResourceGroupName string
    Name of the resource group where the vault that should be updated is located.
    SourceNetworkId string
    The id of the primary network.
    SourceRecoveryFabricName string
    Specifies the ASR fabric where mapping should be created.
    TargetNetworkId string
    The id of the recovery network.
    TargetRecoveryFabricName string
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    Name string
    The name of the network mapping.
    RecoveryVaultName string
    The name of the vault that should be updated.
    ResourceGroupName string
    Name of the resource group where the vault that should be updated is located.
    SourceNetworkId string
    The id of the primary network.
    SourceRecoveryFabricName string
    Specifies the ASR fabric where mapping should be created.
    TargetNetworkId string
    The id of the recovery network.
    TargetRecoveryFabricName string
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    name String
    The name of the network mapping.
    recoveryVaultName String
    The name of the vault that should be updated.
    resourceGroupName String
    Name of the resource group where the vault that should be updated is located.
    sourceNetworkId String
    The id of the primary network.
    sourceRecoveryFabricName String
    Specifies the ASR fabric where mapping should be created.
    targetNetworkId String
    The id of the recovery network.
    targetRecoveryFabricName String
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    name string
    The name of the network mapping.
    recoveryVaultName string
    The name of the vault that should be updated.
    resourceGroupName string
    Name of the resource group where the vault that should be updated is located.
    sourceNetworkId string
    The id of the primary network.
    sourceRecoveryFabricName string
    Specifies the ASR fabric where mapping should be created.
    targetNetworkId string
    The id of the recovery network.
    targetRecoveryFabricName string
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    name str
    The name of the network mapping.
    recovery_vault_name str
    The name of the vault that should be updated.
    resource_group_name str
    Name of the resource group where the vault that should be updated is located.
    source_network_id str
    The id of the primary network.
    source_recovery_fabric_name str
    Specifies the ASR fabric where mapping should be created.
    target_network_id str
    The id of the recovery network.
    target_recovery_fabric_name str
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.
    name String
    The name of the network mapping.
    recoveryVaultName String
    The name of the vault that should be updated.
    resourceGroupName String
    Name of the resource group where the vault that should be updated is located.
    sourceNetworkId String
    The id of the primary network.
    sourceRecoveryFabricName String
    Specifies the ASR fabric where mapping should be created.
    targetNetworkId String
    The id of the recovery network.
    targetRecoveryFabricName String
    The Azure Site Recovery fabric object corresponding to the recovery Azure region.

    Import

    Site Recovery Network Mapping can be imported using the resource id, e.g.

     $ pulumi import azure:siterecovery/networkMapping:NetworkMapping mymapping /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationFabrics/primary-fabric-name/replicationNetworks/azureNetwork/replicationNetworkMappings/mapping-name
    

    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.
    azure logo

    We recommend using Azure Native.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.