/// <summary> /// Generate Power BI client object /// </summary> /// <returns>Power BI client object</returns> private async Task <PowerBIClient> GetPowerBIClientAsync() { var aadToken = await aadService.GetAadToken(new string[] { Constant.PowerBiScope }); var tokenCredentials = new TokenCredentials(aadToken, "Bearer"); var pbiClient = new PowerBIClient(new Uri(Constant.PowerBiApiUri), tokenCredentials); return(pbiClient); }
/// <summary> /// Generate Dataverse client object /// </summary> /// <returns>Dataverse client object</returns> private async Task <HttpClient> GetDataverseClientAsync() { var aadToken = await aadService.GetAadToken(new string[] { dataverseConfig.Value.Scope }); HttpClient dataverseClient = new HttpClient(); dataverseClient.DefaultRequestHeaders.Accept.Clear(); dataverseClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); dataverseClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", aadToken); return(dataverseClient); }