Share via

Which URL should I use to register my Azure functions in PlayFab when I use AuthorizationLevel.Function instead of AuthorizationLevel.Anonymous?

Kim Strasser 2,496 Reputation points
2026-05-05T12:05:55.53+00:00

I have always used AuthorizationLevel.Anonymous in my Azure functions in debug mode and in PlayFab I have registered my Azure functions like this. I call my Azure functions from iPad Air in debug mode and I want to change the AuthorizationLevel to .Function because I want to publish my game sometime this year in the Apple App Store and Google Play Store.

Screenshot 2026-05-05 134634

Is it necessary to change the Function URL in PlayFab when I use AuthorizationLevel.Function instead of AuthorizationLevel.Anonymous? Is it necessary to use the Function key from Azure Portal-->AzureFunctionsTest-->TestFunction-->"Get Function URL"-->default (Function key) when I register my Azure functions in PlayFab or is it not necessary to change the URL in PlayFab?

[Function("TestFunction")]     
public async Task<HttpResponseData> TestFunction(         
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestData req)
    {
        // Read JSON body
        string jsonStr = await new StreamReader(req.Body).ReadToEndAsync();
...

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.


1 answer

Sort by: Most helpful
  1. Q&A Assist
    2026-05-05T12:06:15.7666667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    When changing the HTTP trigger from AuthorizationLevel.Anonymous to AuthorizationLevel.Function, the URL that PlayFab uses must include a valid function access key.

    For HTTP-triggered Azure Functions, when the authorization level is anything other than anonymous, every request must provide an access key either:

    • As a ?code=<API_KEY> query string parameter, or
    • In the x-functions-key HTTP header.

    PlayFab calls the function by using the Function URL that is registered in Cloud Script. Because PlayFab doesn’t add the key header for you, the simplest approach is to register the full function URL that already includes the key.

    So, for your TestFunction with AuthorizationLevel.Function:

    1. In the Azure portal, open the function → Get function URL.
    2. Choose the default Function key.
    3. Copy the full URL, which looks like:
         https://<APP_NAME>.azurewebsites.net/api/TestFunction?code=<FUNCTION_KEY>
      
    4. In PlayFab Cloud Script → Register Function, paste this full URL (including ?code=...) into Function URL.

    This change is necessary when moving from anonymous to function authorization; otherwise PlayFab’s calls will be rejected with authorization errors.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.