微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Azure Functiona 应用程序 - Powershell - 抛出错误但该功能有效 - Az/AZTable

如何解决Azure Functiona 应用程序 - Powershell - 抛出错误但该功能有效 - Az/AZTable

我正在 Azure 上开发一个 powershell 函数。 该代码在我的机器上运行没有任何问题,但是当我尝试在 Azure 上使用相同的代码时,出现以下长错误

2021-05-04T14:56:44.027 [Error] ERROR: Cannot process command because of one or more missing mandatory parameters: Name.Exception :Type : System.Management.Automation.ParameterBindingExceptionMessage : Cannot process command because of one or more missing mandatory parameters: Name.ParameterName : NameErrorId : MissingMandatoryParameterLine : 3Offset : 1CommandInvocation :MyCommand : Import-ModuleScriptLineNumber : 3OffsetInLine : 1HistoryId : 1ScriptName : D:\home\site\wwwroot\MYAPP1\run.ps1Line : Import-ModulePositionMessage : At D:\home\site\wwwroot\MYAPP1\run.ps1:3 char:1+ Import-Module+ ~~~~~~~~~~~~~PSScriptRoot : D:\home\site\wwwroot\MYAPP1PSCommandpath : D:\home\site\wwwroot\MYAPP1\run.ps1InvocationName : Import-ModulePipelineLength : 1PipelinePosition : 1CommandOrigin : InternalErrorRecord :Exception :Type : System.Management.Automation.ParentContainsErrorRecordExceptionMessage : Cannot process command because of one or more missing mandatory parameters: Name.HResult : -2146233087CategoryInfo : InvalidArgument: (:) [Import-Module],ParentContainsErrorRecordExceptionFullyQualifiedErrorId : MissingMandatoryParameter,Microsoft.PowerShell.Commands.ImportModuleCommandInvocationInfo :MyCommand : Import-ModuleScriptLineNumber : 3OffsetInLine : 1HistoryId : 1ScriptName : D:\home\site\wwwroot\MYAPP1\run.ps1Line : Import-ModulePositionMessage : At D:\home\site\wwwroot\MYAPP1\run.ps1:3 char:1+ Import-Module+ ~~~~~~~~~~~~~PSScriptRoot : D:\home\site\wwwroot\MYAPP1PSCommandpath : D:\home\site\wwwroot\MYAPP1\run.ps1CommandOrigin : InternalScriptStackTrace : at <ScriptBlock>,D:\home\site\wwwroot\MYAPP1\run.ps1: line 3TargetSite :Name : PromptForMissingMandatoryParametersDeclaringType : System.Management.Automation.CmdletParameterBinderController,System.Management.Automation,Version=7.0.6.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35MemberType : MethodModule : System.Management.Automation.dllStackTrace :at System.Management.Automation.CmdletParameterBinderController.PromptForMissingMandatoryParameters(Collection`1 fieldDescriptionList,Collection`1 missingMandatoryParameters)at System.Management.Automation.CmdletParameterBinderController.HandleUnboundMandatoryParameters(Int32 validParameterSetCount,Boolean processMissingMandatory,Boolean promptForMandatory,Boolean isPipelineInputExpected,Collection`1& missingMandatoryParameters)at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)at System.Management.Automation.CommandProcessor.BindCommandLineParameters()at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)--- End of stack trace from prevIoUs location where exception was thrown ---at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)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)Data : System.Collections.ListDictionaryInternalSource : System.Management.AutomationHResult : -2146233087CategoryInfo : InvalidArgument: (:) [Import-Module],ParameterBindingExceptionFullyQualifiedErrorId : MissingMandatoryParameter,D:\home\site\wwwroot\MYAPP1\run.ps1: line 3Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException : Result: ERROR: Cannot process command because of one or more missing mandatory parameters: Name.Exception :Type : System.Management.Automation.ParameterBindingExceptionMessage : Cannot process command because of one or more missing mandatory parameters: Name.ParameterName : NameErrorId : MissingMandatoryParameterLine : 3Offset : 1CommandInvocation :MyCommand : Import-ModuleScriptLineNumber : 3OffsetInLine : 1HistoryId : 1ScriptName : D:\home\site\wwwroot\MYAPP1\run.ps1Line : Import-ModulePositionMessage : At D:\home\site\wwwroot\MYAPP1\run.ps1:3 char:1+ Import-Module+ ~~~~~~~~~~~~~PSScriptRoot : D:\home\site\wwwroot\MYAPP1PSCommandpath : D:\home\site\wwwroot\MYAPP1\run.ps1InvocationName : Import-ModulePipelineLength : 1PipelinePosition : 1CommandOrigin : InternalErrorRecord :Exception :Type : System.Management.Automation.ParentContainsErrorRecordExceptionMessage : Cannot process command because of one or more missing mandatory parameters: Name.HResult : -2146233087CategoryInfo : InvalidArgument: (:) [Import-Module],D:\home\site\wwwroot\MYAPP1\run.ps1: line 3Exception: Cannot process command because of one or more missing mandatory parameters: Name.Stack: at System.Management.Automation.CmdletParameterBinderController.PromptForMissingMandatoryParameters(Collection`1 fieldDescriptionList,FunctionContext funcContext)at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)



2021-05-04T14:57:06.367 [Warning] WARNING: INITIALIZATION: Fallback context save mode to process because of error during checking token cache persistence: Could not find file 'D:\home\site\wwwroot\.IdentityService'..

函数自动安装所需的模块(Az 和 AzTable),并在第二条消息后实际工作。

有什么帮助吗?

解决方法

正如您提供的错误消息所说:Cannot process command because of one or more missing mandatory parameters

您需要查看官方文档以确保您提供了所有必需的参数。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。