author | ms.service | ms.topic | ms.date | ms.author |
---|---|---|---|---|
ggailey777 |
azure-functions |
include |
02/19/2020 |
glenga |
Azure Functions Core Tools integrates with Visual Studio Code to let you run and debug an Azure Functions project locally. For details on how to debug in Visual Studio Code, see Debug PowerShell Azure Functions locally.
-
To call your function, press F5 to start the function app project. Output from Core Tools is displayed in the Terminal panel. If you have trouble running on Windows, make sure that the default terminal for Visual Studio Code isn't set to WSL Bash.
-
In the Terminal panel, copy the URL endpoint of your HTTP-triggered function.
-
Append the query string
?name=<yourname>
to this URL, and then useInvoke-RestMethod
in a second PowerShell command prompt to execute the request, as follows:PS > Invoke-RestMethod -Method Get -Uri http://localhost:7071/api/HttpTrigger?name=PowerShell Hello PowerShell
You can also execute the GET request from a browser from the following URL:
http://localhost:7071/api/HttpExample?name=PowerShell
When you call the HttpTrigger endpoint without passing a
name
parameter either as a query parameter or in the body, the function returns aBadRequest
error. When you review the code in run.ps1, you see that this error occurs by design. -
Information about the request is shown in Terminal panel.
-
When done, press Ctrl + C to stop Core Tools.
After you've verified that the function runs correctly on your local computer, it's time to publish the project to Azure.