Skip to content

Commit bb018e8

Browse files
Merge pull request #264712 from ggailey777/freshness
[Functions] VS freshness
2 parents fb5b459 + be5ed39 commit bb018e8

18 files changed

+542
-455
lines changed

articles/azure-app-configuration/quickstart-feature-flag-azure-functions-csharp.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,23 @@ ms.service: azure-app-configuration
77
ms.devlang: csharp
88
ms.custom: devx-track-csharp, mode-other
99
ms.topic: quickstart
10-
ms.date: 3/20/2023
10+
ms.date: 02/17/2024
1111
ms.author: malev
1212
---
1313
# Quickstart: Add feature flags to an Azure Functions app
1414

15-
In this quickstart, you create an Azure Functions app and use feature flags in it. You use the feature management from Azure App Configuration to centrally store all your feature flags and control their states.
15+
In this quickstart, you create an Azure Functions C# code project and use feature flags in it. You use the feature management from Azure App Configuration to centrally store all your feature flags and control their states.
1616

1717
The .NET Feature Management libraries extend the framework with feature flag support. These libraries are built on top of the .NET configuration system. They integrate with App Configuration through its .NET configuration provider.
1818

19+
>[!NOTE]
20+
>This article currently only supports [C# in-process function apps](../azure-functions/functions-dotnet-class-library.md) that run on .NET 6.
21+
1922
## Prerequisites
2023

2124
- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/).
2225
- An App Configuration store. [Create a store](./quickstart-azure-app-configuration-create.md#create-an-app-configuration-store).
2326
- [Visual Studio 2019](https://visualstudio.microsoft.com/vs) with the **Azure development** workload.
24-
- [Azure Functions tools](../azure-functions/functions-develop-vs.md#check-your-tools-version)
2527

2628
## Add a feature flag
2729

@@ -30,9 +32,32 @@ Add a feature flag called *Beta* to the App Configuration store and leave **Labe
3032
> [!div class="mx-imgBorder"]
3133
> ![Enable feature flag named Beta](media/add-beta-feature-flag.png)
3234
33-
## Create a Functions app
35+
## Create a Functions project
36+
37+
The Azure Functions project template in Visual Studio creates a C# class library project that you can publish to a function app in Azure. You can use a function app to group functions as a logical unit for easier management, deployment, scaling, and sharing of resources.
38+
39+
1. From the Visual Studio menu, select **File** > **New** > **Project**.
40+
41+
1. In **Create a new project**, enter *functions* in the search box, choose the **Azure Functions** template, and then select **Next**.
42+
43+
1. In **Configure your new project**, enter a **Project name** for your project, and then select **Create**. The function app name must be valid as a C# namespace, so don't use underscores, hyphens, or any other nonalphanumeric characters.
44+
45+
1. For the **Create a new Azure Functions application** settings, use the values in the following table:
46+
47+
| Setting | Value | Description |
48+
| ------------ | ------- |----------------------------------------- |
49+
| **.NET version** | **.NET 6** | This value creates a function project that runs in-process with version 4.x of the Azure Functions runtime. For more information, see [Azure Functions runtime versions overview](../azure-functions/functions-versions.md). |
50+
| **Function template** | **HTTP trigger** | This value creates a function triggered by an HTTP request. |
51+
| **Storage account (AzureWebJobsStorage)** | **Storage emulator** | Because a function app in Azure requires a storage account, one is assigned or created when you publish your project to Azure. An HTTP trigger doesn't use an Azure Storage account connection string; all other trigger types require a valid Azure Storage account connection string. |
52+
| **Authorization level** | **Anonymous** | The created function can be triggered by any client without providing a key. This authorization setting makes it easy to test your new function. For more information about keys and authorization, see [Authorization keys](../azure-functions/functions-bindings-http-webhook-trigger.md#authorization-keys) and [HTTP and webhook bindings](../azure-functions/functions-bindings-http-webhook.md). |
53+
54+
![Screenshot of Azure Functions project settings](../../includes/media/functions-vs-tools-create/functions-project-settings.png)
55+
56+
---
57+
58+
Make sure you set the **Authorization level** to **Anonymous**. If you choose the default level of **Function**, you're required to present the [function key](../azure-functions/functions-bindings-http-webhook-trigger.md#authorization-keys) in requests to access your function endpoint.
3459

35-
[!INCLUDE [Create a project using the Azure Functions template](../../includes/functions-vstools-create.md)]
60+
1. Select **Create** to create the function project and HTTP trigger function.
3661

3762
## Connect to an App Configuration store
3863

articles/azure-functions/create-first-function-cli-python.md

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Create a Python function from the command line - Azure Functions
33
description: Learn how to create a Python function from the command line, then publish the local project to serverless hosting in Azure Functions.
4-
ms.date: 12/14/2023
4+
ms.date: 02/16/2024
55
ms.topic: quickstart
66
ms.devlang: python
77
ms.custom: devx-track-python, devx-track-azurecli, devx-track-azurepowershell, mode-api, devdivchpfy22
@@ -34,7 +34,7 @@ Before you begin, you must have the following requirements in place:
3434

3535
+ The Azure [Az PowerShell module](/powershell/azure/install-azure-powershell) version 5.9.0 or later.
3636

37-
+ [Python versions that are supported by Azure Functions](supported-languages.md#languages-by-runtime-version).
37+
+ [A Python version supported by Azure Functions](supported-languages.md#languages-by-runtime-version).
3838
::: zone pivot="python-mode-decorators"
3939
+ The [Azurite storage emulator](../storage/common/storage-use-azurite.md?tabs=npm#install-azurite). While you can also use an actual Azure Storage account, the article assumes you're using this emulator.
4040
::: zone-end
@@ -43,7 +43,7 @@ Before you begin, you must have the following requirements in place:
4343

4444
## <a name="create-venv"></a>Create and activate a virtual environment
4545

46-
In a suitable folder, run the following commands to create and activate a virtual environment named `.venv`. Make sure that you're using a [version of Python that is supported by Azure Functions](supported-languages.md?pivots=programming-language-python#languages-by-runtime-version).
46+
In a suitable folder, run the following commands to create and activate a virtual environment named `.venv`. Make sure that you're using a [version of Python supported by Azure Functions](supported-languages.md?pivots=programming-language-python#languages-by-runtime-version).
4747

4848
### [bash](#tab/bash)
4949

@@ -148,16 +148,16 @@ In this section, you create a function project and add an HTTP triggered functio
148148
```
149149

150150
If prompted, choose the **ANONYMOUS** option. [`func new`](functions-core-tools-reference.md#func-new) adds an HTTP trigger endpoint named `HttpExample` to the `function_app.py` file, which is accessible without authentication.
151-
152-
1. Open the local.settings.json project file and verify that the `AzureWebJobsFeatureFlags` setting has a value of `EnableWorkerIndexing`. This is required for Functions to interpret your project correctly as the Python v2 model. You'll add this same setting to your application settings after you publish your project to Azure.
151+
<!--- Remove these last steps after the next Core Tools version is released (4.28.0)--->
152+
1. Open the local.settings.json project file and verify that the `AzureWebJobsFeatureFlags` setting has a value of `EnableWorkerIndexing`. This setting is required for Functions to interpret your project correctly as the Python v2 model when running locally.
153153

154154
1. In the local.settings.json file, update the `AzureWebJobsStorage` setting as in the following example:
155155

156156
```json
157157
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
158158
```
159159

160-
This tells the local Functions host to use the storage emulator for the storage connection currently required by the Python v2 model. When you publish your project to Azure, you'll need to instead use the default storage account. If you're instead using an Azure Storage account, set your storage account connection string here.
160+
This setting tells the local Functions host to use the storage emulator for the storage connection currently required by the Python v2 model. When you publish your project to Azure, you need to instead use the default storage account. If you're instead using an Azure Storage account, set your storage account connection string here.
161161

162162
1. Run this command to make sure that the Azure Functions library is installed in the environment.
163163

@@ -208,7 +208,7 @@ Before you can deploy your function code to Azure, you need to create three reso
208208

209209
Use the following commands to create these items. Both Azure CLI and PowerShell are supported.
210210

211-
1. If you haven't done so already, sign in to Azure.
211+
1. If needed, sign in to Azure.
212212

213213
# [Azure CLI](#tab/azure-cli)
214214
```azurecli
@@ -282,51 +282,27 @@ Use the following commands to create these items. Both Azure CLI and PowerShell
282282
# [Azure CLI](#tab/azure-cli)
283283
284284
```azurecli
285-
az functionapp create --resource-group AzureFunctionsQuickstart-rg --consumption-plan-location westeurope --runtime python --runtime-version 3.9 --functions-version 4 --name <APP_NAME> --os-type linux --storage-account <STORAGE_NAME>
285+
az functionapp create --resource-group AzureFunctionsQuickstart-rg --consumption-plan-location westeurope --runtime python --runtime-version <PYTHON_VERSION> --functions-version 4 --name <APP_NAME> --os-type linux --storage-account <STORAGE_NAME>
286286
```
287287
288-
The [az functionapp create](/cli/azure/functionapp#az-functionapp-create) command creates the function app in Azure. If you're using Python 3.9, 3.8, or 3.7, change `--runtime-version` to `3.9`, `3.8`, or `3.7`, respectively. You must supply `--os-type linux` because Python functions can't run on Windows, which is the default.
288+
The [az functionapp create](/cli/azure/functionapp#az-functionapp-create) command creates the function app in Azure. You must supply `--os-type linux` because Python functions only run on Linux.
289289
290290
# [Azure PowerShell](#tab/azure-powershell)
291291
292292
```azurepowershell
293-
New-AzFunctionApp -Name <APP_NAME> -ResourceGroupName AzureFunctionsQuickstart-rg -StorageAccountName <STORAGE_NAME> -FunctionsVersion 4 -RuntimeVersion 3.9 -Runtime python -Location '<REGION>'
293+
New-AzFunctionApp -Name <APP_NAME> -ResourceGroupName AzureFunctionsQuickstart-rg -StorageAccountName <STORAGE_NAME> -FunctionsVersion 4 -RuntimeVersion <PYTHON_VERSION> -Runtime python -Location '<REGION>'
294294
```
295295
296-
The [New-AzFunctionApp](/powershell/module/az.functions/new-azfunctionapp) cmdlet creates the function app in Azure. If you're using Python 3.9, 3.8, or 3.7, change `-RuntimeVersion` to `3.9`, `3.8`, or `3.7`, respectively.
296+
The [New-AzFunctionApp](/powershell/module/az.functions/new-azfunctionapp) cmdlet creates the function app in Azure.
297297
298298
---
299299
300-
In the previous example, replace `<APP_NAME>` with a globally unique name appropriate to you. The `<APP_NAME>` is also the default DNS domain for the function app.
300+
In the previous example, replace `<APP_NAME>` with a globally unique name appropriate to you. The `<APP_NAME>` is also the default subdomain for the function app. Make sure that the value you set for `<PYTHON_VERSION>` is a [version supported by Functions](supported-languages.md#languages-by-runtime-version) and is the same version you used during local development.
301301
302302
This command creates a function app running in your specified language runtime under the [Azure Functions Consumption Plan](consumption-plan.md), which is free for the amount of usage you incur here. The command also creates an associated Azure Application Insights instance in the same resource group, with which you can monitor your function app and view logs. For more information, see [Monitor Azure Functions](functions-monitoring.md). The instance incurs no costs until you activate it.
303303
304304
[!INCLUDE [functions-publish-project-cli](../../includes/functions-publish-project-cli.md)]
305305
306-
::: zone pivot="python-mode-decorators"
307-
## Update app settings
308-
309-
To use the Python v2 model in your function app, you need to add a new application setting in Azure named `AzureWebJobsFeatureFlags` with a value of `EnableWorkerIndexing`. This setting is already in your local.settings.json file.
310-
311-
Run the following command to add this setting to your new function app in Azure.
312-
313-
# [Azure CLI](#tab/azure-cli)
314-
315-
```azurecli
316-
az functionapp config appsettings set --name <FUNCTION_APP_NAME> --resource-group <RESOURCE_GROUP_NAME> --settings AzureWebJobsFeatureFlags=EnableWorkerIndexing
317-
```
318-
319-
# [Azure PowerShell](#tab/azure-powershell)
320-
321-
```azurepowershell
322-
Update-AzFunctionAppSetting -Name <FUNCTION_APP_NAME> -ResourceGroupName <RESOURCE_GROUP_NAME> -AppSetting @{"AzureWebJobsFeatureFlags" = "EnableWorkerIndexing"}
323-
```
324-
325-
---
326-
327-
In the previous example, replace `<FUNCTION_APP_NAME>` and `<RESOURCE_GROUP_NAME>` with the name of your function app and resource group, respectively. This setting is already in your local.settings.json file.
328-
::: zone-end
329-
330306
## Verify in Azure
331307
332308
Run the following command to view near real-time streaming logs in Application Insights in the Azure portal.

articles/azure-functions/create-first-function-vs-code-python.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Completing this quickstart incurs a small cost of a few USD cents or less in you
2828

2929
There's also a [CLI-based version](create-first-function-cli-python.md) of this article.
3030

31-
This video shows you how to create a Python function in Azure using VS Code.
31+
This video shows you how to create a Python function in Azure using Visual Studio Code.
3232
> [!VIDEO a1e10f96-2940-489c-bc53-da2b915c8fc2]
3333
3434
The steps in the video are also described in the following sections.
@@ -39,7 +39,7 @@ Before you begin, make sure that you have the following requirements in place:
3939

4040
+ An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).
4141

42-
+ Python versions that are [supported by Azure Functions](supported-languages.md#languages-by-runtime-version). For more information, see [How to install Python](https://wiki.python.org/moin/BeginnersGuide/Download).
42+
+ A Python version that is [supported by Azure Functions](supported-languages.md#languages-by-runtime-version). For more information, see [How to install Python](https://wiki.python.org/moin/BeginnersGuide/Download).
4343

4444
+ [Visual Studio Code](https://code.visualstudio.com/) on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms).
4545

@@ -58,7 +58,7 @@ Before you begin, make sure that you have the following requirements in place:
5858

5959
## <a name="create-an-azure-functions-project"></a>Create your local project
6060

61-
In this section, you use Visual Studio Code to create a local Azure Functions project in Python. Later in this article, you'll publish your function code to Azure.
61+
In this section, you use Visual Studio Code to create a local Azure Functions project in Python. Later in this article, you publish your function code to Azure.
6262

6363
1. Choose the Azure icon in the Activity bar. Then in the **Workspace (local)** area, select the **+** button, choose **Create Function** in the dropdown. When prompted, choose **Create new project**.
6464

@@ -90,16 +90,16 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
9090
|**Authorization level**| Choose `ANONYMOUS`, which lets anyone call your function endpoint. For more information about the authorization level, see [Authorization keys](functions-bindings-http-webhook-trigger.md#authorization-keys).|
9191

9292
4. Visual Studio Code uses the provided information and generates an Azure Functions project with an HTTP trigger. You can view the local project files in the Explorer. The generated `function_app.py` project file contains your functions.
93-
94-
5. Open the local.settings.json project file and verify that the `AzureWebJobsFeatureFlags` setting has a value of `EnableWorkerIndexing`. This is required for Functions to interpret your project correctly as the Python v2 model. You'll add this same setting to your application settings after you publish your project to Azure.
93+
<!--- Remove these last steps after the next Core Tools version is released (4.28.0)--->
94+
5. Open the local.settings.json project file and verify that the `AzureWebJobsFeatureFlags` setting has a value of `EnableWorkerIndexing`. This is required for Functions to interpret your project correctly as the Python v2 model when running locally.
9595

9696
6. In the local.settings.json file, update the `AzureWebJobsStorage` setting as in the following example:
9797

9898
```json
9999
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
100100
```
101101

102-
This tells the local Functions host to use the storage emulator for the storage connection currently required by the Python v2 model. When you publish your project to Azure, you'll need to instead use the default storage account. If you're instead using an Azure Storage account, set your storage account connection string here.
102+
This tells the local Functions host to use the storage emulator for the storage connection currently required by the Python v2 model. When you publish your project to Azure, you need to instead use the default storage account. If you're instead using an Azure Storage account, set your storage account connection string here.
103103

104104
## Start the emulator
105105

@@ -110,7 +110,7 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
110110

111111
[!INCLUDE [functions-run-function-test-local-vs-code](../../includes/functions-run-function-test-local-vs-code.md)]
112112

113-
After you've verified that the function runs correctly on your local computer, it's time to use Visual Studio Code to publish the project directly to Azure.
113+
After you verify that the function runs correctly on your local computer, it's time to use Visual Studio Code to publish the project directly to Azure.
114114

115115
[!INCLUDE [functions-sign-in-vs-code](../../includes/functions-sign-in-vs-code.md)]
116116

@@ -153,27 +153,13 @@ In this section, you create a function app and related resources in your Azure s
153153

154154
[!INCLUDE [functions-deploy-project-vs-code](../../includes/functions-deploy-project-vs-code.md)]
155155

156-
::: zone pivot="python-mode-decorators"
157-
## Update app settings
158-
159-
To use the Python v2 model in your function app, you need to add a new application setting in Azure named `AzureWebJobsFeatureFlags` with a value of `EnableWorkerIndexing`. This setting is already in your local.settings.json file.
160-
161-
1. In Visual Studio Code, press <kbd>F1</kbd> to open the command palette. In the command palette, search for and select `Azure Functions: Add New Setting...`.
162-
163-
1. Choose your new function app, type `AzureWebJobsFeatureFlags` for the new app setting name, and press <kbd>Enter</kbd>.
164-
165-
1. For the value, type `EnableWorkerIndexing` and press <kbd>Enter</kbd>.
166-
167-
The setting added to your new function app, which enables it to run the v2 model in Azure.
168-
::: zone-end
169-
170156
[!INCLUDE [functions-vs-code-run-remote](../../includes/functions-vs-code-run-remote.md)]
171157

172158
[!INCLUDE [functions-cleanup-resources-vs-code.md](../../includes/functions-cleanup-resources-vs-code.md)]
173159

174160
## Next steps
175161

176-
You have used [Visual Studio Code](functions-develop-vs-code.md?tabs=python) to create a function app with a simple HTTP-triggered function. In the next articles, you expand that function by connecting to Azure Cosmos DB and Azure Storage. To learn more about connecting to other Azure services, see [Add bindings to an existing function in Azure Functions](add-bindings-existing-function.md?tabs=python).
162+
You created and deployed a function app with a simple HTTP-triggered function. In the next articles, you expand that function by connecting to a storage service in Azure. To learn more about connecting to other Azure services, see [Add bindings to an existing function in Azure Functions](add-bindings-existing-function.md?tabs=python).
177163

178164
> [!div class="nextstepaction"]
179165
> [Connect to Azure Cosmos DB](functions-add-output-binding-cosmos-db-vs-code.md?pivots=programming-language-python)

0 commit comments

Comments
 (0)