diff --git a/src/RecoveryServices/RecoveryServices.Backup.Helpers/RecoveryServices.Backup.Helpers.csproj b/src/RecoveryServices/RecoveryServices.Backup.Helpers/RecoveryServices.Backup.Helpers.csproj
index 5d90d8ee8ec5..afb1a2d69d25 100644
--- a/src/RecoveryServices/RecoveryServices.Backup.Helpers/RecoveryServices.Backup.Helpers.csproj
+++ b/src/RecoveryServices/RecoveryServices.Backup.Helpers/RecoveryServices.Backup.Helpers.csproj
@@ -12,7 +12,9 @@
-
+
+ ..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll
+
diff --git a/src/RecoveryServices/RecoveryServices.Backup.Models/RecoveryServices.Backup.Models.csproj b/src/RecoveryServices/RecoveryServices.Backup.Models/RecoveryServices.Backup.Models.csproj
index 70e32c9e21f7..6ea7f9bc5e60 100644
--- a/src/RecoveryServices/RecoveryServices.Backup.Models/RecoveryServices.Backup.Models.csproj
+++ b/src/RecoveryServices/RecoveryServices.Backup.Models/RecoveryServices.Backup.Models.csproj
@@ -12,7 +12,9 @@
-
+
+ ..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll
+
diff --git a/src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs b/src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs
index 7b8def6adf29..1e78704ddf72 100644
--- a/src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs
+++ b/src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs
@@ -491,7 +491,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 +517,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..43013d58344e 100644
--- a/src/RecoveryServices/RecoveryServices.Backup.Providers/RecoveryServices.Backup.Providers.csproj
+++ b/src/RecoveryServices/RecoveryServices.Backup.Providers/RecoveryServices.Backup.Providers.csproj
@@ -12,7 +12,9 @@
-
+
+ ..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll
+
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..97b8520b8521 100644
--- a/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/RecoveryServices.Backup.ServiceClientAdapter.csproj
+++ b/src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/RecoveryServices.Backup.ServiceClientAdapter.csproj
@@ -13,7 +13,9 @@
-
+
+ ..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll
+
diff --git a/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj b/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj
index 238732c53752..88186e440766 100644
--- a/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj
+++ b/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj
@@ -14,7 +14,9 @@
-
+
+ ..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll
+
diff --git a/src/RecoveryServices/RecoveryServices.Backup/RecoveryServices.Backup.csproj b/src/RecoveryServices/RecoveryServices.Backup/RecoveryServices.Backup.csproj
index 058f35894d6d..ae3efb278fcc 100644
--- a/src/RecoveryServices/RecoveryServices.Backup/RecoveryServices.Backup.csproj
+++ b/src/RecoveryServices/RecoveryServices.Backup/RecoveryServices.Backup.csproj
@@ -13,7 +13,9 @@
-
+
+ ..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll
+
diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj
index 6c66c4de33ed..af61662bfdc4 100644
--- a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj
+++ b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj
@@ -14,7 +14,9 @@
-
+
+ ..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll
+
diff --git a/src/RecoveryServices/RecoveryServices.Test/RecoveryServices.Test.csproj b/src/RecoveryServices/RecoveryServices.Test/RecoveryServices.Test.csproj
index 5e3e583928b3..ab1c2e096e4a 100644
--- a/src/RecoveryServices/RecoveryServices.Test/RecoveryServices.Test.csproj
+++ b/src/RecoveryServices/RecoveryServices.Test/RecoveryServices.Test.csproj
@@ -12,7 +12,9 @@
-
+
+ ..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll
+
diff --git a/src/RecoveryServices/RecoveryServices/RecoveryServices.csproj b/src/RecoveryServices/RecoveryServices/RecoveryServices.csproj
index 43d83ffc7b12..45dc949eaa27 100644
--- a/src/RecoveryServices/RecoveryServices/RecoveryServices.csproj
+++ b/src/RecoveryServices/RecoveryServices/RecoveryServices.csproj
@@ -12,7 +12,9 @@
-
+
+ ..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll
+
diff --git a/src/RecoveryServices/SDK1/Microsoft.Azure.Management.RecoveryServices.Backup.dll b/src/RecoveryServices/SDK1/Microsoft.Azure.Management.RecoveryServices.Backup.dll
new file mode 100644
index 000000000000..14605677f39b
Binary files /dev/null and b/src/RecoveryServices/SDK1/Microsoft.Azure.Management.RecoveryServices.Backup.dll differ