Pulumi: How to programmatically set an Azure Function's authorization Level

105 Views Asked by At

How can I programmatically set an Azure Function's authorization level?

Pulumi exposes a 'FunctionAppAuthSettingsArgs'. However, I am unable to resolve what's required to set the actual authorization level.

Context:

I am unable to invoke Azure Functions from a client application when the authorization level of the Azure Function is set to 'Function'.

However, I can invoke an Azure Function when the authorization level is set to 'Anonymous'.

Thus, instead of manually updating dozens of Azure Functions across several code bases, I would rather perform this task programmatically.

Other references:

How to safely call Azure Function with function level authorization in Xamarin mobile app?

https://learn.microsoft.com/en-us/azure/app-service/overview-authentication-authorization

1

There are 1 best solutions below

0
On

The authLevel property is set in the function.json files generated before your function app is published. There is no way to update/override them externally.

The best approach would be to first fix your function apps to work with function authLevel and then perhaps use Azure API Management as a front for your function apps. This way your mobile apps would just use their own authentication and don't have to worry about the function keys themselves (which ideally should not really be used from public client applications anyways).