Azure function app doesn't work after unlinking to Azure static web app
Published Mar 07 2023 03:05 PM 2,380 Views

As we know, we can link existing Azure function app to Azure static web app. After that, the Azure Functions app will be mapped to the /api route of your static web app.


In the following example, function app tonytesthttp has been linked to static web app.




When we try to access the function app outside static webapp, we will encounter Bad Request error. We understand that the static web app must do something to block the request. We can try to unlink the function app from static web app. However, you will find the function app still encounters the same error. How can we make our function app back to normal?




If you read the official document (Bring your own functions to Azure Static Web Apps | Microsoft Learn) carefully, you will find following statement.


If authentication and authorization policies aren't already set up on your existing Functions app, then the static web app has exclusive access to the API. To make your Functions app accessible to other applications, add another identity provider or change the security settings to allow unauthenticated access.


It seems that the link operation will add authentication limitation to only allow static webapp to access the function app. If you navigate to the authentication setting of the function app, you will find the static webapp was added as an identity provider. Even we unlink the function app to static webapp, the identity provider will not be removed automatically. We need to remove the identity provider manually. After that, the function app will work again.





Version history
Last update:
‎Mar 08 2023 11:39 PM
Updated by: