Skip to content

Commit b1f0e3a

Browse files
authored
Update create-first-function-vs-code-python.md
1 parent b42be60 commit b1f0e3a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Create a Python function using Visual Studio Code - Azure Functions
33
description: Learn how to create a Python function, then publish the local project to serverless hosting in Azure Functions using the Azure Functions extension in Visual Studio Code.
44
ms.topic: quickstart
5-
ms.date: 06/26/2025
5+
ms.date: 07/04/2025
66
ms.devlang: python
77
ms.custom: devx-track-python, mode-api, devdivchpfy22, vscode-azure-extension-update-complete, ai-video-demo, copilot-scenario-highlight
88
ai-usage: ai-assisted
@@ -80,19 +80,18 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
8080

8181
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.
8282

83-
## Use AI to validate user input in your function
83+
## Use AI to normalize and validate user input in Azure Functions
8484

85-
You can use AI tools, such as GitHub Copilot in Visual Studio Code, to generate Python code that updates the existing function to handle user data cleaning and validation. You can customize the prompt to add specifics per your requirements.
85+
You can use AI tools, such as GitHub Copilot in Visual Studio Code, to generate Python code that updates the existing function to retrieve parameters from either the query string or JSON body, apply formatting or type conversions, and return them in the JSON response. You can customize the prompt to add specifics per your requirements.
8686

8787
The following text shows an example prompt for Copilot Chat:
8888

8989
```copilot-prompt
90-
Generate Python code to modify current function to build an Azure Function API endpoint that:
91-
Accepts user data: {"name": " john doe ", "email": "[email protected]", "age": 25}
92-
Returns cleaned data: {"name": "John Doe", "email": "[email protected]", "age": 25, "category": "Adult"}
93-
Validates required fields and data formats
94-
Handles errors gracefully with clear messages
95-
Uses POST method and JSON content type
90+
#file:function_app.py Modify the function to accept name, email, and age from either the query parameters or the JSON body of the request, whichever is available. Return all three parameters in the JSON response, applying these rules:
91+
Title-case the name
92+
Lowercase the email
93+
Convert age to an integer, otherwise return "not provided"
94+
Use sensible defaults if any parameter is missing
9695
```
9796

9897
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).
@@ -118,3 +117,7 @@ You created and deployed a function app with a simple HTTP-triggered function. I
118117

119118
[Azure Functions Core Tools]: functions-run-local.md
120119
[Azure Functions extension for Visual Studio Code]: https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions
120+
121+
## Related content
122+
- [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview)
123+
- [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states)

0 commit comments

Comments
 (0)