Skip to content

Commit d9ef21f

Browse files
authored
Merge pull request #276053 from silenceJialuo/flexsupport
Add new section for Flex Consumption Support
2 parents 6fe8162 + e38f6f8 commit d9ef21f

File tree

1 file changed

+40
-17
lines changed

1 file changed

+40
-17
lines changed

articles/azure-functions/functions-create-maven-intellij.md

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Create a Java function in Azure Functions using IntelliJ
33
description: Learn how to use IntelliJ to create an HTTP-triggered Java function and then run it in a serverless environment in Azure.
44
author: karlerickson
55
ms.topic: quickstart
6-
ms.date: 03/28/2022
6+
ms.date: 05/28/2024
77
ms.author: jialuogan
88
ms.devlang: java
99
ms.custom: mvc, devcenter, devx-track-java, devx-track-extended-java
@@ -33,19 +33,19 @@ Specifically, this article shows you:
3333

3434
To install the Azure Toolkit for IntelliJ and then sign in, follow these steps:
3535

36-
1. In IntelliJ IDEA's **Settings/Preferences** dialog (Ctrl+Alt+S), select **Plugins**. Then, find the **Azure Toolkit for IntelliJ** in the **Marketplace** and click **Install**. After it's installed, click **Restart** to activate the plugin.
36+
1. In IntelliJ IDEA's **Settings/Preferences** dialog (Ctrl+Alt+S), select **Plugins**. Then, find the **Azure Toolkit for IntelliJ** in the **Marketplace** and select **Install**. After it's installed, select **Restart** to activate the plugin.
3737

3838
:::image type="content" source="media/functions-create-first-java-intellij/marketplace.png" alt-text="Azure Toolkit for IntelliJ plugin in Marketplace." lightbox="media/functions-create-first-java-intellij/marketplace.png":::
3939

40-
2. To sign in to your Azure account, open the **Azure Explorer** sidebar, and then click the **Azure Sign In** icon in the bar on top (or from the IDEA menu, select **Tools > Azure > Azure Sign in**).
40+
2. To sign in to your Azure account, open the **Azure Explorer** sidebar, and then select the **Azure Sign In** icon in the bar on top (or from the IDEA menu, select **Tools > Azure > Azure Sign in**).
4141

4242
:::image type="content" source="media/functions-create-first-java-intellij/intellij-azure-login.png" alt-text="The IntelliJ Azure Sign In command." lightbox="media/functions-create-first-java-intellij/intellij-azure-login.png":::
4343

44-
3. In the **Azure Sign In** window, select **OAuth 2.0**, and then click **Sign in**. For other sign-in options, see [Sign-in instructions for the Azure Toolkit for IntelliJ](/azure/developer/java/toolkit-for-intellij/sign-in-instructions).
44+
3. In the **Azure Sign In** window, select **OAuth 2.0**, and then select **Sign in**. For other sign-in options, see [Sign-in instructions for the Azure Toolkit for IntelliJ](/azure/developer/java/toolkit-for-intellij/sign-in-instructions).
4545

4646
:::image type="content" source="media/functions-create-first-java-intellij/intellij-azure-login-popup.png" alt-text="The Azure Sign In window with device login selected." lightbox="media/functions-create-first-java-intellij/intellij-azure-login-popup.png":::
4747

48-
4. In the browser, sign in with your account and then go back to IntelliJ. In the **Select Subscriptions** dialog box, click on the subscriptions that you want to use, then click **Select**.
48+
4. In the browser, sign in with your account and then go back to IntelliJ. In the **Select Subscriptions** dialog box, select the subscriptions that you want to use, then select **Select**.
4949

5050
:::image type="content" source="media/functions-create-first-java-intellij/intellij-azure-login-selectsubs.png" alt-text="The Select Subscriptions dialog box." lightbox="media/functions-create-first-java-intellij/intellij-azure-login-selectsubs.png":::
5151

@@ -57,7 +57,7 @@ To use Azure Toolkit for IntelliJ to create a local Azure Functions project, fol
5757

5858
:::image type="content" source="media/functions-create-first-java-intellij/create-functions-project.png" alt-text="Create function project." lightbox="media/functions-create-first-java-intellij/create-functions-project.png":::
5959

60-
1. Select **Http Trigger**, then click **Next** and follow the wizard to go through all the configurations in the following pages. Confirm your project location, then click **Finish**. Intellj IDEA will then open your new project.
60+
1. Select **Http Trigger**, then select **Next** and follow the wizard to go through all the configurations in the following pages. Confirm your project location, then select **Finish**. Intellj IDEA then opens your new project.
6161

