Skip to content

Commit 1e3cfe1

Browse files
committed
tweaks
1 parent ea94310 commit 1e3cfe1

File tree

1 file changed

+34
-17
lines changed

1 file changed

+34
-17
lines changed

articles/azure-functions/how-to-create-function-vs-code.md

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
4141
|--|--|
4242
|**Select a language**|Choose `C#`.|
4343
|**Select a .NET runtime**|Choose `.NET 8.0 LTS`.|
44-
|**Select a template for your project's first function**|Choose `HTTP trigger`.<sup>*</sup>|
44+
|**Select a template for your project's first function**|Choose `HTTP trigger`.|
4545
|**Provide a function name**|Type `HttpExample`.|
4646
|**Provide a namespace** | Type `My.Functions`. |
4747
|**Authorization level**|Choose `Anonymous`, which enables anyone to call your function endpoint. For more information, see [Authorization level](functions-bindings-http-webhook-trigger.md#http-auth).|
@@ -59,10 +59,8 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
5959
| **Provide a version** | Choose `1.0-SNAPSHOT`. |
6060
| **Provide a package name** | Choose `com.function`. |
6161
| **Provide an app name** | Choose `myFunction-12345`. |
62-
|**Select a template for your project's first function**| Choose `HTTP trigger`.<sup>*</sup>|
62+
|**Select a template for your project's first function**| Choose `HTTP trigger`.|
6363
| **Select the build tool for Java project** | Choose `Maven`. |
64-
|**Provide a function name**| Enter `HttpExample`.|
65-
|**Authorization level**| Choose `Anonymous`, which lets anyone call your function endpoint. For more information, see [Authorization level](functions-bindings-http-webhook-trigger.md#http-auth).|
6664
|**Select how you would like to open your project**| Choose `Open in current window`.|
6765

6866
::: zone-end
@@ -72,7 +70,7 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
7270
|--|--|
7371
|**Select a language**|Choose `JavaScript`.|
7472
|**Select a JavaScript programming model**|Choose `Model V4`.|
75-
|**Select a template for your project's first function**|Choose `HTTP trigger`.<sup>*</sup>|
73+
|**Select a template for your project's first function**|Choose `HTTP trigger`.|
7674
|**Provide a function name**|Type `HttpExample`.|
7775
|**Authorization level**|Choose `Anonymous`, which enables anyone to call your function endpoint. For more information, see [Authorization level](functions-bindings-http-webhook-trigger.md#http-auth).|
7876
|**Select how you would like to open your project**|Choose `Open in current window`.|
@@ -84,7 +82,7 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
8482
|--|--|
8583
|**Select a language**|Choose `TypeScript`.|
8684
|**Select a JavaScript programming model**|Choose `Model V4`.|
87-
|**Select a template for your project's first function**|Choose `HTTP trigger`.<sup>*</sup>|
85+
|**Select a template for your project's first function**|Choose `HTTP trigger`.|
8886
|**Provide a function name**|Type `HttpExample`.|
8987
|**Authorization level**|Choose `Anonymous`, which enables anyone to call your function endpoint. For more information, see [Authorization level](functions-bindings-http-webhook-trigger.md#http-auth).|
9088
|**Select how you would like to open your project**|Choose `Open in current window`.|
@@ -96,7 +94,7 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
9694
|--|--|
9795
|**Select a language**| Choose `Python`.|
9896
|**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.|
99-
|**Select a template for your project's first function** | Choose `HTTP trigger`.<sup>*</sup> |
97+
|**Select a template for your project's first function** | Choose `HTTP trigger`. |
10098
|**Name of the function you want to create**| Enter `HttpExample`.|
10199
|**Authorization level**| Choose `ANONYMOUS`, which lets anyone call your function endpoint. For more information, see [Authorization level](functions-bindings-http-webhook-trigger.md#http-auth).|
102100
|**Select how you would like to open your project** | Choose `Open in current window`.|
@@ -107,16 +105,14 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
107105
|Prompt|Selection|
108106
|--|--|
109107
|**Select a language for your function project**|Choose `PowerShell`.|
110-
|**Select a template for your project's first function**|Choose `HTTP trigger`.<sup>*</sup>|
108+
|**Select a template for your project's first function**|Choose `HTTP trigger`.|
111109
|**Provide a function name**|Type `HttpExample`.|
112110
|**Authorization level**|Choose `Anonymous`, which enables anyone to call your function endpoint. For more information, see [Authorization level](functions-bindings-http-webhook-trigger.md#http-auth).|
113111
|**Select how you would like to open your project**|Choose `Open in current window`.|
114112

115113
::: zone-end
116114

117-
<sup>*</sup> Depending on your VS Code settings, you may need to use the `Change template filter` option to see the full list of templates.
118-
119-
Using this information, Visual Studio Code generates an Azure Functions project with an HTTP trigger. You can view the local project files in the Explorer. To learn more about files that are created, see [Generated project files](functions-develop-vs-code.md?tabs=javascript#generated-project-files).
115+
Using this information, Visual Studio Code generates a code project for Azure Functions with an HTTP trigger function endpoint. You can view the local project files in the Explorer. To learn more about files that are created, see [Generated project files](functions-develop-vs-code.md?tabs=javascript#generated-project-files).
120116

121117
::: zone pivot="programming-language-python"
122118
4. In the local.settings.json file, update the `AzureWebJobsStorage` setting as in the following example:
@@ -140,21 +136,42 @@ After you verify that the function runs correctly on your local computer, you ca
140136
## Use AI to normalize and validate input
141137

142138
This is an example prompt for Copilot Chat that updates the existing function code to retrieve parameters from either the query string or JSON body, apply formatting or type conversions, and return them as JSON in the response:
143-
139+
::: zone pivot="programming-language-csharp,programming-language-javascript,programming-language-typescript,programming-language-powershell,programming-language-python"
144140
```copilot-prompt
145-
Modify the function to accept name, email, and age from the JSON body of the request. If any of these parameters are missing from the query string, read them from the JSON body. Return all three parameters in the JSON response, applying these rules:
141+
Modify the function to accept name, email, and age from the JSON body of the
142+
request. If any of these parameters are missing from the query string, read
143+
them from the JSON body. Return all three parameters in the JSON response,
144+
applying these rules:
146145
Title-case the name
147146
Lowercase the email
148147
Convert age to an integer if possible, otherwise return "not provided"
149148
Use sensible defaults if any parameter is missing
150149
```
150+
::: zone-end
151+
::: zone pivot="programming-language-java"
152+
```copilot-prompt
153+
Modify the function to accept name, email, and age from the JSON body of the
154+
request. If any of these parameters are missing from the query string, read
155+
them from the JSON body. Return all three parameters in the JSON response,
156+
applying these rules:
157+
Title-case the name
158+
Lowercase the email
159+
Convert age to an integer if possible, otherwise return "not provided"
160+
Use sensible defaults if any parameter is missing
161+
Update the FunctionTest.java file to test the new logic.
162+
```
163+
::: zone-end
151164

152-
> [!TIP]
153-
> GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs).
165+
You can customize your prompt to add specifics as needed, then run the app again locally and verify that it works as expected after the code changes. This time, use a message body like:
154166

155-
You can customize your prompt to add specifics as needed, then run the app again locally and verify that it works as expected after the code changes. This time, use a message body like `{ "name": "Contoso", "email": "[email protected]", "age": "34" }`.
167+
```json
168+
{ "name": "devon torres", "email": "[email protected]", "age": "34" }
169+
```
156170

157-
If you encounter any errors during execution, paste the error message in the chat window and ask Copilot to help resolve the error. When you are satistfied with your app, you can use Visual Studio Code to publish the project directly to Azure.
171+
> [!TIP]
172+
> GitHub Copilot is powered by AI, so surprises and mistakes are possible. If you encounter any errors during execution, paste the error message in the chat window, select **Agent** mode, and ask Copilot to help resolve the error. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs).
173+
174+
When you are satistfied with your app, you can use Visual Studio Code to publish the project directly to Azure.
158175

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

0 commit comments

Comments
 (0)