Skip to content

Commit

Permalink
fixing sql CRR
Browse files Browse the repository at this point in the history
  • Loading branch information
hiaga committed Mar 19, 2021
1 parent 3740f99 commit 80764d8
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.1.5-preview" />
<Reference Include="Microsoft.Azure.Management.RecoveryServices.Backup">
<HintPath>..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll</HintPath>
</Reference>
<PackageReference Include="TimeZoneConverter" Version="3.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.1.5-preview" />
<Reference Include="Microsoft.Azure.Management.RecoveryServices.Backup">
<HintPath>..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -517,8 +517,7 @@ public RestAzureNS.AzureOperationResponse TriggerRestore()
resourceGroupName: resourceGroupName,
vaultLocation: vaultLocation);
return response;
}

}
}

private RestAzureNS.AzureOperationResponse<ProtectionPolicyResource> CreateorModifyPolicy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.1.5-preview" />
<Reference Include="Microsoft.Azure.Management.RecoveryServices.Backup">
<HintPath>..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ public CrrAccessToken GetCRRAccessToken(
AzureRecoveryPoint rp,
string secondaryRegion,
string vaultName = null,
string resourceGroupName = null)
string resourceGroupName = null,
string backupManagementType = null)
{
Dictionary<UriEnums, string> 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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -100,9 +102,16 @@ public ARSVault GetVault(string resouceGroupName, string vaultName)
/// </summary>
/// <param name="azureRegion">Azure region to fetch AAD properties</param>
/// <returns>vault response object.</returns>
public AADPropertiesResource GetAADProperties(string azureRegion)
public AADPropertiesResource GetAADProperties(string azureRegion, string backupManagementType = null)
{
AADPropertiesResource aadProperties = BmsAdapter.Client.AadProperties.GetWithHttpMessagesAsync(azureRegion).Result.Body;
ODataQuery<BMSAADPropertiesQueryObject> queryParams = null;

if(backupManagementType == BackupManagementType.AzureWorkload)
{
queryParams = new ODataQuery<BMSAADPropertiesQueryObject>(q => q.BackupManagementType == BackupManagementType.AzureWorkload);
}

AADPropertiesResource aadProperties = BmsAdapter.Client.AadProperties.GetWithHttpMessagesAsync(azureRegion, queryParams).Result.Body;
return aadProperties;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.1.5-preview" />
<Reference Include="Microsoft.Azure.Management.RecoveryServices.Backup">
<HintPath>..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll</HintPath>
</Reference>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="44.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.4.0" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.1.5-preview" />
<Reference Include="Microsoft.Azure.Management.RecoveryServices.Backup">
<HintPath>..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.1.5-preview" />
<Reference Include="Microsoft.Azure.Management.RecoveryServices.Backup">
<HintPath>..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="44.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.4.0" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.1.5-preview" />
<Reference Include="Microsoft.Azure.Management.RecoveryServices.Backup">
<HintPath>..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll</HintPath>
</Reference>
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="14.3.0" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.SiteRecovery" Version="2.1.2-preview" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.1.5-preview" />
<Reference Include="Microsoft.Azure.Management.RecoveryServices.Backup">
<HintPath>..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.1.5-preview" />
<Reference Include="Microsoft.Azure.Management.RecoveryServices.Backup">
<HintPath>..\SDK1\Microsoft.Azure.Management.RecoveryServices.Backup.dll</HintPath>
</Reference>
<PackageReference Include="System.Security.Cryptography.Cng" Version="4.4.0" />
</ItemGroup>

Expand Down
Binary file not shown.

0 comments on commit 80764d8

Please sign in to comment.