in wvd-templates/diagnostics-sample/src/MSFT.WVD.Diagnostics.Common/Services/RoleAssignmentService.cs [82:97]
private async Task<HttpResponseMessage> Request(HttpMethod httpMethod, string url, string accessToken)
{
var activityId = Guid.NewGuid().ToString();
_logger.LogInformation($"Sending RDS Management request to {url}. ActivityId:{activityId}");
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add("x-ms-correlation-id", activityId);
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
HttpRequestMessage request = new HttpRequestMessage(httpMethod, url);
HttpResponseMessage response = await client.SendAsync(request);
_logger.LogInformation($"Received response from ActivityId:{activityId} Status:{response.StatusCode}");
return response;
}
}