I have an Azure Functions project in VS Code using PowerShell where debugging just quit working. What is interesting is that the function window keeps spinning and acts as if it is still starting. You can call the function and it will work, but no breakpoints are hit and the debugging bar with the continue / stop buttons never shows up. The only way I was able to fix this was to uninstall the Azure functions extension, reboot, and reinstall the extension. It worked one time and then the problem came back. In the screenshot I've outlined the "spinner" that normally becomes a checkmark after the function app is running.
1 Answer
I tried running PowerShell Function via debugger and it ran successfully like below:
- Enable Run and Debug:

- Select
Attach to PowerShell Functions:

- This will add below given code to your launch.json set:-
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to PowerShell Functions",
"type": "PowerShell",
"request": "attach",
"customPipeName": "AzureFunctionsPSWorker",
"runspaceId": 1,
"preLaunchTask": "func: host start"
}
]
}
Click fn + f5 or Start debugging to run the Function:-


Try changing the default terminal to command prompt or powershell as mentioned in this SO answer by wilson_smyth
Refer this GitHub issue and SO thread answer.
Refer MSDOC to debug PowerShell functions locally using debugger point with Wait-Debugger attach point.

