Jon Farmer
Jon Farmer

Reputation: 326

Azure Function Suddenly Returns 401 Unauthorized When Called Remotely

I have a web API set up with Azure functions. This has been working fine from my web server for about a week. Suddenly today the functions return 401 unauthorised when call remotely but when fine in the Azure Portal. AFAIK nothing has changed.

Any one know why I now get a 401?

I have tried restarting the function app but that doesn't fix it.

Upvotes: 1

Views: 1850

Answers (2)

A.Muditha
A.Muditha

Reputation: 117

Change the AuthorizationLevel to Anonymous.

public static async Task<IActionResult> Run(
                [HttpTrigger(**AuthorizationLevel.Anonymous**, "get", "post", Route = null)] HttpRequest req,
                ILogger log){

    }

Upvotes: 0

Sajeetharan
Sajeetharan

Reputation: 222582

By default, when you create this function, it will start with the function (key) for the Authorization level. Please take a try to switch the Authorization level to Anonymous, this should allow the function to work.

Upvotes: -1

Related Questions