Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

func new "HTTP trigger" incorrect case of ANONYMOUS for Python #3651

Open
robotdad opened this issue Apr 26, 2024 · 4 comments
Open

func new "HTTP trigger" incorrect case of ANONYMOUS for Python #3651

robotdad opened this issue Apr 26, 2024 · 4 comments
Assignees

Comments

@robotdad
Copy link
Member

The code generated by the call below is incorrect for both v1 and v2 for Python.
func new --name HttpExample --template "HTTP trigger" --authlevel anonymous

This will generate the following line in function_app.py.
@app.route(route="HttpExample", auth_level=func.AuthLevel.Anonymous)
This should be:
@app.route(route="HttpExample", auth_level=func.AuthLevel.ANONYMOUS)

This breaks most getting started samples on mslearn for Python out of the box.

@robotdad
Copy link
Member Author

I should have included that it does not matter how you specify --authlevel, it will always be "Anonymous" in the generated code.

@shreyabatra4
Copy link

Hi @robotdad I was able to repro the issue described with the string showing up in lowercase instead of all upper case- but not your second comment that the auth level always shows as Anonymous regardless of the indicated auth level. Can you please confirm the version of Core Tools you are using?

@robotdad
Copy link
Member Author

func --version
4.0.5611

My comment was unclear, apologies. I meant that the casing of what I pass as the value to specify anonymous does not impact the code generation, either --authlevel ANONYMOUS or --authlevel anonymous generate the same code that uses mixed case Anonymous.

If I don't specify --authlevel then func tools prompts to select a value and when choosing ANONYMOUS the generated code is correct.

I've not tried the other auth levels.

@khkh-ms
Copy link
Contributor

khkh-ms commented May 14, 2024

Thank you @robotdad for the detailed feedback. We will fix it soon.

@khkh-ms khkh-ms self-assigned this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants