/// <summary> /// Method to get secondary region AAD properties /// </summary> /// <param name="azureRegion">Azure region to fetch AAD properties</param> /// <returns>vault response object.</returns> public CrrModel.AADPropertiesResource GetAADProperties(string azureRegion, string backupManagementType = null) { ODataQuery <CrrModel.BMSAADPropertiesQueryObject> queryParams = null; if (backupManagementType == BackupManagementType.AzureWorkload) { queryParams = new ODataQuery <CrrModel.BMSAADPropertiesQueryObject>(q => q.BackupManagementType == BackupManagementType.AzureWorkload); } CrrModel.AADPropertiesResource aadProperties = CrrAdapter.Client.AadProperties.GetWithHttpMessagesAsync(azureRegion, queryParams).Result.Body; return(aadProperties); }
/// <summary> /// Gets the access token for CRR operation /// </summary> /// <param name="rp">Recovery point to restore the disk to</param> /// <param name="secondaryRegion">secondary region where to trigger the restore</param> /// <param name="vaultName">Name of recovery services vault</param> /// <param name="resourceGroupName">Name of the vault resource group</param> /// <param name="backupManagementType"></param> /// <returns>CRR access token</returns> public CrrModel.CrrAccessToken GetCRRAccessToken( AzureRecoveryPoint rp, string secondaryRegion, string vaultName = 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; CrrModel.AADPropertiesResource userInfo = GetAADProperties(secondaryRegion, backupManagementType); var accessToken = CrrAdapter.Client.RecoveryPoints.GetAccessTokenWithHttpMessagesAsync(vaultName ?? BmsAdapter.GetResourceName(), resourceGroupName ?? BmsAdapter.GetResourceGroupName(), AzureFabricName, containerUri, protectedItemUri, recoveryPointId, userInfo).Result.Body; return(accessToken.Properties); }