An Azure service that provides an event-driven serverless compute platform.
Hi @Kim Strasser ,
Thanks for the confirmation, Glad the issue is resolved.
The problem is simply that you're not sending the function key. With AuthorizationLevel.Function, Azure expects a key in every request, and your current request doesn’t include one.
That’s why the runtime logs show:
WebJobsAuthLevel was not authenticated→ no key → 401
You’re calling
YAML
string url = "https://newazureplaydistribution.azurewebsites.net/api/loginaccount";
But for AuthorizationLevel.Function, it must include the key.
Fix option 1: Add key to URL
Update your URL like this:
YAML
string url = "https://newazureplaydistribution.azurewebsites.net/api/loginaccount?code=<YOUR_FUNCTION_KEY>";
Fix option 2: Add header
Add this before sending the request:
YAML
request.Headers.Add("x-functions-key", "<YOUR_FUNCTION_KEY>");
In Azure Portal:
- Go to your Function App
- Click Functions =>LoginAccount function
- Click "Get Function URL"
- Copy the URL, it will look like:
YAML
https://newazureplaydistribution.azurewebsites.net/api/LoginAccount?code=AbCdEf123...
code=... is your correct key.
Hope this helps!
If the resolution was helpful, kindly take a moment to click on and click on Yes for was this answer helpful. And, if you have any further query do let us know.