Reference module with Functions-specific command declarations
See original GitHub issueWhen authoring PowerShell functions, the Functions-specific commands (such as Push-OutputBinding
, Invoke-ActivityFunction
, etc.) are difficult to discover. The user must find the names and invocation syntax in the documentation and type them in correctly. These commands cannot be discovered interactively via the regular PowerShell means (Get-Help
, Get-Command
), and VSCode cannot help with autocomplete, IntelliSense, etc., which complicates functions authoring.
These commands are defined in an internal module that is automatically loaded by the worker during function execution. However, this module cannot be imported into a standalone PowerShell session because of the dependency on worker’s internals.
What we can do is provide a special reference module containing all the commands with parameters and help text, with a “do-nothing” implementation. We will update this module on adding or changing commands, and we will distribute it together with the PowerShell worker (so it always stays in sync with the actual implementation).
Challenge: it would be great if we could make sure this module automatically loaded when Functions are authored in VSCode. At the same time, we don’t want this module to be loaded into the sessions used for executing Functions code, so including this module into the global PSModulePath is probably not a good idea. In the worst case, we can document manual steps, and this will be an improvement comparing to the current situation, but can we find a better way?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
It’s buried in the azure functions core tools. I imported it here, you can find it relative to the
azure-functions-core-tools
part of the path.ipmo "C:\Users\JGrote\scoop\apps\nodejs-lts\current\bin\node_modules\azure-functions-core-tools\bin\workers\powershell\7\Microsoft.Azure.Functions.PowerShellWorker.dll"
An expanded workaround to get intellisense when developing Azure Functions is to first import the DLL, and then the manifest to also get the script module functions. I wrote a one-liner to find it based on the location of the function core tools (command
func
).