How configure Azure function project in Intellij/Pycharm run/debug configurations on mac

3.5k Views Asked by At

How to configure Azure function project in Intellij/Pycharm run/debug configurations on Mac because I've tried to set it by my own but it doesnt work.

I would like to replace shell command: func start with run config

The image below from Pycharm

pycharm-azure config


UPDATE

I've added path to Azure-CLI and imported my app-settings

enter image description here

I'm trying to configure the run configs but it asks to select the module but there is no any module in dropdown (see pic)

intellij-azure config


UPDATE-UPDATE: Here is what azure-tools-for-intellij team me answered:

enter image description here They dont support pure python functions run yet

3

There are 3 best solutions below

0
On BEST ANSWER

I found the way to debug in Intellij Idea/PyCharm.

  1. add these lines at the top of your file/module:
import pydevd_pycharm
pydevd_pycharm.settrace('127.0.0.1', port=9091, stdoutToServer=True, stderrToServer=True)

enter image description here

  1. set Python Debug Server with host and port in Run/Debug Configs Screenshot at Feb 22 20-29-45

  2. run your azure functions as used to (func host start) and press debugging button.

3
On

I think you shouldn't use row shell scrip with IntelliJ/PyCharm instead of this you should use Azure Toolkit for IntelliJ and run/debug your functions like in this guide.

Also when you install Azure Toolkit for IntelliJ you will have the opportunity to create run/debug configuration with predefined Azure Function ready template.

Just example:

enter image description here

0
On

The way I do it in PyCharm is to define a shell script configuration (Edit Configurations > Shell Script) and set:

  • Execute: Script set
  • Script text: func start
  • Working directory: should be to project directory where host.json etc. is located
  • Environment variables: leave empty
  • Execute in the terminal: checked

Run this configuration, which will start the test server in terminal. Then go to Run > Attach to Process... and select the process (usually it's the one without any path after the number).