Azure / Azure/azure-functions-host
NET 5.0 function v3 - unable to override authorization level when running tests on Docker
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
Hi All,
We migrated our functions from core3.1 to 5.0 and we end up with an issue running tests on Docker.
Function declaration:
`
[Function("workingAt")]
public async Task Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestData req,
FunctionContext executionContext)
`
Authorization level is set to `Function` and over it we have an APIM which takes care.
The issue is when we run our tests on docker, all calls results in 401 and the trick which was working for core3.1 version has no longer any effect.
Previously, we used this to override settings in `function.json` file in `Dockerfile`:
`RUN find . -type f -name "function.json" -exec sed -i 's/"authLevel": "function"/"authLevel": "anonymous"/g' {} +`
Already tried with it over `functions.metadata` file and no luck here.
Is there any other way to accomplish it?
Cheers
Pawel
Contributor guide
Research direction
Start with the Dockerfile command that edits function.json, then compare it with the functions.metadata file produced for the .NET 5.0 functions. Reproduce the test request in Docker and trace where the Function authorization level is read; done means test calls no longer return 401 without weakening the production authorization configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, docker
- Domain
- authentication, backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100