[英]Azure Functions Error Message: Method not allowed in this pricing tier
我有一個 azure 函數,用於自動與 API 管理進行交互。
所以在 Http Trigger 時,它會創建一個 api 管理用戶。
這是開發人員層,一切正常 - 我已經測試過它和一切。
由於從開發者層切換到消費層,我現在在函數期間收到以下錯誤。
[6/19/2020 2:37:28 AM] ERROR: New-AzApiManagementUser :
[6/19/2020 2:37:28 AM] Error Code: MethodNotAllowedInPricingTier
[6/19/2020 2:37:28 AM] Error Message: Method not allowed in this pricing tier
[6/19/2020 2:37:28 AM] Request Id: d6112a6a-c7ab-4648-85f6-74518c2a1351
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM] At C:\Users\*******\AzureProjects\course_api_mgmt\course_api_mgmt\run.ps1:48 char:13
[6/19/2020 2:37:28 AM] + $user = New-AzApiManagementUser -Context $context -FirstName $use ...
[6/19/2020 2:37:28 AM] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[6/19/2020 2:37:28 AM] + CategoryInfo : CloseError: (Microsoft.Azure.Man\u2026ase.ExecuteCmdlet():ErrorResponseException) [New-AzApiManagementUser], Exception
[6/19/2020 2:37:28 AM] + FullyQualifiedErrorId : Operation returned an invalid status code 'BadRequest',Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands.NewAzureApiManagementUser
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM] Script stack trace:
[6/19/2020 2:37:28 AM] at <ScriptBlock>, C:\Users\*******\AzureProjects\course_api_mgmt\course_api_mgmt\run.ps1: line 48
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM] System.Exception:
[6/19/2020 2:37:28 AM] Error Code: MethodNotAllowedInPricingTier
[6/19/2020 2:37:28 AM] Error Message: Method not allowed in this pricing tier
[6/19/2020 2:37:28 AM] Request Id: d6112a6a-c7ab-4648-85f6-74518c2a1351
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM] Result: ERROR: New-AzApiManagementUser :
[6/19/2020 2:37:28 AM] Error Code: MethodNotAllowedInPricingTier
[6/19/2020 2:37:28 AM] Error Message: Method not allowed in this pricing tier
[6/19/2020 2:37:28 AM] Request Id: d6112a6a-c7ab-4648-85f6-74518c2a1351
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM] At C:\Users\*******\AzureProjects\course_api_mgmt\course_api_mgmt\run.ps1:48 char:13
[6/19/2020 2:37:28 AM] + $user = New-AzApiManagementUser -Context $context -FirstName $use ...
[6/19/2020 2:37:28 AM] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[6/19/2020 2:37:28 AM] + CategoryInfo : CloseError: (Microsoft.Azure.Man\u2026ase.ExecuteCmdlet():ErrorResponseException) [New-AzApiManagementUser], Exception
[6/19/2020 2:37:28 AM] + FullyQualifiedErrorId : Operation returned an invalid status code 'BadRequest',Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands.NewAzureApiManagementUser
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM] Script stack trace:
[6/19/2020 2:37:28 AM] at <ScriptBlock>, C:\Users\*******\AzureProjects\course_api_mgmt\course_api_mgmt\run.ps1: line 48
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM] System.Exception:
[6/19/2020 2:37:28 AM] Error Code: MethodNotAllowedInPricingTier
[6/19/2020 2:37:28 AM] Error Message: Method not allowed in this pricing tier
[6/19/2020 2:37:28 AM] Request Id: d6112a6a-c7ab-4648-85f6-74518c2a1351
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM]
[6/19/2020 2:37:28 AM]
Exception:
[6/19/2020 2:37:28 AM] Error Code: MethodNotAllowedInPricingTier
[6/19/2020 2:37:28 AM] Error Message: Method not allowed in this pricing tier
[6/19/2020 2:37:28 AM] Request Id: d6112a6a-c7ab-4648-85f6-74518c2a1351
[6/19/2020 2:37:28 AM]
Stack: .
[6/19/2020 2:37:29 AM] INFORMATION:
[6/19/2020 2:37:29 AM] ERROR: New-AzApiManagementSubscription : Cannot validate argument on parameter 'UserId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
[6/19/2020 2:37:29 AM] At C:\Users\*******\AzureProjects\course_api_mgmt\course_api_mgmt\run.ps1:61 char:71
[6/19/2020 2:37:29 AM] + ... -AzApiManagementSubscription -Context $context -UserId $user.UserId `
[6/19/2020 2:37:29 AM] + ~~~~~~~~~~~~
[6/19/2020 2:37:29 AM] + CategoryInfo : InvalidData: (:) [New-AzApiManagementSubscription], ParameterBindingValidationException
[6/19/2020 2:37:29 AM] + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands.NewAzureApiManagementSubscription
[6/19/2020 2:37:29 AM]
[6/19/2020 2:37:29 AM] Script stack trace:
[6/19/2020 2:37:29 AM] at <ScriptBlock>, C:\Users\*******\AzureProjects\course_api_mgmt\course_api_mgmt\run.ps1: line 61
[6/19/2020 2:37:29 AM]
[6/19/2020 2:37:29 AM] System.Management.Automation.ParameterBindingValidationException: Cannot validate argument on parameter 'UserId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
[6/19/2020 2:37:29 AM] at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32 parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags
flags)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindParameters(UInt32 parameterSets, Collection`1 arguments)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1 arguments)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
[6/19/2020 2:37:29 AM] at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
[6/19/2020 2:37:29 AM] --- End of stack trace from previous location where exception was thrown ---
[6/19/2020 2:37:29 AM] at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
[6/19/2020 2:37:29 AM] at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
[6/19/2020 2:37:29 AM]
[6/19/2020 2:37:29 AM] Inner exception: System.Management.Automation.ValidationMetadataException: The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
[6/19/2020 2:37:29 AM] at System.Management.Automation.ValidateNotNullOrEmptyAttribute.Validate(Object arguments, EngineIntrinsics engineIntrinsics)
[6/19/2020 2:37:29 AM] at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
[6/19/2020 2:37:29 AM]
[6/19/2020 2:37:29 AM]
[6/19/2020 2:37:29 AM] Result: ERROR: New-AzApiManagementSubscription : Cannot validate argument on parameter 'UserId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
[6/19/2020 2:37:29 AM] At C:\Users\*******\AzureProjects\course_api_mgmt\course_api_mgmt\run.ps1:61 char:71
[6/19/2020 2:37:29 AM] + ... -AzApiManagementSubscription -Context $context -UserId $user.UserId `
[6/19/2020 2:37:29 AM] + ~~~~~~~~~~~~
[6/19/2020 2:37:29 AM] + CategoryInfo : InvalidData: (:) [New-AzApiManagementSubscription], ParameterBindingValidationException
[6/19/2020 2:37:29 AM] + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands.NewAzureApiManagementSubscription
[6/19/2020 2:37:29 AM]
[6/19/2020 2:37:29 AM] Script stack trace:
[6/19/2020 2:37:29 AM] at <ScriptBlock>, C:\Users\Aubrey\AzureProjects\course_api_mgmt\course_api_mgmt\run.ps1: line 61
[6/19/2020 2:37:29 AM]
[6/19/2020 2:37:29 AM] System.Management.Automation.ParameterBindingValidationException: Cannot validate argument on parameter 'UserId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
[6/19/2020 2:37:29 AM] at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32 parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags
flags)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindParameters(UInt32 parameterSets, Collection`1 arguments)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1 arguments)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
[6/19/2020 2:37:29 AM] at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
[6/19/2020 2:37:29 AM] --- End of stack trace from previous location where exception was thrown ---
[6/19/2020 2:37:29 AM] at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
[6/19/2020 2:37:29 AM] at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
[6/19/2020 2:37:29 AM]
[6/19/2020 2:37:29 AM] Inner exception: System.Management.Automation.ValidationMetadataException: The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
[6/19/2020 2:37:29 AM] at System.Management.Automation.ValidateNotNullOrEmptyAttribute.Validate(Object arguments, EngineIntrinsics engineIntrinsics)
[6/19/2020 2:37:29 AM] at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
[6/19/2020 2:37:29 AM]
[6/19/2020 2:37:29 AM]
Exception: Cannot validate argument on parameter 'UserId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
Stack: at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32 parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags
flags)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindParameters(UInt32 parameterSets, Collection`1 arguments)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1 arguments)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
[6/19/2020 2:37:29 AM] at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
[6/19/2020 2:37:29 AM] at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
[6/19/2020 2:37:29 AM] --- End of stack trace from previous location where exception was thrown ---
[6/19/2020 2:37:29 AM] at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
[6/19/2020 2:37:29 AM] at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
[6/19/2020 2:37:29 AM] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame).
[6/19/2020 2:37:29 AM] OUTPUT:
[6/19/2020 2:37:30 AM] Executed 'Functions.course_api_mgmt' (Failed, Id=e500bbdd-bac7-49cc-9076-5ff11c8d440c)
[6/19/2020 2:37:30 AM] System.Private.CoreLib: Exception while executing function: Functions.course_api_mgmt. System.Private.CoreLib: Result: Failure
Exception: Object reference not set to an instance of an object.
Stack: at Microsoft.Azure.Functions.PowerShellWorker.Utility.TypeExtensions.DeriveContentType(HttpResponseContext httpResponseContext, RpcHttp rpcHttp) in C:\projects\azure-functions-powershell-worker\src\Utility\TypeExtensions.cs:line 196
[6/19/2020 2:37:30 AM] at Microsoft.Azure.Functions.PowerShellWorker.Utility.TypeExtensions.ToRpcHttp(HttpResponseContext httpResponseContext) in C:\projects\azure-functions-powershell-worker\src\Utility\TypeExtensions.cs:line 188
[6/19/2020 2:37:30 AM] at Microsoft.Azure.Functions.PowerShellWorker.Utility.TypeExtensions.ToTypedData(Object value) in C:\projects\azure-functions-powershell-worker\src\Utility\TypeExtensions.cs:line 242
[6/19/2020 2:37:30 AM] at Microsoft.Azure.Functions.PowerShellWorker.RequestProcessor.BindOutputFromResult(InvocationResponse response, AzFunctionInfo functionInfo, Hashtable results) in C:\projects\azure-functions-powershell-worker\src\RequestProcessor.cs:line 466
[6/19/2020 2:37:30 AM] at Microsoft.Azure.Functions.PowerShellWorker.RequestProcessor.ProcessInvocationRequestImpl(StreamingMessage request, AzFunctionInfo functionInfo, PowerShellManager psManager, FunctionInvocationPerformanceStopwatch stopwatch) in C:\projects\azure-functions-powershell-worker\src\RequestProcessor.cs:line 306.
你不能。 根據文檔,消費層不支持“直接管理 API”。
https://docs.microsoft.com/en-us/azure/api-management/api-management-features
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.