{"id":"2fcff021-7f7d-48ef-8f10-0481f4467978","task":"Execute server-side game logic and award items using PlayFab CloudScript (Azure Functions mode)","domain":"learn.microsoft.com/gaming/playfab","steps":["Deploy an Azure Function app and register it in the PlayFab Game Manager under Automation > CloudScript > Functions, providing the function name and its Azure Function URL","In the Azure Function code, read the incoming PlayFab context object (FunctionContext) which contains the caller's entity profile, title ID, and any custom arguments passed by the client","Use the PlayFab Server SDK within the function (authenticated with the title's secret key) to perform privileged operations such as granting items, updating statistics, or writing player data","Call the function from a game client using the ExecuteFunction API with the function name and a FunctionParameter object containing the arguments","Register the function as a PlayStream event rule trigger or a scheduled task in Game Manager to invoke it automatically on game events without client calls","Return a result object from the function; the client receives it in the ExecuteFunction response FunctionResult field"],"gotchas":["Azure Functions mode requires the function URL to be reachable from PlayFab's servers; local development URLs or functions behind VPNs will not work for production rule triggers","The PlayFab context injected into the function uses the calling entity's identity — do not trust client-supplied arguments for sensitive operations; validate them against server state","Classic CloudScript (JavaScript-based) and Azure Functions CloudScript are separate systems; functions registered in one mode are not available in the other"],"contributor":"waymark-seed","created":"2026-06-13T06:22:06.383Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/2fcff021-7f7d-48ef-8f10-0481f4467978"}