Repository navigation
Template: AzureFunction - Template not working #222
Copy link
Copy link
Closed
Description
Hi Fred,
I use your PSMDTemplate AzureFunction. The deployment and the function development works great.
PSModuleDevelopment Version: 2.2.13.216
My function is a flexConsumption plan function. I setup everthing like you said in the readme.
@{
General = @{
# Is this Function App deployed to a Flex Consumption plan?
# If so, Managed Dependencies cannot be used and must be* disabled!
# *The build script will handle that for you, if setting this to $true
FlexConsumption = $true
}
TimerTrigger = @{
}
HttpTrigger = @{
<#
AuthLevels:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cfunctionsv2&pivots=programming-language-csharp#http-auth
anonymous: No Token needed (combine with Identity Provider for Entra ID auth without also needing a token)
function: (default) Require a function-endpoint-specific token with the request
admin: Require a Function-App-global admin token (master key) for the request
#>
AuthLevel = 'function'
AuthLevelOverrides = @{
# 'Set-Foo' = 'anonymous'
}
Methods = @('get', 'post')
MethodOverrides = @{
# 'Set-Foo' = 'delete'
}
}
EventGridTrigger = @{
}
}But if I execute one of my Functions I get the following Error:
2026-03-21T14:36:48 [Warning] The Function app may be missing a module containing the 'Get-RestParameter' command definition. If this command belongs to a module available on the PowerShell Gallery, add a reference to this module to requirements.psd1. Make sure this module is compatible with PowerShell 7. For more details, see https://aka.ms/functions-powershell-managed-dependency. If the module is installed but you are still getting this error, try to import the module explicitly by invoking Import-Module just before the command that produces the error: this will not fix the issue but will expose the root cause.
2026-03-21T14:36:48 [Error] ERROR: The term 'Get-RestParameter' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Exception :
Type : System.Management.Automation.CommandNotFoundException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : The term 'Get-RestParameter' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
HResult : -2146233087
TargetObject : Get-RestParameter
CategoryInfo : ObjectNotFound: (Get-RestParameter:String) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : CommandNotFoundException
InvocationInfo :
ScriptLineNumber : 10
OffsetInLine : 15
HistoryId : 1
ScriptName : /home/site/wwwroot/Get-HMTicket/run.ps1
Line : $parameters = Get-RestParameter -Request $Request -Command Get-HMTicket
Statement : Get-RestParameter
PositionMessage : At /home/site/wwwroot/Get-HMTicket/run.ps1:10 char:15
+ $parameters = Get-RestParameter -Request $Request -Command Get-HMTick …
+ ~~~~~~~~~~~~~~~~~
PSScriptRoot : /home/site/wwwroot/Get-HMTicket
PSCommandPath : /home/site/wwwroot/Get-HMTicket/run.ps1
InvocationName : Get-RestParameter
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, /home/site/wwwroot/Get-HMTicket/run.ps1: line 10
CommandName : Get-RestParameter
TargetSite :
Name : LookupCommandInfo
DeclaringType : [System.Management.Automation.CommandDiscovery]
MemberType : Method
Module : System.Management.Automation.dll
Message : The term 'Get-RestParameter' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Data : System.Collections.ListDictionaryInternal
Source : System.Management.Automation
HResult : -2146233087
StackTrace :
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandOrigin commandOrigin, ExecutionContext context)
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandOrigin commandOrigin)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject : Get-RestParameter
CategoryInfo : ObjectNotFound: (Get-RestParameter:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
InvocationInfo :
ScriptLineNumber : 10
OffsetInLine : 15
HistoryId : 1
ScriptName : /home/site/wwwroot/Get-HMTicket/run.ps1
Line : $parameters = Get-RestParameter -Request $Request -Command Get-HMTicket
Statement : Get-RestParameter
PositionMessage : At /home/site/wwwroot/Get-HMTicket/run.ps1:10 char:15
+ $parameters = Get-RestParameter -Request $Request -Command Get-HMTick …
+ ~~~~~~~~~~~~~~~~~
PSScriptRoot : /home/site/wwwroot/Get-HMTicket
PSCommandPath : /home/site/wwwroot/Get-HMTicket/run.ps1
InvocationName : Get-RestParameter
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, /home/site/wwwroot/Get-HMTicket/run.ps1: line 10
2026-03-21T14:36:48 [Warning] WARNING: Get-HMTicket: /home/site/wwwroot/Get-HMTicket/run.ps1:13
2026-03-21T14:36:48 [Warning] WARNING: Line |
2026-03-21T14:36:48 [Warning] WARNING: 13 | $results = Get-HMTicket @parameters -ErrorAction Stop
2026-03-21T14:36:48 [Warning] WARNING: | ~~~~~~~~~~~~
2026-03-21T14:36:48 [Warning] WARNING: | The term 'Get-HMTicket' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2026-03-21T14:36:48 [Warning] WARNING:
2026-03-21T14:36:48 [Warning] WARNING:
2026-03-21T14:36:48 [Warning] The Function app may be missing a module containing the 'Write-FunctionResult' command definition. If this command belongs to a module available on the PowerShell Gallery, add a reference to this module to requirements.psd1. Make sure this module is compatible with PowerShell 7. For more details, see https://aka.ms/functions-powershell-managed-dependency. If the module is installed but you are still getting this error, try to import the module explicitly by invoking Import-Module just before the command that produces the error: this will not fix the issue but will expose the root cause.
2026-03-21T14:36:49 [Error] ERROR: The term 'Write-FunctionResult' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Exception :
Type : System.Management.Automation.CommandNotFoundException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : The term 'Write-FunctionResult' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
HResult : -2146233087
TargetObject : Write-FunctionResult
CategoryInfo : ObjectNotFound: (Write-FunctionResult:String) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : CommandNotFoundException
InvocationInfo :
ScriptLineNumber : 21
OffsetInLine : 2
HistoryId : 1
ScriptName : /home/site/wwwroot/Get-HMTicket/run.ps1
Line : Write-FunctionResult -Status InternalServerError -Body "$_"
Statement : Write-FunctionResult
PositionMessage : At /home/site/wwwroot/Get-HMTicket/run.ps1:21 char:2
+ Write-FunctionResult -Status InternalServerError -Body "$_"
+ ~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : /home/site/wwwroot/Get-HMTicket
PSCommandPath : /home/site/wwwroot/Get-HMTicket/run.ps1
InvocationName : Write-FunctionResult
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, /home/site/wwwroot/Get-HMTicket/run.ps1: line 21
CommandName : Write-FunctionResult
TargetSite :
Name : CheckActionPreference
DeclaringType : [System.Management.Automation.ExceptionHandlingOps]
MemberType : Method
Module : System.Management.Automation.dll
Message : The term 'Write-FunctionResult' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Data : System.Collections.ListDictionaryInternal
Source : System.Management.Automation
HResult : -2146233087
StackTrace :
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject : Write-FunctionResult
CategoryInfo : ObjectNotFound: (Write-FunctionResult:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
InvocationInfo :
ScriptLineNumber : 21
OffsetInLine : 2
HistoryId : 1
ScriptName : /home/site/wwwroot/Get-HMTicket/run.ps1
Line : Write-FunctionResult -Status InternalServerError -Body "$_"
Statement : Write-FunctionResult
PositionMessage : At /home/site/wwwroot/Get-HMTicket/run.ps1:21 char:2
+ Write-FunctionResult -Status InternalServerError -Body "$_"
+ ~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : /home/site/wwwroot/Get-HMTicket
PSCommandPath : /home/site/wwwroot/Get-HMTicket/run.ps1
InvocationName : Write-FunctionResult
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, /home/site/wwwroot/Get-HMTicket/run.ps1: line 21
2026-03-21T14:36:49 [Warning] The Function app may be missing a module containing the 'Write-FunctionResult' command definition. If this command belongs to a module available on the PowerShell Gallery, add a reference to this module to requirements.psd1. Make sure this module is compatible with PowerShell 7. For more details, see https://aka.ms/functions-powershell-managed-dependency. If the module is installed but you are still getting this error, try to import the module explicitly by invoking Import-Module just before the command that produces the error: this will not fix the issue but will expose the root cause.
2026-03-21T14:36:49 [Error] ERROR: The term 'Write-FunctionResult' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Exception :
Type : System.Management.Automation.CommandNotFoundException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : The term 'Write-FunctionResult' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
HResult : -2146233087
TargetObject : Write-FunctionResult
CategoryInfo : ObjectNotFound: (Write-FunctionResult:String) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : CommandNotFoundException
InvocationInfo :
ScriptLineNumber : 24
OffsetInLine : 1
HistoryId : 1
ScriptName : /home/site/wwwroot/Get-HMTicket/run.ps1
Line : Write-FunctionResult -Status OK -Body $results
Statement : Write-FunctionResult
PositionMessage : At /home/site/wwwroot/Get-HMTicket/run.ps1:24 char:1
+ Write-FunctionResult -Status OK -Body $results
+ ~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : /home/site/wwwroot/Get-HMTicket
PSCommandPath : /home/site/wwwroot/Get-HMTicket/run.ps1
InvocationName : Write-FunctionResult
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, /home/site/wwwroot/Get-HMTicket/run.ps1: line 24
CommandName : Write-FunctionResult
TargetSite :
Name : LookupCommandInfo
DeclaringType : [System.Management.Automation.CommandDiscovery]
MemberType : Method
Module : System.Management.Automation.dll
Message : The term 'Write-FunctionResult' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Data : System.Collections.ListDictionaryInternal
Source : System.Management.Automation
HResult : -2146233087
StackTrace :
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandOrigin commandOrigin, ExecutionContext context)
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandOrigin commandOrigin)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject : Write-FunctionResult
CategoryInfo : ObjectNotFound: (Write-FunctionResult:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
InvocationInfo :
ScriptLineNumber : 24
OffsetInLine : 1
HistoryId : 1
ScriptName : /home/site/wwwroot/Get-HMTicket/run.ps1
Line : Write-FunctionResult -Status OK -Body $results
Statement : Write-FunctionResult
PositionMessage : At /home/site/wwwroot/Get-HMTicket/run.ps1:24 char:1
+ Write-FunctionResult -Status OK -Body $results
+ ~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : /home/site/wwwroot/Get-HMTicket
PSCommandPath : /home/site/wwwroot/Get-HMTicket/run.ps1
InvocationName : Write-FunctionResult
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, /home/site/wwwroot/Get-HMTicket/run.ps1: line 24
2026-03-21T14:36:49 [Information] Executed 'Functions.Get-HMTicket' (Succeeded, Id=e3a442d4-0016-4a58-9039-49bd24dd2ef8, Duration=764ms)I searched your GitHub repo and my Template for the functions Write-FunctionResult and Get-RestParameter. Is it a bug in the template or am I doing something wrong on my side?
Greetings
Constantin
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]AzureFunction Function Template not working[/-][+]AzureFunction Template not working[/+][-]AzureFunction Template not working[/-][+]Template: AzureFunction - Template not working[/+]constantinhager commentedon Mar 21, 2026
Talked To Fred. The issue is that the modules Folder is not capitalize. It should be Modules. Now it works. Leave that open till it is Fixed
FriedrichWeinmann commentedon Mar 30, 2026
Fixed with 2.2.12.217