question

Evan Maxey avatar image
Evan Maxey asked

Example Securing Azure Functions?

Is there an end to end example of setting up an Azure Function using "Function" level authorization vs "Anonymous"?

We're converting from legacy CloudScript to Azure Functions. I'm new to azure functions and understand that the developer secret key needs to be specified somewhere/somehow but I'm groping across 3 or 4 different bits of documentation and blindly experimenting without success.

Any help would be appreciated.

CloudScript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image
Sarah Zhang answered

If you use “Function” level authentication for Azure Functions, there will be an API key that can used to authenticate callers of your Azure Functions. This authentication key is a concept of the Azure Functions and not related to PlayFab developer secret key. PlayFab Secret key is only for Server/Admin API, or getting a title-level entity token, you can store it at configuration page of Azure portal for later reference.

You can check the documentations of Azure Functions, specifically this documentation - Azure Functions HTTP trigger | Microsoft Docs for more information about different types of auth levels and the corresponding examples.

As this section - API key authorization mentioned, if you set up the Azure Functions with the API key. The URL of your function could be something like this.

https://<APP_NAME>.azurewebsites.net/api/<FUNCTION_NAME>?code=<API_KEY>

To register the Azure Functions that using “Function” level authentication, you just need to paste the URL that contains the above “code” to PlayFab. If you upload your azure function with “function” method, the function URL you get from Azure contains API keys. The advantage of using “function” method is to avoid abusive or anonymous calls because Azure Function is metered by usage.

If you have any other technical questions about how to set up “functions” authentication for your Azure Functions, please refer to the above Azure Functions documentations or follow this page - Azure Support Options | Microsoft Azure to contact the technical supports of Azure for more professional help.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Evan Maxey avatar image Evan Maxey commented ·

Sincerely appreciate the note. Will go dig and follow up! :)

0 Likes 0 ·
Evan Maxey avatar image
Evan Maxey answered

quick follow up - finally made heads and tails of the approach and have successfully Azure functions in place of cloud script. ty :)

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.