JeffreyABecker
JeffreyABecker

Reputation: 2743

How can I create an azure function with Host Key authorization in Visual Studio?

TLDR; The WebJobs framework and Azure portal Access levels differ significantly and documentation does not seem to cover how to use Host Key authorization for functions in the WebJobs Framework.

I am attempting to create a small suite of azure functions using Visual Studio 2022. The azure portal / documentation defines 4 authorization levels:

However the WebJobs framework used for defining functions in visual studio defines the following authorization levels without any commentary or documentation as to how they map to the runtime:

The Anonymous and Function Authorization levels seem to work correctly. However None of the other authorization levels in the WebJobs framework enum produce a function.json with working authorization.

Upvotes: 0

Views: 1228

Answers (1)

Pravallika KV
Pravallika KV

Reputation: 8694

Yes, I can see only 5 Authorization Levels in Visual Studio IDE for Azure Functions Project which are:

enter image description here

  • I understand your requirement is to create the Authorization of Function in Host Level from the Visual Studio IDE.

  • From my observation, whatever the authorization level you choose in the local environment - the Function Endpoint (localhost URL) is same to test locally.

  • But in the Azure Cloud Function App after deployment of Function Project, you’ll get some key-value pairs appended to the Function URL for each Authorization Level defined that prevents the users in accessing your function URL without authorization keys.

enter image description here

  • Host Key will be created/enabled by the Azure Function App in the Azure Cloud after function app is creating and deployment of Function Projects.

Refer to the Vincentlauzon’s blog article for more information on Azure Functions authorization Keys usage.

Upvotes: 1

Related Questions