private static void AddMessagesToQueue(HttpRequest request) { InitializeQueueClient(); var notifications = AccessTriggerHelper.ExtractNotifications(request, _logger); if (notifications.Count > 0) { notifications.ForEach(async notification => await SendMessageAsync(notification)); } else { _logger.LogInformation($"The request{request.Query} didn't contain any relevant information"); } }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest request, ILogger logger) { _logger = logger; _logger.LogInformation($"Incomming request {request.Query}"); /** * Microsoft graph sends a probing request with a token to test the endpoint. * If the json request body contains a property "valueToken", * graph expects a 202 response, with the token as the response body. **/ if (AccessTriggerHelper.GetValueToken(request) is string valueToken) { return(new OkObjectResult(valueToken)); } AddMessagesToQueue(request); //Allways return accepted, or notifications gets turned off return(new AcceptedResult()); }