Ram Krishna paul
Ram Krishna paul

Reputation: 137

How I can change auth level of azure functions and secure it?

I am having an azure function and i want to change authlevel of my azure function from authLevel = AuthorizationLevel.ANONYMOUS to FUNCTION or ADMIN. How I can implement and I am using java spring boot function app?

Code:

@FunctionName("funcName")
public HttpResponseMessage execute(@HttpTrigger(name = "request", methods = { HttpMethod.GET,HttpMethod.POST }, 
authLevel = AuthorizationLevel.ANONYMOUS) 
HttpRequestMessage<Optional<User>> request,
ExecutionContext context){
<------body ------>
}

Upvotes: 8

Views: 12457

Answers (1)

Frank Borzage
Frank Borzage

Reputation: 6796

Just change

authLevel = AuthorizationLevel.ANONYMOUS

To

authLevel = AuthorizationLevel.FUNCTION

Or

authLevel = AuthorizationLevel.ADMIN

=========================update====================

Your URL endpoint might look like this format:

https://<APP_NAME>.azurewebsites.net/api/<FUNCTION_NAME>?code=<API_KEY>

And you can find API_KEY here:

enter image description here

For more details, you can refer to this official documentation.

Upvotes: 9

Related Questions