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
Copy file name to clipboardExpand all lines: articles/azure-functions/create-first-function-vs-code-python.md
+8-44Lines changed: 8 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,6 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
75
75
|**Select a template for your project's first function**| Choose `HTTP trigger`.|
76
76
|**Provide a function name**| Enter `HttpExample`.|
77
77
|**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).|
78
-
|**Select how you would like to open your project**| Choose `Open in current window`.|
79
78
80
79
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. For more information about the files that are created, see [Generated project files](functions-develop-vs-code.md?tabs=python#generated-project-files).
81
80
::: zone-end
@@ -86,56 +85,21 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
86
85
|--|--|
87
86
|**Select a language**| Choose `Python (Programming Model V2)`.|
88
87
|**Select a Python interpreter to create a virtual environment**| Choose your preferred Python interpreter. If an option isn't shown, type in the full path to your Python binary.|
89
-
|**Select how you would like to open your project**| Choose `Open in current window`.|
88
+
|**Select a template for your project's first function**| Choose `HTTP trigger`. |
89
+
|**Name of the function you want to create**| Enter `HttpExample`.|
90
+
|**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).|
90
91
91
-
4. Visual Studio Code uses the provided information and generates an Azure Functions project.
92
-
93
-
5. Open the generated `function_app.py` project file, which contains your functions.
94
-
95
-
6. Uncomment the `test_function` function, which is an HTTP triggered function.
96
-
97
-
7. Replace the `app.route()` method call with the following code:
This code enables your HTTP function endpoint to be called in Azure without having to provide an [Authorization keys](functions-bindings-http-webhook-trigger.md#authorization-keys). Local execution doesn't require authorization keys.
104
-
105
-
Your function code should now look like the following example:
logging.info('Python HTTP trigger function processed a request.')
113
-
114
-
name= req.params.get('name')
115
-
ifnot name:
116
-
try:
117
-
req_body= req.get_json()
118
-
exceptValueError:
119
-
pass
120
-
else:
121
-
name= req_body.get('name')
122
-
123
-
if name:
124
-
return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
125
-
else:
126
-
return func.HttpResponse(
127
-
"This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
128
-
status_code=200
129
-
)
130
-
```
92
+
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.
131
93
132
-
8. Open the local.settings.json project fileand updated the `AzureWebJobsStorage` setting asin the following example:
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.
95
+
96
+
6. In the local.settings.json file, update the `AzureWebJobsStorage` setting as in the following example:
This tells the local Functions host to use the storage emulator for the storage connection currently required by the v2 model. When you publish your project to Azure, you'll 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'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.
0 commit comments