Quickstart: Create your first function in Azure using Visual Studio
In this article, you use Visual Studio to create a C# class library-based function that responds to HTTP requests. After testing the code locally, you deploy it to the serverless environment of Azure Functions.
Completing this quickstart incurs a small cost of a few USD cents or less in your Azure account.
1. Prepare your environment
Create an Azure account with an active subscription. Create an account for free.
Install Visual Studio 2019 and select the Azure development workload during installation.
Use an Azure Functions project instead
If you want to create an Azure Functions project by using Visual Studio 2017 instead, you must first install the [latest Azure Functions tools](functions-develop-vs.md#check-your-tools-version).2. Create a function app project
From the Visual Studio menu, select File > New > Project.
In Create a new project, enter functions in the search box, choose the Azure Functions template, and then select Next.
In Configure your new project, enter a Project name for your project, and then select Create.
Provide the following information for the Create a new Azure Functions application settings:
Select Azure Functions v3 (.NET Core) from the Functions runtime dropdown. (For more information, see Azure Functions runtime versions overview.)
Select HTTP trigger as the function template.
Select Storage emulator from the Storage account dropdown.
Select Anonymous from the Authorization level dropdown. (For more information about keys and authorization, see Authorization keys and HTTP and webhook bindings.)
Select Create
3. Rename the function
The FunctionName method attribute sets the name of the function, which by default is generated as Function1. Because the tooling doesn't let you override the default function name when you create your project, take a minute to create a better name for the function class, file, and metadata.
In File Explorer, right-click the Function1.cs file and rename it to HttpExample.cs.
In the code, rename the Function1 class to `HttpExample'.
In the
HttpTriggermethod namedRun, rename theFunctionNamemethod attribute toHttpExample.
4. Run the function locally
To run your function, press F5 in Visual Studio.
Copy the URL of your function from the Azure Functions runtime output.

Paste the URL for the HTTP request into your browser's address bar. Append the query string ?name=<YOUR_NAME> to this URL and run the request.

To stop debugging, press Shift+F5 in Visual Studio.
Troubleshooting
You might need to enable a firewall exception so that the tools can handle HTTP requests. Authorization levels are never enforced when you run a function locally.5. Publish the project to Azure
In Solution Explorer, right-click the project and select Publish.
In Target, select Azure
In Specific target, select Azure Function App (Windows)
In Function Instance, select Create a new Azure Function... and then use the values specified in the following:
For Name provide a Globally unique name
Select a subscription from the drop-down list.
Select an existing resource group from the drop-down list or choose New to create a new resource group.
Select Consumption in the Play Type drop-down. (For more information, see Consumption plan.)
Select an location from the drop-down.
Select an <abbr="An Azure Storage account is required by the Functions runtime. Select New to configure a general-purpose storage account. You can also choose an existing account that meets the storage account requirements.">Azure Storage account from the drop-down

Select Create
In the Functions instance, make sure that Run from package file is checked.
What does this setting do?
When using **Run from package file**, your function app is deployed using [Zip Deploy](functions-deployment-technologies.md#zip-deploy) with [Run-From-Package](run-functions-from-deployment-package.md) mode enabled. This is the recommended deployment method for your functions project, since it results in better performance.Select Finish.
On the Publish page, select Publish.
On the Publish page, review the root URL of the function app.
In the Publish tab, choose Manage in Cloud Explorer.
6. Test your function in Azure
In Cloud Explorer, your new function app should be selected. If not, expand your subscription, expand App Services, and select your new function app.
Right-click the function app and choose Open in Browser. This opens the root of your function app in your default web browser and displays the page that indicates your function app is running.
In the address bar in the browser, append the string /api/HttpExample?name=Functions to the base URL and run the request.
The URL that calls your HTTP trigger function is in the following format:
http://<APP_NAME>.azurewebsites.net/api/HttpExample?name=FunctionsGo to this URL and you see a response in the browser to the remote GET request returned by the function, which looks like the following example:
7. Clean up resources
Use the following steps to delete the function app and its related resources to avoid incurring any further costs.
In the Visual Studio Publish dialogue, in the Hosting section, select Open in Azure portal.
In the function app page, select the Overview tab and then select the link under Resource group.
In the Resource group page, review the list of included resources, and verify that they're the ones you want to delete.
Select Delete resource group, and follow the instructions.
Deletion may take a couple of minutes. When it's done, a notification appears for a few seconds. You can also select the bell icon at the top of the page to view the notification.
Next steps
Advance to the next article to learn how to add an Azure Storage queue output binding to your function:
Povratne informacije
Pošalјite i prikažite povratne informacije za