Azure / Azure/azure-functions-powershell-library

When parsing a PowerShell function, we need a way to specify a session context with modules which are only available to the function app

Open
#43 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2
Forks
10
PR merge metrics
No merged PRs in 30d

Description

Need to be able to specify a context when using Parser.ParseFile (to specify modules available only to the function app).

Currently, when parsing PowerShell files, there is not way to pass a session context. Instead, PowerShell uses a global context. This means that we do no have a way to only specify modules which are only available to the function app. As a workaround right now, we need to install the modules in one of the global paths of `$Env:PSModulePath`.

Our parsing code is located at:

https://github.com/Azure/azure-functions-powershell-library/blob/0577102f7cb97a606637078f2a0be491f469b247/src/WorkerIndexingHelper.cs#L76

This is the PowerShell API that we use the parse the files: https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.parser.parsefile?view=powershellsdk-7.3.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.