Hi all,
I am currently using Azure Functions for all my CloudScripts. I am working on Scheduled Task using Azure Functions. However, I couldn't figure out the way to stop player client accessing the same Functions. For example, I want to create a Scheduled Task to rotate my shop items. This function should only be executed by a scheduled task set in the Game Manager Console. But when I try to invoke them through my Unity player client, it won't throw an exception.
How could I reject the execution when the caller is from a player client? Or how can I only allow execution from the Scheduled Task functionality within PlayFab Game Manager Console.
I tried to convert the context to ScheduledTaskFunctionExecutionContext, but it won't throw an exception even when I invoke the function through a Unity client side ExecuteFunction attempt.
[FunctionName("UpdateStore")] public static async Task<dynamic> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log ) { try { var context = JsonConvert.DeserializeObject<ScheduledTaskFunctionExecutionContext<dynamic>>( await req.ReadAsStringAsync()); return null; } catch (Exception e) { log.LogError($"Unexpected error calling UpdateStore function. [{e.Message}]\n{e.StackTrace}"); return null; } }