AZ 的 Azure 自动化帐户 Runbook 错误

Azure Automation Account Runbook error with AZ

尝试设置 Runbook 以缩减应用服务计划的大小时,出现以下错误。我该如何克服这个错误?

我知道我的 PS 有效并且有效。

Set-AzAppServicePlan -Name 'plan-api-dev' -ResourceGroupName 'rg-dev' -Tier S1 -WorkerSize Small

--

System.Management.Automation.CommandNotFoundException: The term 'Set-AzAppServicePlan' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
   at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
   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)

Set-AzAppServicePlan cmdlet 属于 Az.Websites 模块。正如在使用之前将模块导入 Powershell 一样,您需要确保已将 Az.Websites 模块导入到您的自动化帐户中。您可以参考 THIS 文档了解如何操作。