You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -45,7 +45,7 @@ By default, the Flex Consumption plan follows a _pay-for-what-you-use_ billing m
45
45
::: zone pivot="programming-language-python"
46
46
+[Python 3.11](https://www.python.org/).
47
47
::: zone-end
48
-
+ A [secure HTTP test tool](functions-develop-local.md#http-test-tools) for sending HTTP GET and HTTP POST requests to your function endpoints. This article uses `curl`.
48
+
+ A [secure HTTP test tool](functions-develop-local.md#http-test-tools) for sending requests with JSON payloads to your function endpoints. This article uses `curl`.
49
49
50
50
## Initialize the project
51
51
@@ -55,15 +55,18 @@ You can use the `azd init` command to create a local Azure Functions code projec
55
55
1. In your local terminal or command prompt, run this `azd init` command in an empty folder:
This pulls the project files from the [template repository](https://github.com/Azure-Samples/functions-quickstart-dotnet-azd) and initializes the project in the current folder.
This command pulls the project files from the [template repository](https://github.com/Azure-Samples/functions-quickstart-dotnet-azd) and initializes the project in the current folder. The `-e` flag sets a name for the current environment. In `azd`, the environment is used to maintain a unique deployment context for your app, and you can define more than one. It's also used in the name of the resource group you create in Azure.
62
+
63
+
1. Run this command to navigate to the `http` app folder:
64
+
65
+
```console
66
+
cd http
67
+
```
65
68
66
-
3. Create a file named _local.settings.json_ in the app folder (`http`) that contains this JSON data:
69
+
1. Create a file named _local.settings.json_ in the `http` folder that contains this JSON data:
67
70
68
71
```json
69
72
{
@@ -81,15 +84,18 @@ You can use the `azd init` command to create a local Azure Functions code projec
81
84
1. In your local terminal or command prompt, run this `azd init` command in an empty folder:
This pulls the project files from the [template repository](https://github.com/Azure-Samples/azure-functions-java-flex-consumption-azd) and initializes the project in the current folder.
90
+
This command pulls the project files from the [template repository](https://github.com/Azure-Samples/azure-functions-java-flex-consumption-azd) and initializes the project in the current folder. The `-e` flag sets a name for the current environment. In `azd`, the environment is used to maintain a unique deployment context for your app, and you can define more than one. It's also used in the name of the resource group you create in Azure.
This pulls the project files from the [template repository](https://github.com/Azure-Samples/functions-quickstart-javascript-azd) and initializes the project in the root folder.
This command pulls the project files from the [template repository](https://github.com/Azure-Samples/functions-quickstart-javascript-azd) and initializes the project in the root folder. The `-e` flag sets a name for the current environment. In `azd`, the environment is used to maintain a unique deployment context for your app, and you can define more than one. It's also used in the name of the resource group you create in Azure.
115
120
116
-
3. Create a file named _local.settings.json_ in the root folder that contains this JSON data:
121
+
1. Create a file named _local.settings.json_ in the root folder that contains this JSON data:
117
122
118
123
```json
119
124
{
@@ -131,14 +136,18 @@ You can use the `azd init` command to create a local Azure Functions code projec
131
136
1. In your local terminal or command prompt, run this `azd init` command in an empty folder:
This pulls the project files from the [template repository](https://github.com/Azure-Samples/functions-quickstart-powershell-azd) and initializes the project in the root folder.
This command pulls the project files from the [template repository](https://github.com/Azure-Samples/functions-quickstart-powershell-azd) and initializes the project in the root folder. The `-e` flag sets a name for the current environment. In `azd`, the environment is used to maintain a unique deployment context for your app, and you can define more than one. It's also used in the name of the resource group you create in Azure.
140
143
141
-
3. Create a file named _local.settings.json_ in the app folder (`http`) that contains this JSON data:
144
+
1. Run this command to navigate to the `src` app folder:
145
+
146
+
```console
147
+
cd src
148
+
```
149
+
150
+
1. Create a file named _local.settings.json_ in the `src` folder that contains this JSON data:
142
151
143
152
```json
144
153
{
@@ -157,13 +166,12 @@ You can use the `azd init` command to create a local Azure Functions code projec
157
166
1. In your local terminal or command prompt, run this `azd init` command in an empty folder:
This pulls the project files from the [template repository](https://github.com/Azure-Samples/functions-quickstart-typescript-azd) and initializes the project in the root folder.
This command pulls the project files from the [template repository](https://github.com/Azure-Samples/functions-quickstart-typescript-azd) and initializes the project in the root folder. The `-e` flag sets a name for the current environment. In `azd`, the environment is used to maintain a unique deployment context for your app, and you can define more than one. It's also used in the name of the resource group you create in Azure.
165
173
166
-
3. Create a file named _local.settings.json_ in the root folder that contains this JSON data:
174
+
1. Create a file named _local.settings.json_ in the root folder that contains this JSON data:
167
175
168
176
```json
169
177
{
@@ -181,14 +189,12 @@ You can use the `azd init` command to create a local Azure Functions code projec
181
189
1. In your local terminal or command prompt, run this `azd init` command in an empty folder:
This pulls the project files from the [template repository](https://github.com/Azure-Samples/functions-quickstart-python-http-azd) and initializes the project in the root folder.
This command pulls the project files from the [template repository](https://github.com/Azure-Samples/functions-quickstart-python-http-azd) and initializes the project in the root folder. The `-e` flag sets a name for the current environment. In `azd`, the environment is used to maintain a unique deployment context for your app, and you can define more than one. It's also used in the name of the resource group you create in Azure.
190
196
191
-
3. Create a file named _local.settings.json_ in the root folder that contains this JSON data:
197
+
1. Create a file named _local.settings.json_ in the root folder that contains this JSON data:
192
198
193
199
```json
194
200
{
@@ -201,15 +207,6 @@ You can use the `azd init` command to create a local Azure Functions code projec
@@ -340,20 +337,90 @@ This `run.ps1` file implements the function code:
340
337
---
341
338
342
339
After you verify your functions locally, it's time to publish them to Azure.
340
+
::: zone pivot="programming-language-java"
341
+
## Create Azure resources
342
+
343
+
This project is configured to use the `azd provision` command to create a function app in a Flex Consumption plan, along with other required Azure resources.
344
+
345
+
>[!NOTE]
346
+
>This project includes a set of Bicep files that `azd` uses to create a secure deployment to a Flex consumption plan that follows best practices.
347
+
>
348
+
>The `azd up` and `azd deploy` commands aren't currently supported for Java apps.
349
+
350
+
1. In the root folder of the project, run this command to create the required Azure resources:
351
+
352
+
```console
353
+
azd provision
354
+
```
355
+
356
+
The root folder contains the `azure.yaml` definition file required by `azd`.
357
+
358
+
If you aren't already signed-in, you're asked to authenticate with your Azure account.
359
+
360
+
1. When prompted, provide these required deployment parameters:
361
+
362
+
| Parameter | Description |
363
+
| ---- | ---- |
364
+
| _Azure subscription_ | Subscription in which your resources are created.|
365
+
| _Azure location_ | Azure region in which to create the resource group that contains the new Azure resources. Only regions that currently support the Flex Consumption plan are shown.|
366
+
367
+
The `azd provision` command uses your response to these prompts with the Bicep configuration files to create and configure these required Azure resources:
368
+
369
+
+ Flex Consumption plan and function app
370
+
+ Azure Storage (required) and Application Insights (recommended)
371
+
+ Access policies and roles for your account
372
+
+ Service-to-service connections using managed identities (instead of stored connection strings)
373
+
+ Virtual network to securely run both the function app and the other Azure resources
374
+
375
+
After the command completes successfully, you can deploy your project code to this new function app in Azure.
376
+
377
+
## Deploy to Azure
378
+
379
+
You can use Core Tools to package your code and deploy it to Azure from the `target` output folder.
380
+
381
+
1. Navigate to the app folder equivalent in the `target` output folder:
382
+
383
+
```console
384
+
cd http/target/azure-functions/contoso-functions
385
+
```
386
+
387
+
This folder should have a host.json file, which indicates that it's the root of your compiled Java function app.
343
388
389
+
1. Run these commands to deploy your compiled Java code project to the new function app resource in Azure using Core Tools:
390
+
391
+
### [bash](#tab/bash)
392
+
393
+
```bash
394
+
APP_NAME=$(azd env get-value AZURE_FUNCTION_NAME)
395
+
func azure functionapp publish $APP_NAME
396
+
```
397
+
398
+
### [Cmd](#tab/cmd)
399
+
```cmd
400
+
for /f "tokens=*" %i in ('azd env get-value AZURE_FUNCTION_NAME') do set APP_NAME=%i
401
+
func azure functionapp publish %APP_NAME%
402
+
```
403
+
404
+
---
405
+
406
+
The `azd env get-value` command gets your function app name from the local environment, which is required for deployment using `func azure functionapp publish`. After publishing completes successfully, you see links to the HTTP trigger endpoints in Azure.
407
+
::: zone-end
408
+
::: zone pivot="programming-language-csharp,programming-language-javascript,programming-language-typescript,programming-language-powershell,programming-language-python"
344
409
## Deploy to Azure
345
410
346
411
This project is configured to use the `azd up` command to deploy this project to a new function app in a Flex Consumption plan in Azure.
347
412
348
413
>[!TIP]
349
414
>This project includes a set of Bicep files that `azd` uses to create a secure deployment to a Flex consumption plan that follows best practices.
350
415
351
-
1. Run this command to create the Azure resources and deploy your app to Azure.
416
+
1. Run this command to have `azd` create the required Azure resources in Azure and deploy your code project to the new function app:
352
417
353
418
```console
354
419
azd up
355
420
```
356
421
422
+
The root folder contains the `azure.yaml` definition file required by `azd`.
423
+
357
424
If you aren't already signed-in, you're asked to authenticate with your Azure account.
358
425
359
426
1. When prompted, provide these required deployment parameters:
@@ -365,25 +432,25 @@ This project is configured to use the `azd up` command to deploy this project to
365
432
366
433
The `azd up` command uses your response to these prompts with the Bicep configuration files to complete these deployment tasks:
367
434
368
-
+ Create and configure these required Azure resources (equivalent to [`azd provision`](/azure/developer/azure-developer-cli/reference#azd-provision)):
435
+
+ Create and configure these required Azure resources (equivalent to `azd provision`):
369
436
370
437
+ Flex Consumption plan and function app
371
438
+ Azure Storage (required) and Application Insights (recommended)
372
439
+ Access policies and roles for your account
373
440
+ Service-to-service connections using managed identities (instead of stored connection strings)
374
441
+ Virtual network to securely run both the function app and the other Azure resources
375
442
376
-
+ Package and deploy your code to the deployment container (equivalent to [`azd deploy`](/azure/developer/azure-developer-cli/reference#azd-deploy)). The app is then started and runs in the deployed package.
377
-
378
-
1. After the command completes successfully, you see links to the resources created.
443
+
+ Package and deploy your code to the deployment container (equivalent to `azd deploy`). The app is then started and runs in the deployed package.
379
444
445
+
After the command completes successfully, you see links to the resources you created.
446
+
::: zone-end
380
447
## Invoke the function on Azure
381
448
382
449
You can now invoke your function endpoints in Azure by making HTTP requests to their URLs using your HTTP test tool or from the browser (for GET requests). When your functions run in Azure, access key authorization is enforced, and you must provide a function access key with your request.
383
450
384
451
You can use the Core Tools to obtain the URL endpoints of your functions running in Azure.
385
452
386
-
1. In your local terminal or command prompt, run this command to get the URL endpoint values, including access keys:
453
+
1. In your local terminal or command prompt, run this command to get the URL endpoint values:
387
454
388
455
### [bash](#tab/bash)
389
456
@@ -403,7 +470,7 @@ You can use the Core Tools to obtain the URL endpoints of your functions running
403
470
The `azd env get-value` command gets your function app name from the local environment. Using the `--show-keys` option means that the returned **Invoke URL:** value for each endpoint includes a function-level access key.
404
471
405
472
1. As before, use your HTTP test tool to validate these URLs in your function app running in Azure.
406
-
473
+
::: zone pivot="programming-language-csharp,programming-language-javascript,programming-language-typescript,programming-language-powershell,programming-language-python"
407
474
## Redeploy your code
408
475
409
476
You can run the `azd up` command as many times as you need to both provision your Azure resources and deploy code updates to your function app.
@@ -412,20 +479,24 @@ You can run the `azd up` command as many times as you need to both provision you
412
479
>Deployed code files are always overwritten by the latest deployment package.
413
480
414
481
Your initial responses to `azd` prompts and any environment variables generated by `azd` are stored locally in your named environment. Use the `azd env get-values` command to review all of the variables in your environment that were used when creating Azure resources.
415
-
482
+
::: zone-end
416
483
## Clean up resources
417
484
418
485
When you're done working with your function app and related resources, you can use this command to delete the function app and its related resources from Azure and avoid incurring any further costs:
419
486
420
487
```console
421
-
azd down
488
+
azd down --no-prompt
422
489
```
423
490
424
-
This command doesn't affect your local code project.
491
+
>[!NOTE]
492
+
>The `--no-prompt` option has `azd` delete your resource group without a confirmation.
493
+
>
494
+
>This command doesn't affect your local code project.
0 commit comments