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.


Answer accepted by question author

  1. Pravallika KV 14,395 Reputation points Microsoft External Staff Moderator
    2026-05-05T12:19:12.79+00:00

    Hi @Kim Strasser ,

    When you switch your HTTP‐triggered Azure Function from AuthorizationLevel.Anonymous to AuthorizationLevel.Function, the runtime will require a valid function key on every call.

    In practice that means:

    • Yes, you do need to update the “Function URL” you registered in PlayFab to include your function’s key.
    • Grab the full URL from the Azure portal (your Function App → your function → “Get Function URL”). It will look something like:
        https://<your‐app>.azurewebsites.net/api/TestFunction?code=<your‐function‐key>  
      
    • Paste that full URL into PlayFab’s Register Function dialog as the “Function URL.”
    • PlayFab will then automatically invoke your function with the right key. Without the ?code=… portion you’ll get 401 Unauthorized.

    Hope this helps!


    If the resolution was helpful, kindly take a moment to click on User's imageand click on Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.

1 additional 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.