You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related to #9109 which identified that AlwaysOn uses /admin/warmup endpoint.
Issue
We're seeing 401 errors with AlwaysOn when using AuthLevel.FUNCTION with FastAPI on Azure Functions. The /admin/warmup endpoint used by AlwaysOn doesn't include function keys, causing authentication failures.
Please provide guidance on the recommended approach to handle this authentication scenario without compromising security by switching to AuthLevel.ANONYMOUS.
The text was updated successfully, but these errors were encountered:
I've tested a similar approach that also fails when deployed to Azure, though it works locally. This highlights an important aspect of the issue that might help guide the solution:
importazure.functionsasfuncfromfastapiimportFastAPI# Define FastAPI app with root endpointapp_fastapi=FastAPI()
@app_fastapi.get("/")asyncdefroot():
return {"status": "OK"}
# Main ASGI app with function-level authapp=func.AsgiFunctionApp(app=app_fastapi, http_auth_level=func.AuthLevel.FUNCTION)
# Attempted anonymous root route for AlwaysOn@app.route("/", auth_level=func.AuthLevel.ANONYMOUS)defroot_function(req: func.HttpRequest) ->func.HttpResponse:
returnfunc.HttpResponse(
status_code=200,
body='{"status": "OK"}',
mimetype="application/json"
)
While this implementation appears to solve the issue locally:
Root endpoint works without authentication
Other routes maintain FUNCTION level security
FastAPI integration functions correctly
However, when deployed to Azure, it still results in the same 401 unauthorized errors:
[Information] Authorization failed. These requirements were not met:
Microsoft.Azure.WebJobs.Script.WebHost.Security.Authorization.FunctionAuthorizationRequirement
[Information] Executing StatusCodeResult, setting HTTP status code 401
This suggests that the route-level auth_level=func.AuthLevel.ANONYMOUS declaration isn't being respected in the Azure environment, even though it works in local development. There seems to be a fundamental difference in how auth levels are processed between local and cloud environments that needs to be addressed.
The fact that this approach works locally but fails on Azure points to a potential platform-level issue with how route-specific authentication levels are handled in the Azure Functions host when using FastAPI integration.
Would appreciate insights into:
Why route-level auth settings behave differently in cloud vs local
If there's a way to properly override auth levels for specific routes in Azure
The recommended pattern for handling AlwaysOn with FastAPI while maintaining security
Related to #9109 which identified that AlwaysOn uses
/admin/warmup
endpoint.Issue
We're seeing 401 errors with AlwaysOn when using
AuthLevel.FUNCTION
with FastAPI on Azure Functions. The/admin/warmup
endpoint used by AlwaysOn doesn't include function keys, causing authentication failures.Current setup
Attempted solutions
Result: Configuration does not get deployed to wwwroot
WEBSITE_WARMUP_PATH
settingResult: Documentation confirms this doesn't affect AlwaysOn path
Logs
Key Questions
Environment
extra context
Please provide guidance on the recommended approach to handle this authentication scenario without compromising security by switching to
AuthLevel.ANONYMOUS
.The text was updated successfully, but these errors were encountered: