azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

```func new``` not creating a valid template with Python

Open lukasmu opened this issue 2 months ago • 0 comments

On https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-python?tabs=linux%2Cbash%2Cazure-cli%2Cbrowser#create-a-local-function it is explained that a new function can be created with the command func new --name HttpExample --template "HTTP trigger" --authlevel "anonymous". However, this executing this command generates invalid code. When trying to run func start afterwards, an exception is raised:

Worker failed to index functions
Result: Failure
Exception: AttributeError: anonymous

It appears that the function decorator is not generated correctly: It should be @app.route(route="HttpExample", auth_level=func.AuthLevel.ANONYMOUS) instead of @app.route(route="HttpExample", auth_level=func.AuthLevel.Anonymous).

lukasmu avatar Jul 01 '24 07:07 lukasmu