public static async Task Run([EventGridTrigger] EventGridEvent eventGridEvent, ILogger log) { log.LogInformation(eventGridEvent.Data.ToString()); dynamic data = eventGridEvent.Data; if (data["state"] != "Processing") { log.LogInformation($"jobStateChange.Data.State = {data["state"]}, nothting to do"); return; } var azureServiceTokenProvider = new AzureServiceTokenProvider(); string accessToken = await azureServiceTokenProvider.GetAccessTokenAsync("https://rest.media.azure.net"); //var req = await MediaServicesHelper.ScaleUpReservedUnits(httpClient, accessToken); //log.LogInformation($"Set Reserved Units to {req.value[0].CurrentReservedUnits}"); var req = await MediaServicesHelper.ScaleDownReservedUnits(httpClient, accessToken); log.LogInformation($"Set Reserved Units to {req.value[0].CurrentReservedUnits}"); }