diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1 b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1 index cfe5110f4e10..782d75a8c85b 100644 --- a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1 +++ b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1 @@ -664,8 +664,12 @@ function Test-VMNicConfig { #Update VM Nic properties $pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName $nicId = $pe.NicDetailsList[0].NicId + $ipConfigName = $pe.NicDetailsList[0].IpConfigs[0].Name $recNicName = getRecoveryNicName - $nicConfig = New-AzRecoveryServicesAsrVMNicConfig -NicId $nicId -ReplicationProtectedItem $pe -RecoveryNicName $recNicName -RecoveryNicResourceGroupName $recRgName -ReuseExistingNic + + $ipConfig = New-AzRecoveryServicesAsrVMNicIPConfig -IpConfigName $ipConfigName -RecoverySubnetName "" + $ipConfigs = @($ipConfig) + $nicConfig = New-AzRecoveryServicesAsrVMNicConfig -NicId $nicId -ReplicationProtectedItem $pe -RecoveryVMNetworkId $RecoveryAzureNetworkId -RecoveryNicName $recNicName -RecoveryNicResourceGroupName $recRgName -ReuseExistingNic -IPConfig $ipConfigs $updateDRjob = Set-AzRecoveryServicesAsrReplicationProtectedItem -InputObject $pe -ASRVMNicConfiguration $nicConfig WaitForJobCompletion -JobId $updateDRjob.Name diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery/Models/PSObjects.cs b/src/RecoveryServices/RecoveryServices.SiteRecovery/Models/PSObjects.cs index 89896e3f7325..158b194f395e 100644 --- a/src/RecoveryServices/RecoveryServices.SiteRecovery/Models/PSObjects.cs +++ b/src/RecoveryServices/RecoveryServices.SiteRecovery/Models/PSObjects.cs @@ -2348,7 +2348,7 @@ public class ASRVMNicConfig /// Gets or sets the IP configuration details for the recovery NIC. /// [DataMember] - public List IPConfigs { get; set; } + public List IPConfigs { get; set; } /// /// Gets or sets whether the recovery NIC has accelerated networking enabled. @@ -2393,6 +2393,81 @@ public class ASRVMNicConfig public bool EnableAcceleratedNetworkingOnTfo { get; set; } } + /// + /// IP config details of a NIC. + /// + [DataContract(Namespace = "http://schemas.microsoft.com/windowsazure")] + public class PSIPConfigInputDetails + { + /// + /// Gets or sets name of the IP config. + /// + [DataMember] + public string IPConfigName { get; set; } + + /// + /// Gets or sets the value indicating if IP config is primary.. + /// + [DataMember] + public bool IsPrimary { get; set; } + + /// + /// Gets or sets the value indicating if IP config is selected for failover.. + /// + [DataMember] + public bool IsSeletedForFailover { get; set; } + + /// + /// Gets or sets recovery subnet name. + /// + [DataMember] + public string RecoverySubnetName { get; set; } + + /// + /// Gets or sets recovery static IP address. + /// + [DataMember] + public string RecoveryStaticIPAddress { get; set; } + + /// + /// Gets or sets the id of the recovery public IP address resource associated + /// with the IP config. + /// + [DataMember] + public string RecoveryPublicIPAddressId { get; set; } + + /// + /// Gets or sets the recovery backend address pools for the IP config. + /// + [DataMember] + public IList RecoveryLBBackendAddressPoolIds { get; set; } + + /// + /// Gets or sets the subnet to be used by IP config during test failover. + /// + [DataMember] + public string TfoSubnetName { get; set; } + + /// + /// Gets or sets tfo static IP address. + /// + [DataMember] + public string TfoStaticIPAddress { get; set; } + + /// + /// Gets or sets the id of the public IP address resource associated with the + /// tfo IP config. + /// + [DataMember] + public string TfoPublicIPAddressId { get; set; } + + /// + /// Gets or sets the tfo backend address pools for the IP config. + /// + [DataMember] + public IList TfoLBBackendAddressPoolIds { get; set; } + } + /// /// CS Accounts Details. /// diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery/NetworkInterfaceCard/NewAzureRmAsrVmNicConfig.cs b/src/RecoveryServices/RecoveryServices.SiteRecovery/NetworkInterfaceCard/NewAzureRmAsrVmNicConfig.cs index af6ae8817885..011c67485ca5 100644 --- a/src/RecoveryServices/RecoveryServices.SiteRecovery/NetworkInterfaceCard/NewAzureRmAsrVmNicConfig.cs +++ b/src/RecoveryServices/RecoveryServices.SiteRecovery/NetworkInterfaceCard/NewAzureRmAsrVmNicConfig.cs @@ -162,7 +162,7 @@ public class NewAzureRmAsrVmNicConfig : SiteRecoveryCmdletBase Mandatory = false, HelpMessage = "Specifies test failover/failover settings of NIC IP configs.")] [ValidateNotNull] - public IPConfigInputDetails[] IPConfig { get; set; } + public PSIPConfigInputDetails[] IPConfig { get; set; } #endregion Parameters @@ -253,6 +253,29 @@ public override void ExecuteSiteRecoveryCmdlet() vmNic.EnableAcceleratedNetworkingOnTfo ?? false; } + List ipConfigList = null; + if (this.IPConfig == null || this.IPConfig.ToList().Count == 0) + { + ipConfigList = vmNic.IpConfigs?.Select(ip => ConvertToPSIPConfig(ip))?.ToList() ?? null; + } + else if (vmNic.IpConfigs != null) + { + ipConfigList = this.IPConfig.ToList(); + // NIC IP config names in lowercase. + var inputIPConfigNames = this.IPConfig.Select(ip => ip.IPConfigName.ToLower()); + + foreach (IPConfigDetails ipConfig in vmNic.IpConfigs) + { + if (inputIPConfigNames.Contains(ipConfig.Name.ToLower())) + { + continue; + } + + // Defaulting logic for IP configs whose input is not + ipConfigList.Add(ConvertToPSIPConfig(ipConfig)); + } + } + nicConfig = new ASRVMNicConfig { NicId = this.NicId, @@ -263,7 +286,7 @@ public override void ExecuteSiteRecoveryCmdlet() RecoveryNetworkSecurityGroupId = this.RecoveryNetworkSecurityGroupId, EnableAcceleratedNetworkingOnRecovery = this.EnableAcceleratedNetworkingOnRecovery, - IPConfigs = this.IPConfig?.ToList(), + IPConfigs = ipConfigList, TfoVMNetworkId = this.TfoVMNetworkId, TfoNicName = this.TfoNicName, TfoNicResourceGroupName = this.TfoNicResourceGroupName, @@ -297,17 +320,19 @@ private bool ValidateAndPopulateIPConfigs(ASRVMNicDetails vmNic) isRecoveryNetworkRequired = true; } - var vmNicIPConfig = vmNic.IpConfigs.FirstOrDefault( + IPConfigDetails vmNicIPConfig = vmNic.IpConfigs.FirstOrDefault( ip => ip.Name.Equals( - ipConfig.IpConfigName, StringComparison.OrdinalIgnoreCase)); + ipConfig.IPConfigName, StringComparison.OrdinalIgnoreCase)); if (vmNicIPConfig == null) { - this.WriteWarning(string.Format(Resources.IPConfigNotFoundInVMNic, ipConfig.IpConfigName, vmNic.NicId)); + this.WriteWarning( + string.Format(Resources.IPConfigNotFoundInVMNic, + ipConfig.IPConfigName, vmNic.NicId)); return false; } - ipConfig.IsPrimary = vmNicIPConfig.IsPrimary; + ipConfig.IsPrimary = (bool)vmNicIPConfig.IsPrimary; if (string.IsNullOrEmpty(ipConfig.RecoverySubnetName)) { ipConfig.RecoverySubnetName = vmNicIPConfig.RecoverySubnetName; @@ -363,5 +388,23 @@ private bool ValidateAndPopulateIPConfigs(ASRVMNicDetails vmNic) return true; } + + PSIPConfigInputDetails ConvertToPSIPConfig(IPConfigDetails ipConfig) + { + return new PSIPConfigInputDetails() + { + IPConfigName = ipConfig.Name, + IsPrimary = (bool)ipConfig.IsPrimary, + IsSeletedForFailover = (bool)ipConfig.IsSeletedForFailover, + RecoverySubnetName = ipConfig.RecoverySubnetName, + RecoveryStaticIPAddress = ipConfig.RecoveryStaticIPAddress, + RecoveryPublicIPAddressId = ipConfig.RecoveryPublicIPAddressId, + RecoveryLBBackendAddressPoolIds = ipConfig.RecoveryLBBackendAddressPoolIds, + TfoSubnetName = ipConfig.TfoSubnetName, + TfoStaticIPAddress = ipConfig.TfoStaticIPAddress, + TfoPublicIPAddressId = ipConfig.TfoPublicIPAddressId, + TfoLBBackendAddressPoolIds = ipConfig.TfoLBBackendAddressPoolIds + }; + } } } diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery/NetworkInterfaceCard/NewAzureRmAsrVmNicIPConfig.cs b/src/RecoveryServices/RecoveryServices.SiteRecovery/NetworkInterfaceCard/NewAzureRmAsrVmNicIPConfig.cs index d651c806b69c..7982b6fab9c7 100644 --- a/src/RecoveryServices/RecoveryServices.SiteRecovery/NetworkInterfaceCard/NewAzureRmAsrVmNicIPConfig.cs +++ b/src/RecoveryServices/RecoveryServices.SiteRecovery/NetworkInterfaceCard/NewAzureRmAsrVmNicIPConfig.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.SiteRecovery /// [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "RecoveryServicesAsrVMNicIPConfig", DefaultParameterSetName = ASRParameterSets.AzureToAzure, SupportsShouldProcess = true)] [Alias("New-ASRVMNicIPConfig")] - [OutputType(typeof(IPConfigInputDetails))] + [OutputType(typeof(PSIPConfigInputDetails))] public class NewAzureRmAsrVmNicIPConfig : SiteRecoveryCmdletBase { #region Parameters @@ -126,7 +126,7 @@ public class NewAzureRmAsrVmNicIPConfig : SiteRecoveryCmdletBase public override void ExecuteSiteRecoveryCmdlet() { base.ExecuteSiteRecoveryCmdlet(); - IPConfigInputDetails ipConfig = null; + PSIPConfigInputDetails ipConfig = null; if (string.IsNullOrEmpty(this.RecoverySubnetName) && !string.IsNullOrEmpty(this.RecoveryStaticIPAddress)) @@ -146,9 +146,9 @@ public override void ExecuteSiteRecoveryCmdlet() { case ASRParameterSets.AzureToAzure: - ipConfig = new IPConfigInputDetails + ipConfig = new PSIPConfigInputDetails { - IpConfigName = this.IpConfigName, + IPConfigName = this.IpConfigName, IsSeletedForFailover = this.IsSelectedForFailover, RecoverySubnetName = this.RecoverySubnetName, RecoveryStaticIPAddress = this.RecoveryStaticIPAddress, diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/SetAzureRmRecoveryServicesAsrReplicationProtectedItem.cs b/src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/SetAzureRmRecoveryServicesAsrReplicationProtectedItem.cs index 89ec43ab73dd..3e626333bc85 100644 --- a/src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/SetAzureRmRecoveryServicesAsrReplicationProtectedItem.cs +++ b/src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/SetAzureRmRecoveryServicesAsrReplicationProtectedItem.cs @@ -869,7 +869,21 @@ private List getNicListToUpdate(IList vmNicList nic.EnableAcceleratedNetworkingOnRecovery; vMNicInputDetails.RecoveryNetworkSecurityGroupId = nic.RecoveryNetworkSecurityGroupId; - vMNicInputDetails.IpConfigs = nic.IPConfigs; + vMNicInputDetails.IpConfigs = nic.IPConfigs?.Select(ip => + new IPConfigInputDetails() + { + IpConfigName = ip.IPConfigName, + IsPrimary = ip.IsPrimary, + IsSeletedForFailover = ip.IsSeletedForFailover, + RecoverySubnetName = ip.RecoverySubnetName, + RecoveryStaticIPAddress = ip.RecoveryStaticIPAddress, + RecoveryPublicIPAddressId = ip.RecoveryPublicIPAddressId, + RecoveryLBBackendAddressPoolIds = ip.RecoveryLBBackendAddressPoolIds, + TfoSubnetName = ip.TfoSubnetName, + TfoStaticIPAddress = ip.TfoStaticIPAddress, + TfoPublicIPAddressId = ip.TfoPublicIPAddressId, + TfoLBBackendAddressPoolIds = ip.TfoLBBackendAddressPoolIds + }).ToList() ?? null; vMNicInputDetails.TfoNicName = nic.TfoNicName; vMNicInputDetails.TfoNicResourceGroupName = nic.TfoNicResourceGroupName; vMNicInputDetails.TfoReuseExistingNic = nic.TfoReuseExistingNic; @@ -895,8 +909,13 @@ private List getNicListToUpdate(IList vmNicList && string.Compare(nDetails.NicId, this.UpdateNic, StringComparison.OrdinalIgnoreCase) == 0) { vMNicInputDetails.NicId = this.UpdateNic; + + var dbIpConfig = nDetails.IpConfigs?[0]; var ipConfig = new IPConfigInputDetails() { + IpConfigName = dbIpConfig?.Name, + IsPrimary = dbIpConfig?.IsPrimary ?? true, + IsSeletedForFailover = true, RecoverySubnetName = this.RecoveryNicSubnetName, RecoveryStaticIPAddress = this.RecoveryNicStaticIPAddress, RecoveryPublicIPAddressId = this.RecoveryPublicIPAddressId, diff --git a/src/RecoveryServices/RecoveryServices/Az.RecoveryServices.psd1 b/src/RecoveryServices/RecoveryServices/Az.RecoveryServices.psd1 index 6c9a2fa0ab8b..5f73c794cb83 100644 --- a/src/RecoveryServices/RecoveryServices/Az.RecoveryServices.psd1 +++ b/src/RecoveryServices/RecoveryServices/Az.RecoveryServices.psd1 @@ -122,7 +122,8 @@ CmdletsToExport = 'Get-AzRecoveryServicesBackupProperty', 'New-AzRecoveryServicesAsrStorageClassificationMapping', 'New-AzRecoveryServicesAsrvCenter', 'New-AzRecoveryServicesAsrAzureToAzureDiskReplicationConfig', - 'New-AzRecoveryServicesAsrVMNicConfig', + 'New-AzRecoveryServicesAsrVMNicConfig', + 'New-AzRecoveryServicesAsrVMNicIPConfig', 'Remove-AzRecoveryServicesAsrFabric', 'Remove-AzRecoveryServicesAsrNetworkMapping', 'Remove-AzRecoveryServicesAsrPolicy', diff --git a/src/RecoveryServices/RecoveryServices/help/New-AzRecoveryServicesAsrVMNicConfig.md b/src/RecoveryServices/RecoveryServices/help/New-AzRecoveryServicesAsrVMNicConfig.md index edfd93462a60..45d614fb4401 100644 --- a/src/RecoveryServices/RecoveryServices/help/New-AzRecoveryServicesAsrVMNicConfig.md +++ b/src/RecoveryServices/RecoveryServices/help/New-AzRecoveryServicesAsrVMNicConfig.md @@ -1,7 +1,7 @@ --- external help file: Microsoft.Azure.PowerShell.Cmdlets.RecoveryServices.SiteRecovery.dll-Help.xml Module Name: Az.RecoveryServices -online version: https://docs.microsoft.com/powershell/module/az.recoveryservices/new-azrecoveryservicesasrvmnicconfig +online version: schema: 2.0.0 --- @@ -15,13 +15,11 @@ Creates an ASR NIC config that contains the failover and test failover related c ``` New-AzRecoveryServicesAsrVMNicConfig -NicId -ReplicationProtectedItem [-RecoveryVMNetworkId ] [-RecoveryNicName ] [-RecoveryNicResourceGroupName ] - [-ReuseExistingNic] [-RecoveryVMSubnetName ] [-RecoveryNetworkSecurityGroupId ] - [-EnableAcceleratedNetworkingOnRecovery] [-RecoveryNicStaticIPAddress ] - [-RecoveryPublicIPAddressId ] [-RecoveryLBBackendAddressPoolId ] [-TfoVMNetworkId ] - [-TfoNicName ] [-TfoNicResourceGroupName ] [-TfoReuseExistingNic] [-TfoVMSubnetName ] - [-TfoNetworkSecurityGroupId ] [-EnableAcceleratedNetworkingOnTfo] [-TfoNicStaticIPAddress ] - [-TfoPublicIPAddressId ] [-TfoLBBackendAddressPoolId ] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] + [-ReuseExistingNic] [-RecoveryNetworkSecurityGroupId ] [-EnableAcceleratedNetworkingOnRecovery] + [-TfoVMNetworkId ] [-TfoNicName ] [-TfoNicResourceGroupName ] [-TfoReuseExistingNic] + [-TfoNetworkSecurityGroupId ] [-EnableAcceleratedNetworkingOnTfo] + [-IPConfig ] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -31,8 +29,13 @@ The **New-AzRecoveryServicesAsrVMNicConfig** cmdlet creates an ASR NIC config ob ### Example 1 ```powershell -PS C:\> $nicConfig = New-AzRecoveryServicesAsrVMNicConfig -NicId $AsrNicGuid -ReplicationProtectedItem $Rpi -RecoveryVMNetworkId $recoveryNetworkId -RecoveryVMSubnetName $recoverySubnetName -RecoveryNicStaticIPAddress "10.0.0.1" ` - -TfoVMNetworkId $tfoNetworkId -TfoVMSubnetName $tfoSubnetName -TfoNicStaticIPAddress "10.0.1.1" +PS C:\> $ipConfig1 = New-AzRecoveryServicesAsrVMNicIPConfig -IpConfigName "ipconfig1" -RecoverySubnetName "default" ` +-TfoSubnetName "default" -RecoveryStaticIPAddress "10.1.40.10" -TfoStaticIPAddress "10.3.4.33" +PS C:\> $ipConfig2 = New-AzRecoveryServicesAsrVMNicIPConfig -IpConfigName "ipconfig2" -IsSelectedForFailover -RecoverySubnetName "default" ` +-TfoSubnetName "default" -RecoveryStaticIPAddress "10.1.40.13" -TfoStaticIPAddress "10.3.4.32" +PS C:\> $ipConfigs = @($ipConfig1, $ipConfig2) +PS C:\> $nicConfig = New-AzRecoveryServicesAsrVMNicConfig -NicId $AsrNicGuid -ReplicationProtectedItem $Rpi -RecoveryVMNetworkId $recoveryNetworkId ` + -TfoVMNetworkId $tfoNetworkId -IPConfig $ipConfigs ``` Creates an ASRVmNicConfig object with the failover and test faiover networking settings configured for the NIC. Any property that's not passed above is fetched from the protected item passed. @@ -44,16 +47,6 @@ PS C:\> $nicConfig = New-AzRecoveryServicesAsrVMNicConfig -NicId $AsrNicGuid -Re Creates an ASRVmNicConfig object with the test faiover networking settings configured for the NIC renaming. Any property that's not passed above is fetched from the protected item passed. - -### Example 3 - -Creates an ASR NIC config that contains the failover and test failover related configuration details. (autogenerated) - -```powershell - -New-AzRecoveryServicesAsrVMNicConfig -NicId $AsrNicGuid -RecoveryNetworkSecurityGroupId -RecoveryNicStaticIPAddress '10.0.0.1' -RecoveryVMNetworkId $recoveryNetworkId -RecoveryVMSubnetName $recoverySubnetName -ReplicationProtectedItem $Rpi -TfoNetworkSecurityGroupId -TfoNicStaticIPAddress -TfoVMNetworkId -TfoVMSubnetName -``` - ## PARAMETERS ### -DefaultProfile @@ -101,30 +94,30 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -NicId -Specify the ASR NIC GUID. +### -IPConfig +Specifies test failover/failover settings of NIC IP configs. ```yaml -Type: System.String +Type: Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.PSIPConfigInputDetails[] Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -RecoveryLBBackendAddressPoolId -Specifies the IDs of backend address pools for the recovery NIC. +### -NicId +Specify the ASR NIC GUID. ```yaml -Type: System.String[] +Type: System.String Parameter Sets: (All) Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -176,36 +169,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -RecoveryNicStaticIPAddress -Specifies the IP address of the recovery NIC. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -RecoveryPublicIPAddressId -Specifies the ID of the public IP address associated with recovery NIC. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -RecoveryVMNetworkId Specifies the ID of the recovery virtual network. @@ -221,21 +184,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -RecoveryVMSubnetName -Specifies the name of the recovery subnet. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ReplicationProtectedItem Specify the ASR Replication Protected Item. @@ -266,21 +214,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -TfoLBBackendAddressPoolId -Specifies the IDs of backend address pools for the recovery NIC. - -```yaml -Type: System.String[] -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -TfoNetworkSecurityGroupId Specifies the ID of the NSG associated with test failover NIC. @@ -326,36 +259,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -TfoNicStaticIPAddress -Specifies the IP address of the test failover NIC. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -TfoPublicIPAddressId -Specifies the ID of the public IP address associated with test failover NIC. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -TfoReuseExistingNic Specifies whether an existing NIC can be used during test failover. @@ -386,21 +289,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -TfoVMSubnetName -Specifies the name of the test failover subnet. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Confirm Prompts you for confirmation before running the cmdlet. @@ -417,7 +305,8 @@ Accept wildcard characters: False ``` ### -WhatIf -Shows what would happen if the cmdlet runs. The cmdlet is not run. +Shows what would happen if the cmdlet runs. +The cmdlet is not run. ```yaml Type: System.Management.Automation.SwitchParameter diff --git a/src/RecoveryServices/RecoveryServices/help/New-AzRecoveryServicesAsrVMNicIPConfig.md b/src/RecoveryServices/RecoveryServices/help/New-AzRecoveryServicesAsrVMNicIPConfig.md new file mode 100644 index 000000000000..8934f1a53633 --- /dev/null +++ b/src/RecoveryServices/RecoveryServices/help/New-AzRecoveryServicesAsrVMNicIPConfig.md @@ -0,0 +1,247 @@ +--- +external help file: Microsoft.Azure.PowerShell.Cmdlets.RecoveryServices.SiteRecovery.dll-Help.xml +Module Name: Az.RecoveryServices +online version: +schema: 2.0.0 +--- + +# New-AzRecoveryServicesAsrVMNicIPConfig + +## SYNOPSIS +Creates an ASR NIC IP config that contains the failover and test failover configuration details for each IP Config (Primary and Secondary) of the NIC. + +## SYNTAX + +``` +New-AzRecoveryServicesAsrVMNicIPConfig -IpConfigName [-IsSelectedForFailover] + [-RecoverySubnetName ] [-RecoveryStaticIPAddress ] [-RecoveryPublicIPAddressId ] + [-RecoveryLBBackendAddressPoolId ] [-TfoSubnetName ] [-TfoStaticIPAddress ] + [-TfoPublicIPAddressId ] [-TfoLBBackendAddressPoolId ] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The **New-AzRecoveryServicesAsrVMNicIPConfig** cmdlet creates an IP Config object that contains the failover and test failover details for each IP Config (Primary and Secondary) of the NIC. This further should be passed as a parameter to ** New-AzRecoveryServicesAsrVMNicConfig** for setting these values in the ASR NIC Config Object. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> $ipConfig = New-AzRecoveryServicesAsrVMNicIPConfig -IpConfigName "ipconfig1" -RecoverySubnetName "default" ` +-TfoSubnetName "default" -RecoveryStaticIPAddress "10.1.40.10" -TfoStaticIPAddress "10.3.4.33" +``` + +Creates an PSIPConfigInputDetails object with the failover and test failover networking settings configured for IP config of a NIC . + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer +Parameter Sets: (All) +Aliases: AzContext, AzureRmContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpConfigName +Specify the IP config name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsSelectedForFailover +Specifies whether an existing IP config is selected for test failover/failover. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryLBBackendAddressPoolId +Specifies the IDs of backend address pools for the recovery IP config. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPublicIPAddressId +Specifies the ID of the public IP address associated with the recovery IP config. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryStaticIPAddress +Specifies the IP address of the recovery IP config. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoverySubnetName +Specifies the name of the recovery subnet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TfoLBBackendAddressPoolId +Specifies the IDs of backend address pools for the test failover IP config. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TfoPublicIPAddressId +Specifies the ID of the public IP address associated with the test failover IP config. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TfoStaticIPAddress +Specifies the IP address of the test failover IP config. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TfoSubnetName +Specifies the name of the test failover subnet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.PSIPConfigInputDetails + +## NOTES + +## RELATED LINKS