Create your first Azure Function

Create an HTTP triggered function

  • In Solution Explorer, right-click on your project node and select Add > New Azure Function. Add a new Azure Function to your project
  • Choose a name for your function in the Name box.
  • Click Add in the “Add New Item” dialog.
  • Select Http trigger.
  • Change the Access Rights dropdown to Anonymous, and
  • Click Create.

    Create a new Azure Function

  • A code file is added to your project that contains a class that implements your function. The FunctionName attribute indicates the unique url for the function.

    Function code file

Test the function

  • To test your function, press F5. If prompted, accept the request from Visual Studio to download and install Azure Functions Core (CLI) tools. You may also need to enable a firewall exception so that the tools can handle HTTP requests.
  • Copy the URL of your function from the Azure Functions runtime output.

    Azure local runtime

  • Paste the URL for the HTTP request into your browser’s address bar. Append the query string ?name=<yourname> to this URL and execute the request. The following shows the response in the browser to the local GET request returned by the function:

    Function localhost response in the browser

  • To stop debugging, click the Stop button on the Visual Studio toolbar.

After you have verified that the function runs correctly on your local computer, it’s time to publish the project to Azure.

I ran into an issue The function works