diff --git a/src/RecoveryServices/RecoveryServices.Backup.Helpers/RecoveryServices.Backup.Helpers.csproj b/src/RecoveryServices/RecoveryServices.Backup.Helpers/RecoveryServices.Backup.Helpers.csproj index 5d90d8ee8ec5..919fabcc771e 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Helpers/RecoveryServices.Backup.Helpers.csproj +++ b/src/RecoveryServices/RecoveryServices.Backup.Helpers/RecoveryServices.Backup.Helpers.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.Backup.Models/AzureVmWorkloadModels/AzureWorkloadRecoveryConfig.cs b/src/RecoveryServices/RecoveryServices.Backup.Models/AzureVmWorkloadModels/AzureWorkloadRecoveryConfig.cs index 7e896acd84e7..c0122b659475 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Models/AzureVmWorkloadModels/AzureWorkloadRecoveryConfig.cs +++ b/src/RecoveryServices/RecoveryServices.Backup.Models/AzureVmWorkloadModels/AzureWorkloadRecoveryConfig.cs @@ -38,6 +38,11 @@ public class AzureWorkloadRecoveryConfig : RecoveryConfigBase /// public string RestoredDBName { get; set; } + /// + /// Target Virtual Machine Id in case of Alternate Location Restore + /// + public string TargetVirtualMachineId { get; set; } + /// /// OverwriteWLIfpresent /// @@ -66,7 +71,7 @@ public AzureWorkloadRecoveryConfig(string targetServer, string targetInstance, s : base(restoreRequestType, recoveryPoint, pointInTime) { TargetServer = targetServer; - TargetInstance = targetInstance; + TargetInstance = targetInstance; } } } \ No newline at end of file diff --git a/src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.Designer.cs b/src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.Designer.cs index 98f03c006a30..9342543fc034 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.Designer.cs +++ b/src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.Designer.cs @@ -1895,5 +1895,16 @@ public static string ZonalRestoreVaultStorageRedundancyException return ResourceManager.GetString("ZonalRestoreVaultStorageRedundancyException", resourceCulture); } } + + /// + /// Looks up a localized string similar to WorkloadRecoveryConfig TargetVirtualMachineId cannot be null for Alternate location restore. + /// + public static string TargetVirtualMachineIdRequiredException + { + get + { + return ResourceManager.GetString("TargetVirtualMachineIdRequiredException", resourceCulture); + } + } } } diff --git a/src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.resx b/src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.resx index 24464c91f7c4..a72e6bc047a9 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.resx +++ b/src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.resx @@ -625,4 +625,7 @@ Please contact Microsoft for further assistance. Please check whether the vault storageRedundancy is ZRS or RA-GRS or remove TargetZone + + WorkloadRecoveryConfig TargetVirtualMachineId cannot be null for Alternate location restore + \ No newline at end of file diff --git a/src/RecoveryServices/RecoveryServices.Backup.Models/RecoveryServices.Backup.Models.csproj b/src/RecoveryServices/RecoveryServices.Backup.Models/RecoveryServices.Backup.Models.csproj index 70e32c9e21f7..d9588132187b 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Models/RecoveryServices.Backup.Models.csproj +++ b/src/RecoveryServices/RecoveryServices.Backup.Models/RecoveryServices.Backup.Models.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.Backup.Providers/AzureWorkloadProviderHelper.cs b/src/RecoveryServices/RecoveryServices.Backup.Providers/AzureWorkloadProviderHelper.cs index 5cd588bfd656..ca0756b8645a 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Providers/AzureWorkloadProviderHelper.cs +++ b/src/RecoveryServices/RecoveryServices.Backup.Providers/AzureWorkloadProviderHelper.cs @@ -440,6 +440,7 @@ public List ListLogChains(Dictionary ProviderData DateTime startDate = (DateTime)(ProviderData[RecoveryPointParams.StartDate]); DateTime endDate = (DateTime)(ProviderData[RecoveryPointParams.EndDate]); string restorePointQueryType = (string)ProviderData[RecoveryPointParams.RestorePointQueryType]; + bool secondaryRegion = (bool)ProviderData[CRRParams.UseSecondaryRegion]; ItemBase item = ProviderData[RecoveryPointParams.Item] as ItemBase; @@ -465,12 +466,26 @@ public List ListLogChains(Dictionary ProviderData ODataQuery queryFilter = new ODataQuery(); queryFilter.Filter = queryFilterString; - List rpListResponse = ServiceClientAdapter.GetRecoveryPoints( + List rpListResponse; + if (secondaryRegion) + { + //fetch recovery points Log Chain from secondary region + rpListResponse = ServiceClientAdapter.GetRecoveryPointsFromSecondaryRegion( + containerUri, + protectedItemName, + queryFilter, + vaultName: vaultName, + resourceGroupName: resourceGroupName); + } + else + { + rpListResponse = ServiceClientAdapter.GetRecoveryPoints( containerUri, protectedItemName, queryFilter, vaultName: vaultName, resourceGroupName: resourceGroupName); + } List timeRanges = new List(); foreach (RecoveryPointResource rp in rpListResponse) diff --git a/src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs b/src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs index 7b8def6adf29..a16df5731145 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs +++ b/src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs @@ -104,7 +104,7 @@ public RestAzureNS.AzureOperationResponse DisableProtectionWithDeleteData() } public RestAzureNS.AzureOperationResponse UndeleteProtection() - { + { string vaultName = (string)ProviderData[VaultParams.VaultName]; string resourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName]; AzureWorkloadSQLDatabaseProtectedItem item = (AzureWorkloadSQLDatabaseProtectedItem)ProviderData[ItemParams.Item]; @@ -431,6 +431,15 @@ public RestAzureNS.AzureOperationResponse TriggerRestore() ContainerId = wLRecoveryConfig.ContainerId }; azureWorkloadSQLRestoreRequest.AlternateDirectoryPaths = wLRecoveryConfig.targetPhysicalPath; + + if (wLRecoveryConfig.TargetVirtualMachineId != null && wLRecoveryConfig.TargetVirtualMachineId != "") + { + azureWorkloadSQLRestoreRequest.TargetVirtualMachineId = wLRecoveryConfig.TargetVirtualMachineId; + } + else + { + throw new ArgumentException(Resources.TargetVirtualMachineIdRequiredException); + } } if (wLRecoveryConfig.RecoveryMode == "FileRecovery") { @@ -468,6 +477,15 @@ public RestAzureNS.AzureOperationResponse TriggerRestore() ContainerId = wLRecoveryConfig.ContainerId }; azureWorkloadSQLPointInTimeRestoreRequest.AlternateDirectoryPaths = wLRecoveryConfig.targetPhysicalPath; + + if (wLRecoveryConfig.TargetVirtualMachineId != null && wLRecoveryConfig.TargetVirtualMachineId != "") + { + azureWorkloadSQLPointInTimeRestoreRequest.TargetVirtualMachineId = wLRecoveryConfig.TargetVirtualMachineId; + } + else + { + throw new ArgumentException(Resources.TargetVirtualMachineIdRequiredException); + } } if (wLRecoveryConfig.RecoveryMode == "FileRecovery") @@ -491,7 +509,7 @@ public RestAzureNS.AzureOperationResponse TriggerRestore() AzureRecoveryPoint rp = (AzureRecoveryPoint)wLRecoveryConfig.RecoveryPoint; // get access token - CrrAccessToken accessToken = ServiceClientAdapter.GetCRRAccessToken(rp, secondaryRegion, vaultName: vaultName, resourceGroupName: resourceGroupName); + CrrAccessToken accessToken = ServiceClientAdapter.GetCRRAccessToken(rp, secondaryRegion, vaultName: vaultName, resourceGroupName: resourceGroupName, ServiceClientModel.BackupManagementType.AzureWorkload); // AzureWorkload CRR Request Logger.Instance.WriteDebug("Triggering Restore to secondary region: " + secondaryRegion); @@ -517,8 +535,7 @@ public RestAzureNS.AzureOperationResponse TriggerRestore() resourceGroupName: resourceGroupName, vaultLocation: vaultLocation); return response; - } - + } } private RestAzureNS.AzureOperationResponse CreateorModifyPolicy() diff --git a/src/RecoveryServices/RecoveryServices.Backup.Providers/RecoveryServices.Backup.Providers.csproj b/src/RecoveryServices/RecoveryServices.Backup.Providers/RecoveryServices.Backup.Providers.csproj index cf3128111e12..c9781b3f130f 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Providers/RecoveryServices.Backup.Providers.csproj +++ b/src/RecoveryServices/RecoveryServices.Backup.Providers/RecoveryServices.Backup.Providers.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/RestoreDiskAPIs.cs b/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/RestoreDiskAPIs.cs index fe4735cf9214..32064fa36aa7 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/RestoreDiskAPIs.cs +++ b/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/RestoreDiskAPIs.cs @@ -78,14 +78,15 @@ public CrrAccessToken GetCRRAccessToken( AzureRecoveryPoint rp, string secondaryRegion, string vaultName = null, - string resourceGroupName = null) + string resourceGroupName = null, + string backupManagementType = null) { Dictionary uriDict = HelperUtils.ParseUri(rp.Id); string containerUri = HelperUtils.GetContainerUri(uriDict, rp.Id); string protectedItemUri = HelperUtils.GetProtectedItemUri(uriDict, rp.Id); string recoveryPointId = rp.RecoveryPointId; - AADPropertiesResource userInfo = GetAADProperties(secondaryRegion); + AADPropertiesResource userInfo = GetAADProperties(secondaryRegion, backupManagementType); var accessToken = BmsAdapter.Client.RecoveryPoints.GetAccessTokenWithHttpMessagesAsync(vaultName ?? BmsAdapter.GetResourceName(), resourceGroupName ?? BmsAdapter.GetResourceGroupName(), AzureFabricName, containerUri, protectedItemUri, recoveryPointId, userInfo).Result.Body; diff --git a/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/VaultAPIs.cs b/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/VaultAPIs.cs index 7296dd60dc58..966c60df8bd6 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/VaultAPIs.cs +++ b/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/VaultAPIs.cs @@ -16,6 +16,8 @@ using System.Linq; using Microsoft.Azure.Management.RecoveryServices.Backup.Models; using Microsoft.Azure.Management.RecoveryServices.Models; +using Microsoft.Rest.Azure.OData; +using Newtonsoft.Json; using RestAzureNS = Microsoft.Rest.Azure; namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS @@ -100,9 +102,16 @@ public ARSVault GetVault(string resouceGroupName, string vaultName) /// /// Azure region to fetch AAD properties /// vault response object. - public AADPropertiesResource GetAADProperties(string azureRegion) + public AADPropertiesResource GetAADProperties(string azureRegion, string backupManagementType = null) { - AADPropertiesResource aadProperties = BmsAdapter.Client.AadProperties.GetWithHttpMessagesAsync(azureRegion).Result.Body; + ODataQuery queryParams = null; + + if(backupManagementType == BackupManagementType.AzureWorkload) + { + queryParams = new ODataQuery(q => q.BackupManagementType == BackupManagementType.AzureWorkload); + } + + AADPropertiesResource aadProperties = BmsAdapter.Client.AadProperties.GetWithHttpMessagesAsync(azureRegion, queryParams).Result.Body; return aadProperties; } } diff --git a/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/RecoveryServices.Backup.ServiceClientAdapter.csproj b/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/RecoveryServices.Backup.ServiceClientAdapter.csproj index 38068fe9bb63..61498a40d115 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/RecoveryServices.Backup.ServiceClientAdapter.csproj +++ b/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/RecoveryServices.Backup.ServiceClientAdapter.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj b/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj index 14961658504f..91797c67557f 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj +++ b/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/RecoveryPoint/GetAzureRmRecoveryServicesBackupRecoveryLogChain.cs b/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/RecoveryPoint/GetAzureRmRecoveryServicesBackupRecoveryLogChain.cs index 49dbeb21f1f9..7e72cb82e3c1 100644 --- a/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/RecoveryPoint/GetAzureRmRecoveryServicesBackupRecoveryLogChain.cs +++ b/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/RecoveryPoint/GetAzureRmRecoveryServicesBackupRecoveryLogChain.cs @@ -69,6 +69,13 @@ public class GetAzureRmRecoveryServicesBackupRecoveryLogChain : RSBackupVaultCmd [ValidateNotNullOrEmpty] public ItemBase Item { get; set; } + /// + /// Switch param to filter Recovery point log chain on secondary region (Cross Region Restore). + /// + [Parameter(Mandatory = false, HelpMessage = ParamHelpMsgs.Common.UseSecondaryReg)] + [ValidateNotNullOrEmpty] + public SwitchParameter UseSecondaryRegion { get; set; } + public override void ExecuteCmdlet() { ExecutionBlock(() => @@ -88,6 +95,7 @@ public override void ExecuteCmdlet() providerParameters.Add(VaultParams.VaultName, vaultName); providerParameters.Add(VaultParams.ResourceGroupName, resourceGroupName); providerParameters.Add(RecoveryPointParams.Item, Item); + providerParameters.Add(CRRParams.UseSecondaryRegion, UseSecondaryRegion.IsPresent); if (ParameterSetName == DateTimeFilterParameterSet || ParameterSetName == NoFilterParameterSet) diff --git a/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Restore/GetAzureRmRecoveryServicesBackupWorkloadRecoveryConfig.cs b/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Restore/GetAzureRmRecoveryServicesBackupWorkloadRecoveryConfig.cs index 3fa73a341517..ea31c455f725 100644 --- a/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Restore/GetAzureRmRecoveryServicesBackupWorkloadRecoveryConfig.cs +++ b/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Restore/GetAzureRmRecoveryServicesBackupWorkloadRecoveryConfig.cs @@ -127,6 +127,16 @@ public override void ExecuteCmdlet() int offset = (int)timeSpan.TotalSeconds; string targetDb = ""; + if (AlternateWorkloadRestore.IsPresent || RestoreAsFiles.IsPresent) + { + if (TargetContainer == null) + { + throw new ArgumentNullException("TargetContainer", Resources.TargetContainerRequiredException); + } + + azureWorkloadRecoveryConfig.TargetVirtualMachineId = (TargetContainer as AzureVmWorkloadContainer).SourceResourceId; + } + if (TargetItem != null) { if (!string.Equals(((AzureWorkloadProtectableItem)TargetItem).ProtectableItemType, @@ -250,11 +260,6 @@ public override void ExecuteCmdlet() } else if (RestoreAsFiles.IsPresent) { - if(TargetContainer == null) - { - throw new ArgumentNullException("TargetContainer", Resources.TargetContainerRequiredException); - } - azureWorkloadRecoveryConfig.OverwriteWLIfpresent = "No"; azureWorkloadRecoveryConfig.NoRecoveryMode = "Disabled"; azureWorkloadRecoveryConfig.ContainerId = (TargetContainer as AzureVmWorkloadContainer).Id; diff --git a/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Restore/RestoreAzureRMRecoveryServicesBackupItem.cs b/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Restore/RestoreAzureRMRecoveryServicesBackupItem.cs index 9a0d3cb72aa1..0f01bff8dd68 100644 --- a/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Restore/RestoreAzureRMRecoveryServicesBackupItem.cs +++ b/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Restore/RestoreAzureRMRecoveryServicesBackupItem.cs @@ -385,10 +385,10 @@ public override void ExecuteCmdlet() var operationId = jobResponse.Request.RequestUri.Segments.Last(); var response = ServiceClientAdapter.GetCrrOperationStatus(secondaryRegion, operationId); - string jobIDJson = JsonConvert.SerializeObject(response.Body.Properties); - string[] jobSplits = jobIDJson.Split(new char[] { '\"' }); - string jobID = jobSplits[jobSplits.Length - 2]; - WriteObject(GetCrrJobObject(secondaryRegion, VaultId, jobID)); + string jobIdJson = JsonConvert.SerializeObject(response.Body.Properties); + string[] jobSplits = jobIdJson.Split(new char[] { '\"' }); + string jobId = jobSplits[jobSplits.Length - 2]; + WriteObject(GetCrrJobObject(secondaryRegion, VaultId, jobId)); } else { diff --git a/src/RecoveryServices/RecoveryServices.Backup/RecoveryServices.Backup.csproj b/src/RecoveryServices/RecoveryServices.Backup/RecoveryServices.Backup.csproj index 058f35894d6d..1f8e243a029a 100644 --- a/src/RecoveryServices/RecoveryServices.Backup/RecoveryServices.Backup.csproj +++ b/src/RecoveryServices/RecoveryServices.Backup/RecoveryServices.Backup.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj index f6a845457faf..069ff2be3ac2 100644 --- a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj +++ b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.Test/RecoveryServices.Test.csproj b/src/RecoveryServices/RecoveryServices.Test/RecoveryServices.Test.csproj index 5e3e583928b3..b57f37d0a6b8 100644 --- a/src/RecoveryServices/RecoveryServices.Test/RecoveryServices.Test.csproj +++ b/src/RecoveryServices/RecoveryServices.Test/RecoveryServices.Test.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.sln b/src/RecoveryServices/RecoveryServices.sln index a7119c5fcf28..bd31d9bdac71 100644 --- a/src/RecoveryServices/RecoveryServices.sln +++ b/src/RecoveryServices/RecoveryServices.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 +# Visual Studio Version 15 VisualStudioVersion = 15.0.28307.136 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RecoveryServices", "RecoveryServices\RecoveryServices.csproj", "{604260DC-B392-4CF4-81EC-34B14591E2D2}" diff --git a/src/RecoveryServices/RecoveryServices/ChangeLog.md b/src/RecoveryServices/RecoveryServices/ChangeLog.md index 32a6b24b6f63..21aeed034ebe 100644 --- a/src/RecoveryServices/RecoveryServices/ChangeLog.md +++ b/src/RecoveryServices/RecoveryServices/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Fixing security issue with SQL restore, this is a necessary breaking change. TargetContainer becomes mandatory for Alternate Location Restore. * Removed Set-AzRecoveryServicesBackupProperties cmdlet alias, Set-AzRecoveryServicesBackupProperty is supported. * Removed Get-AzRecoveryServicesBackupJobDetails cmdlet alias, Get-AzRecoveryServicesBackupJobDetail is supported. * Added support for cross subscription DS Move. diff --git a/src/RecoveryServices/RecoveryServices/RecoveryServices.csproj b/src/RecoveryServices/RecoveryServices/RecoveryServices.csproj index 43d83ffc7b12..c7b9b25a5354 100644 --- a/src/RecoveryServices/RecoveryServices/RecoveryServices.csproj +++ b/src/RecoveryServices/RecoveryServices/RecoveryServices.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices/Vault/GetAzureRmRecoveryServicesVaults.cs b/src/RecoveryServices/RecoveryServices/Vault/GetAzureRmRecoveryServicesVaults.cs index b23403663bf8..c0e9e56b3e66 100644 --- a/src/RecoveryServices/RecoveryServices/Vault/GetAzureRmRecoveryServicesVaults.cs +++ b/src/RecoveryServices/RecoveryServices/Vault/GetAzureRmRecoveryServicesVaults.cs @@ -19,7 +19,6 @@ using Microsoft.Azure.Management.RecoveryServices.Models; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using System.Collections; -using Microsoft.Azure.Commands.ResourceManager.Common.Tags; namespace Microsoft.Azure.Commands.RecoveryServices { diff --git a/src/RecoveryServices/RecoveryServices/help/Get-AzRecoveryServicesBackupRecoveryLogChain.md b/src/RecoveryServices/RecoveryServices/help/Get-AzRecoveryServicesBackupRecoveryLogChain.md index 55afd944b5a8..7f7ec723eae9 100644 --- a/src/RecoveryServices/RecoveryServices/help/Get-AzRecoveryServicesBackupRecoveryLogChain.md +++ b/src/RecoveryServices/RecoveryServices/help/Get-AzRecoveryServicesBackupRecoveryLogChain.md @@ -14,14 +14,15 @@ This command lists the start and end points of the unbroken log chain of the giv ### NoFilterParameterSet (Default) ``` -Get-AzRecoveryServicesBackupRecoveryLogChain [-Item] [-VaultId ] +Get-AzRecoveryServicesBackupRecoveryLogChain [-Item] [-UseSecondaryRegion] [-VaultId ] [-DefaultProfile ] [] ``` ### DateTimeFilter ``` Get-AzRecoveryServicesBackupRecoveryLogChain [[-StartDate] ] [[-EndDate] ] - [-Item] [-VaultId ] [-DefaultProfile ] [] + [-Item] [-UseSecondaryRegion] [-VaultId ] [-DefaultProfile ] + [] ``` ## DESCRIPTION @@ -48,7 +49,8 @@ The last command gets an array of recovery point time ranges for the item in $Ba This command lists the start and end points of the unbroken log chain of the given backup item. (autogenerated) -```powershell +```powershell + Get-AzRecoveryServicesBackupRecoveryLogChain -Item $Item -VaultId $vault.ID ``` @@ -114,6 +116,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -UseSecondaryRegion +Filters from Secondary Region for Cross Region Restore + +```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 +``` + ### -VaultId ARM ID of the Recovery Services Vault. diff --git a/src/RecoveryServices/RecoveryServices/help/Get-AzRecoveryServicesBackupWorkloadRecoveryConfig.md b/src/RecoveryServices/RecoveryServices/help/Get-AzRecoveryServicesBackupWorkloadRecoveryConfig.md index fe6a4d30e1de..9d35601f1177 100644 --- a/src/RecoveryServices/RecoveryServices/help/Get-AzRecoveryServicesBackupWorkloadRecoveryConfig.md +++ b/src/RecoveryServices/RecoveryServices/help/Get-AzRecoveryServicesBackupWorkloadRecoveryConfig.md @@ -38,19 +38,20 @@ The command returns a recovery config for AzureWorkload items which is passed to ### Example 1 ```powershell PS C:\> $SQLRecoveryObject = Get-AzRecoveryServicesBackupRecoveryPoint -Item $SQLBkpItem $startdate $enddate | Get-AzRecoveryServicesWorkloadRecoveryConfig -OriginalWorkloadRestore -PS C:\> $SQLRecoveryObject = Get-AzRecoveryServicesBackupRecoveryPoint -Item $SQLBkpItem $startdate $enddate | Get-AzRecoveryServicesWorkloadRecoveryConfig -AlternateWorkloadRestore -TargetItem $SQLProtItem +PS C:\> $SQLRecoveryObject = Get-AzRecoveryServicesBackupRecoveryPoint -Item $SQLBkpItem $startdate $enddate | Get-AzRecoveryServicesWorkloadRecoveryConfig -AlternateWorkloadRestore -TargetItem $SQLProtItem -TargetContainer $targetVMContainer ``` The first cmdlet is used to get the Recovery point object. The second cmdlet creates a recovery plan for a original location restore. THe third cmdlet creates a recovery plan for a alternate location restore. +Note: Parameter -TargetContainer is mandatory in case of AlternateLocationRestore or RestoreAsFiles. ### Example 2 This command constructs the recovery configuration of a backed up item such as SQL DB. (autogenerated) ```powershell -Get-AzRecoveryServicesBackupWorkloadRecoveryConfig -AlternateWorkloadRestore -RecoveryPoint $rp[0] -TargetItem -VaultId $vault.ID +Get-AzRecoveryServicesBackupWorkloadRecoveryConfig -AlternateWorkloadRestore -RecoveryPoint $rp[0] -TargetItem -TargetContainer $targetVMContainer -VaultId $vault.ID ``` ## PARAMETERS @@ -191,7 +192,7 @@ Accept wildcard characters: False ``` ### -TargetContainer -Specifies the target machine on which DB Files need to be restored. +Specifies the target machine on which DB Files need to be restored. TargetContainer is mandatory in case of AlternateLocationRestore or RestoreAsFiles. ```yaml Type: Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ContainerBase