6262
:::image type="content" source="media/functions-create-first-java-intellij/create-functions-project-finish.png" alt-text="Create function project finish." lightbox="media/functions-create-first-java-intellij/create-functions-project-finish.png":::
6363

@@ -68,7 +68,7 @@ To run the project locally, follow these steps:
6868
> [!IMPORTANT]
6969
> You must have the JAVA_HOME environment variable set correctly to the JDK directory that is used during code compiling using Maven. Make sure that the version of the JDK is at least as high as the `Java.version` setting.
7070
71-
1. Navigate to *src/main/java/org/example/functions/HttpTriggerFunction.java* to see the code generated. Beside the line *24*, you'll notice that there's a green **Run** button. Click it and select **Run 'Functions-azur...'**. You'll see that your function app is running locally with a few logs.
71+
1. Navigate to *src/main/java/org/example/functions/HttpTriggerFunction.java* to see the code generated. Beside line 24, you should see a green **Run** button. Select it and then select **Run 'Functions-azur...'**. You should see your function app running locally with a few logs.
7272

7373
:::image type="content" source="media/functions-create-first-java-intellij/local-run-functions-project.png" alt-text="Local run project." lightbox="media/functions-create-first-java-intellij/local-run-functions-project.png":::
7474

@@ -78,7 +78,7 @@ To run the project locally, follow these steps:
7878

7979
:::image type="content" source="media/functions-create-first-java-intellij/local-run-functions-test.png" alt-text="Local run function test result." lightbox="media/functions-create-first-java-intellij/local-run-functions-test.png":::
8080

81-
1. The log is also displayed in your IDEA. Stop the function app by clicking the **Stop** button.
81+
1. The log is also displayed in your IDEA. Stop the function app by selecting **Stop**.
8282

8383
:::image type="content" source="media/functions-create-first-java-intellij/local-run-functions-log.png" alt-text="Local run function test log." lightbox="media/functions-create-first-java-intellij/local-run-functions-log.png":::
8484

@@ -90,19 +90,42 @@ To debug the project locally, follow these steps:
9090

9191
:::image type="content" source="media/functions-create-first-java-intellij/local-debug-functions-button.png" alt-text="Local debug function app button." lightbox="media/functions-create-first-java-intellij/local-debug-functions-button.png":::
9292

93-
1. Click on line *20* of the file *src/main/java/org/example/functions/HttpTriggerFunction.java* to add a breakpoint. Access the endpoint `http://localhost:7071/api/HttpTrigger-Java?name=Azure` again and you'll find the breakpoint is hit. You can then try more debug features like **Step**, **Watch**, and **Evaluation**. Stop the debug session by clicking the **Stop** button.
93+
1. Select line 20 of the file *src/main/java/org/example/functions/HttpTriggerFunction.java* to add a breakpoint. Access the endpoint `http://localhost:7071/api/HttpTrigger-Java?name=Azure` again and you should find that the breakpoint is hit. You can then try more debug features like **Step**, **Watch**, and **Evaluation**. Stop the debug session by selecting **Stop**.
9494

9595
:::image type="content" source="media/functions-create-first-java-intellij/local-debug-functions-break.png" alt-text="Local debug function app break." lightbox="media/functions-create-first-java-intellij/local-debug-functions-break.png":::
9696

