Is it possible to change the redirected URI for an Azure Function App using App Service Auth accessed via an API Management endpoint?

Viewed 732

I have an existing Azure Function App configured with App Service Auth using AAD. By directly accessing the App Service website xxx.azurewebsites.net/xxx I am prompted to login, and on logging in redirect back the xxx.azurewebsites.net page.

However, with the same function app accessed via an APIM endpoint, I load the site xxx.azure-api.net/xxx, get prompted to login, and then get redirected back to the azurewebsites.net page rather than the azure-api.net one.

Is there any way to configure this redirection? I have set the Redirect URIs in the App Registrations 'Authentication' blade, however this has made no difference.

Additional information:

  • In the initial 401 response I can see the original URL in the headers WWW-Authenticate Bearer realm="xxx.azurewebsites.net/xxx" ...
1 Answers

No, we can't set the request to redirect to azure-api.net after login.

What we need to know is if we use AD to protect the function app, it will redirect to login page when we request the function url. And after login, it will redirect back to function url and continue to do the request.

When you use APIM to access the function, the APIM is just as an interface. So it's same with the steps above after you request the APIM api to access the function. So it will not redirect to azure-api.net, it is by design.

Related