Wednesday, November 14, 2018

Different access rights for creating new Azure function project in Visual Studio 2017

When you create new Azure functions project in Visual Studio 2017:

image

it asks you to specify Access rights for the newly created function:

image

There are 3 following options available which mean the following (see Azure Functions HTTP triggers and bindings):

  • Function – a function-specific API key is required. This is the default value if none is provided.
  • Anonymous - no API key is required
  • Admin - the master key is required

More info about these keys can be found here. But how this chose affects Visual Studio project? There are number of files created after you click Ok on the above dialog window:

  • sln – solution file
  • csproj – project file
  • host.json – host settings file
  • local.settings.json – local app settings file
  • Function1.cs – code of Azure function

The difference is only in function code cs file (Function1.cs): different AuthorizationLevel values will be passed to HttpTrigger attribute when different access rights are chosen:

image

Other files are equal. Hope that this info will help to understand Azure functions project structure better.

No comments:

Post a Comment