title | description | ms.topic | ms.date | ms.custom | zone_pivot_groups |
---|---|---|---|---|---|
Create your first function in the Azure portal |
Learn how to create your first Azure Function for serverless execution using the Azure portal. |
how-to |
09/11/2024 |
devx-track-csharp, mvc, devcenter, cc996988-fb4f-47, devdivchpfy22, devx-track-extended-java, devx-track-js, devx-track-python, build-2024, devx-track-ts |
programming-languages-set-functions |
Azure Functions lets you run your code in a serverless environment without having to first create a virtual machine (VM) or publish a web application. In this article, you learn how to use Azure Functions to create a "hello world" HTTP trigger function in the Azure portal.
Choose your preferred programming language at the top of the article.
::: zone pivot="programming-language-csharp"
Note
Editing your C# function code in the Azure portal is currently only supported for C# script (.csx) functions. To learn more about the limitations on editing function code in the Azure portal, see Development limitations in the Azure portal.
You should instead develop your functions locally and publish to a function app in Azure. Use one of the following links to get started with your chosen local development environment:
- Visual Studio
- Visual Studio Code
- Terminal/command prompt
::: zone-end
::: zone pivot="programming-language-java" [!NOTE] Editing your Java function code in the Azure portal isn't currently supported. For more information, see Development limitations in the Azure portal.
You should instead develop your functions locally and publish to a function app in Azure. Use one of the following links to get started with your chosen local development environment:
- Eclipse
- Gradle
- IntelliJ IDEA
- Maven
- Quarkus
- Spring Cloud
- Visual Studio Code
::: zone-end
::: zone pivot="programming-language-javascript" [!NOTE] Because of development limitations in the Azure portal, you should instead develop your functions locally and publish to a function app in Azure. Use one of the following links to get started with your chosen local development environment: - Visual Studio Code
- Terminal/command prompt ::: zone-end ::: zone pivot="programming-language-python" [!NOTE] Because of development limitations in the Azure portal, you should instead develop your functions locally and publish to a function app in Azure. Use one of the following links to get started with your chosen local development environment:
- Visual Studio Code
- Terminal/command prompt
::: zone-end
::: zone pivot="programming-language-typescript"
[!NOTE] Editing your TypeScript function code in the Azure portal isn't currently supported. For more information, see Development limitations in the Azure portal.
You should instead develop your functions locally and publish to a function app in Azure. Use one of the following links to get started with your chosen local development environment:
- Visual Studio Code
- Terminal/command prompt
::: zone-end
::: zone pivot="programming-language-powershell"
[!NOTE] Because of development limitations in the Azure portal, you should instead develop your functions locally and publish to a function app in Azure. Use one of the following links to get started with your chosen local development environment: - Visual Studio Code
- Terminal/command prompt ::: zone-end
Please review the known issues for development of Azure Functions using Python in the Azure portal.
[!INCLUDE quickstarts-free-trial-note]
Sign in to the Azure portal with your Azure account.
You must have a function app to host the execution of your functions. A function app lets you group functions as a logical unit for easier management, deployment, scaling, and sharing of resources.
Use these steps to create your function app and related Azure resources, whether or not you're able to edit your code in the Azure portal. ::: zone pivot="programming-language-csharp" To be able to create a C# script app that you can edit in the portal, choose 8 (LTS), in-process model for .NET Version. ::: zone-end
[!INCLUDE Create function app Azure portal]
Next, create a function in the new function app.
::: zone pivot="programming-language-python,programming-language-javascript,programming-language-powershell,programming-language-csharp"
-
In your function app, select Overview, and then select + Create under Functions. If you don't see the + Create button, you must instead create your functions locally.
-
Under Select a template, scroll down and choose the HTTP trigger template.
-
In Template details, use
HttpExample
for New Function, select Anonymous from the Authorization level drop-down list, and then select Create.Azure creates the HTTP trigger function. Now, you can run the new function by sending an HTTP request. ::: zone-end
::: zone pivot="programming-language-java,programming-language-csharp,programming-language-typescript,programming-language-python"
If you aren't able to create your function code in the portal, you can instead create a local project and publish the function code to your new function app.
-
In your function app, select Overview, and then in Create functions in your preferred environment under Functions.
-
Choose your preferred local development environment and follow the steps in the linked article to create and publish your first Azure Functions project.
[!TIP] When publishing your new project, make sure to use the function app and related resources you just created. ::: zone-end
[!INCLUDE functions-test-function-portal]
[!INCLUDE Clean-up resources]
[!INCLUDE Next steps note]