Modifying the Windows Execution Policy on your machine

When trying to set up my machine to run Azure Functions locally using Visual Studio Code, I ran across an error. After generating an empty HTTP-triggered Azure Function and running it, a big red error popped up in the terminal: func : File C:\Users\Hendr\AppData\Roaming\npm\func.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. I happened to try the same thing on a different machine, and got exactly the same behavior. It seems that this is something that you need to resolve yourself on most Windows machines. Browsing to the URL provided in the error message, we get an explanation of what an Execution Policy is exactly: ...

January 6, 2021 · 3 min · Gerry Hendrickx