question

AJG-8960 avatar image
0 Votes"
AJG-8960 asked PramodValavala-MSFT answered

changing vs code shell so that azure functions work

I have recently switched computers (both win 10)- and on the new one azure (serverless) functions are not working properly. I am using VS Code, and these functions are written in Python.

This problem is when executing them locally, I do not know if there is a problem when deployed - because I will not attempt to redeploy until the present problem is fixed.

The problem seems to be due to the fact that the VS Code installation on the new machine is configured to use powershell as the shell used when the functions are started locally. In this mode the virtual environment is not activated - because of powershell permission/security issues around running the .venv activate script. Since the virtual environment is not activated, this means that none of the installed site-packages are available to the functions - and everything fails.

I dont want to fix that issue with powershell, I want to setup vs code so that it never uses powershell unless absolutely necessary - I think it is just dreadful. Unfortunately almost all the documentation on how to reset the configuration - back to using cmd.exe - seems to be out of date, configuration settings deprecated and moved, etc.

I have tried switching the default shell back to cmd.exe - but when the azure functions launch locally - it still runs operations using powershell. I have also tried editing the settings file "terminal.integrated.profiles.windows" element - to get rid of powershell, and use cmd.exe - but this doesn't work either.

is there some simple way to fix this - at the moment I am not able to get any azure functions working - I just want powershell gone.

A

azure-functions
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

PramodValavala-MSFT avatar image
0 Votes"
PramodValavala-MSFT answered

@AJG-8960 The setting that defines which shell to use for tasks/debug is terminal.integrated.automationShell.<os> (which defaults to the value of terminal.integrated.defaultProfile.<os>).

Also, look out for a terminal.integrated.shell.<os> in your settings.json which is deprecated but still takes precedence over the new profile-based settings, which is likely forcing PowerShell though the profiles are updated.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.