97+
## Create the function app in Azure
98+
99+
Use the following steps create a function app and related resources in your Azure subscription:
100+
101+
1. In Azure Explorer in your IDEA, right-click **Function App** and then select **Create**.
102+
103+
1. Select **More Settings** and provide the following information at the prompts:
104+
105+
| Prompt | Selection |
106+
|---------------------|-------------------------------------------------------------------------------------------------------------|
107+
| **Subscription** | Choose the subscription to use. |
108+
| **Resource Group** | Choose the resource group for your function app. |
109+
| **Name** | Specify the name for a new function app. Here you can accept the default value. |
110+
| **Platform** | Select **Windows-Java 17** or another platform as appropriate. |
111+
| **Region** | For better performance, choose a [region](https://azure.microsoft.com/regions/) near you. |
112+
| **Hosting Options** | Choose the hosting options for your function app. |
113+
| **Plan** | Choose the App Service plan pricing tier you want to use, or select **+** to create a new App Service plan. |
114+
115+
> [!IMPORTANT]
116+
> To create your app in the Flex Consumption plan, select **Flex Consumption**. The [Flex Consumption plan](flex-consumption-plan.md) is currently in preview.
117+
118+
1. Select **OK**. A notification is displayed after your function app is created.
119+
97120
## Deploy your project to Azure
98121

99122
To deploy your project to Azure, follow these steps:
100123

101-
1. Click and expand the Azure icon in IntelliJ Project explorer, then select **Deploy to Azure -> Deploy to Azure Functions**.
124+
1. Select and expand the Azure icon in IntelliJ Project explorer, then select **Deploy to Azure -> Deploy to Azure Functions**.
102125

103126
:::image type="content" source="media/functions-create-first-java-intellij/deploy-functions-to-azure.png" alt-text="Deploy project to Azure." lightbox="media/functions-create-first-java-intellij/deploy-functions-to-azure.png":::
104127

105-
1. If you don't have any Function App yet, click **+** in the *Function* line. Type in the function app name and choose proper platform. Here you can accept the default value. Click **OK** and the new function app you created will be automatically selected. Click **Run** to deploy your functions.
128+
1. You can select the function app from the previous section. To create a new one, select **+** on the **Function** line. Type in the function app name and choose the proper platform. Here, you can accept the default value. Select **OK** and the new function app you created is automatically selected. Select **Run** to deploy your functions.
106129

107130
:::image type="content" source="media/functions-create-first-java-intellij/deploy-functions-create-app.png" alt-text="Create function app in Azure." lightbox="media/functions-create-first-java-intellij/deploy-functions-create-app.png":::
108131

@@ -112,35 +135,35 @@ To deploy your project to Azure, follow these steps:
112135

113136
To manage your function apps with **Azure Explorer** in your IDEA, follow these steps:
114137

115-
1. Click on **Function App** and you'll see all your function apps listed.
138+
1. Select **Function App** to see all your function apps listed.
116139

117140
:::image type="content" source="media/functions-create-first-java-intellij/explorer-view-functions.png" alt-text="View function apps in explorer." lightbox="media/functions-create-first-java-intellij/explorer-view-functions.png":::
118141

119-
1. Click to select on one of your function apps, then right click and select **Show Properties** to open the detail page.
142+
1. Select one of your function apps, then right-click and select **Show Properties** to open the detail page.
120143

121144
:::image type="content" source="media/functions-create-first-java-intellij/explorer-functions-show-properties.png" alt-text="Show function app properties." lightbox="media/functions-create-first-java-intellij/explorer-functions-show-properties.png":::
122145

123-
1. Right click on your **HttpTrigger-Java** function app, then select **Trigger Function in Browser**. You'll see that the browser is opened with the trigger URL.
146+
1. Right-click your **HttpTrigger-Java** function app, then select **Trigger Function in Browser**. You should see that the browser is opened with the trigger URL.
124147

125148
:::image type="content" source="media/functions-create-first-java-intellij/explorer-trigger-functions.png" alt-text="Screenshot shows a browser with the U R L." lightbox="media/functions-create-first-java-intellij/explorer-trigger-functions.png":::
126149

127150
## Add more functions to the project
128151

129152
To add more functions to your project, follow these steps:
130153

131-
1. Right click on the package **org.example.functions** and select **New -> Azure Function Class**.
154+
1. Right-click the package **org.example.functions** and select **New -> Azure Function Class**.
132155

133156
:::image type="content" source="media/functions-create-first-java-intellij/add-functions-entry.png" alt-text="Add functions to the project entry." lightbox="media/functions-create-first-java-intellij/add-functions-entry.png":::
134157

135-
1. Fill in the class name **HttpTest** and select **HttpTrigger** in the create function class wizard, then click **OK** to create. In this way, you can create new functions as you want.
158+
1. Fill in the class name **HttpTest** and select **HttpTrigger** in the create function class wizard, then select **OK** to create. In this way, you can create new functions as you want.
136159

137160
:::image type="content" source="media/functions-create-first-java-intellij/add-functions-trigger.png" alt-text="Screenshot shows the Create Function Class dialog box." lightbox="media/functions-create-first-java-intellij/add-functions-trigger.png":::
138161

139162
:::image type="content" source="media/functions-create-first-java-intellij/add-functions-output.png" alt-text="Add functions to the project output." lightbox="media/functions-create-first-java-intellij/add-functions-output.png":::
140163

141164
## Cleaning up functions
142165

143-
Select one of your function apps using **Azure Explorer** in your IDEA, then right-click and select **Delete**. This command might take several minutes to run. When it's done, the status will refresh in **Azure Explorer**.
166+
Select one of your function apps using **Azure Explorer** in your IDEA, then right-click and select **Delete**. This command might take several minutes to run. When it's done, the status refreshes in **Azure Explorer**.
144167

145168
:::image type="content" source="media/functions-create-first-java-intellij/delete-function.png" alt-text="Screenshot shows Delete selected from a context menu." lightbox="media/functions-create-first-java-intellij/delete-function.png":::
146169

0 commit comments

Comments
 (0)