1
votes

I have a few azure functions that I would like to set a token based authentication (using a bearer token). I would like to make sure that users that does not pass in a bearer token in the HTTP header, is not able to access the azure function. I am using visual code/Azure cloud. Any help or direction would be greatly appreciated. I have a way to obtain the bearer token using the client id, secret, tenant id, however how would I make it a required field for an azure function?

1

1 Answers

0
votes

Well, in this case, you just need to enable the azure ad auth for your function app.

Navigate to the function app -> Authentication / Authorization -> follow this doc to configure the azure ad auth(recommend you to choose Create New AD App like below, it will automatically configure several settings for you and reduce some issues).

enter image description here

After configuring the app, select the Log in with Azure Active Directory.

enter image description here

I have a way to obtain the bearer token using the client id, secret, tenant id, however how would I make it a required field for an azure function?

After all the configuration, the access token is needed when you use the service principal(the client id, secret, tenant id stuff you mentioned, i.e. the client credential flow) to access the function.