Debug Azure Function in Visual Studio Code
Prerequisite -
- Azure Function Core Tools to manage function app (https://github.com/Azure/azure-functions-core-tools)
- VS Code (https://code.visualstudio.com/download)
- Start with an empty folder and cmd/power-shell instance must be opened from same.
Visual Studio Code (VS Code) is a code editor by Microsoft.
Its an open source tool available for cross platform development so that an
individual can get same experience across OS like Windows, Mac OS
and Linux.
Today we will try to debug an Azure Function (Java Script) in
VS Code.
Step 1:- Use
below command to initialize a new Function App
func init
Select worker runtime
to node and language to javascript
Step 2:- Add new
function by using command,
func
new
Select template to Http trigger and leave function name as
default. Hit enter
Step 3:- Run your
function app using below command,
func start
Note – Try it by
openning the URL in any browser.
Step 4:- Use
below command to open your app in VS Code.
code .
Step 5:- Follow
steps shown below to configuration VS
Code to enable debugging.
- Hit Debug and Run
- Find DEBUG AND RUN -> Add Configuration
- launch.json file should be opened in editor.
- Select Node.js: Attach to Process
- Save changes
- Follow step 3 to start the function app
- Attached process as shown below,
- Add break point in index.js
- Try the function from any browser.
- The debugger should hit like,












