New-AzureSiteRecoveryNetworkMapping

Creates a mapping between virtual networks.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Service Management APIs. See the Az PowerShell module for cmdlets to manage Azure Resource Manager resources.

Syntax

New-AzureSiteRecoveryNetworkMapping
   -PrimaryNetwork <ASRNetwork>
   -RecoveryNetwork <ASRNetwork>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]
New-AzureSiteRecoveryNetworkMapping
   -PrimaryNetwork <ASRNetwork>
   -AzureSubscriptionId <String>
   -AzureVMNetworkId <String>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

The New-AzureSiteRecoveryNetworkMapping cmdlet creates a mapping between two virtual networks and returns an Azure Site Recovery job to track it.

Examples

Example 1: Create a mapping between a network and a recovery network

PS C:\> $Servers = Get-AzureSiteRecoveryServer
PS C:\> $Networks = Get-AzureSiteRecoveryNetwork -Server $Servers[0]
PS C:\> New-AzureSiteRecoveryNetworkMapping -PrimaryNetwork $Networks[0] -RecoveryNetwork $Networks[1]

The first command cmdlet gets servers for the current Azure Site Recovery vault by using the Get-AzureSiteRecoveryServer cmdlet. The command stores the Site Recovery servers in the $Servers array variable.

The second command gets the site recovery network for the first server in the $Servers array by using the Get-AzureSiteRecoveryNetwork cmdlet. The command stores the networks in the $Networks variable.

The final command creates a mapping between the primary network and the recovery network. The command specifies the primary network as the first element of $Networks. The command specifies the recovery network as the second element of $Networks.

Parameters

-AzureSubscriptionId

Specifies the ID of your Azure subscription.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-AzureVMNetworkId

Specifies the Azure virtual network ID.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PrimaryNetwork

Specifies the primary network object.

Type:ASRNetwork
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RecoveryNetwork

Specifies the recovery network object.

Type:ASRNetwork
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False