Create your first Azure Function

Publish your function to Azure

You can publish your function app to Azure directly from Visual Studio.

  • In Solution Explorer, right-click the project and select Publish. Choose Create New and then click Publish.

    Publish create new function app

  • If you haven’t already connected Visual Studio to your Azure subscription, click Add an account…. If you don’t have an Azure subscription you can create one for free.

Create Free Azure Subscription

  • In the Create App Service dialog, use the Hosting settings as specified in the following table:

    Azure local runtime

    Setting Suggested value Description
    App Name Globally unique name Name that uniquely identifies your new function app.
    Subscription Choose your subscription The Azure subscription to use.
    Resource Group myResourceGroup Name of the resource group in which to create your function app.
    App Service Plan Consumption plan Make sure to choose the Consumption under Size when you create a new plan.
    Storage account Globally unique name Use an existing storage account or create a new one.
  • Click Create to create a function app in Azure with these settings.

Test your function in Azure

  • After publishing completes, copy the base URL of the function app from the Publish profile page. Azure local runtime

  • Add the /api/<functionname>?name=<yourname> to this URL. The URL should look like:

  • Paste this new URL for the HTTP request into your browser’s address bar. The following shows the response from your function in Azure:

    Function response in the browser

I ran into an issue It works in Azure