首页 > 系统相关 >【Azure 应用服务】Azure Powershell Function 出错 The term 'Connect-AzAccount' is not recognized

【Azure 应用服务】Azure Powershell Function 出错 The term 'Connect-AzAccount' is not recognized

时间:2022-11-21 20:46:14浏览次数:60  
标签:Function term AzAccount module Connect Azure Powershell

问题描述

在Azure Function中,执行Powershell的Function脚本时,先后出现

1:[Error] ERROR: The term 'Connect-AzAccount' 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

2:[Error] ERROR: The term 'Set-AzApplicationGatewayAutoscaleConfiguration' 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

 

问题解答

以上错误,和在本地执行Powershell命令一样,就是缺少命令对应的Powershell 模块。 只是PowerShell Function的module配置在文件 requirements.psd1 中, 这个文件在创建Powershell Function时候会自动生成在WWWROOT目录下,可以通过Kudu站点(https://<your function app name>.scm.chinacloudsites.cn/),或者是 App Service Editer 页面进行修改。

如下图:

 

 而 Connect-AzAccount 对应的module为 az.Accounts,  Set-AzApplicationGatewayAutoscaleConfiguration 对应的module为 Az.Network。

只要把这两个Modul加入到 requirements.psd1文件中后,重启Function App即可(重启的目的是为了让Funciton App所在实例安装 Poweshell Module)。

 

参考资料

Connect-AzAccount : https://learn.microsoft.com/en-us/powershell/module/az.accounts/connect-azaccount?view=azps-9.1.0 Set-AzApplicationGatewayAutoscaleConfiguration : https://learn.microsoft.com/en-us/powershell/module/az.network/set-azapplicationgatewayautoscaleconfiguration?view=azps-9.1.0

标签:Function,term,AzAccount,module,Connect,Azure,Powershell
From: https://www.cnblogs.com/lulight/p/16913124.html

相关文章

  • Unity Shader 5 Fixed Function Shader 固定管线Shader
    是相对于可编程的shader而言的。所谓固定管线,是说芯片上一组电路已经固定实现了特定的运算功能,程序能做的只是提供场景数据以及微调运算功能的参数。它适用于所有的显卡,常......
  • JS对象Function和JS对象RegExp1
    JS对象Function:Function:函数(方法)对象1.创建:1.varfun=newFunction(形式参数列表,方法体); //忘掉吧2.function方法名称(形式参数列表){方法体}3.......
  • 【Azure Redis 缓存】Redis 连接失败
    问题描述AzureRedis出现连接失败,过一会儿后,又能自动恢复。 问题解答其实,因为AzureRedis服务一直都有升级维护的操作(平均每月一次),Redis服务更新是平台自动进行的计划内......
  • 【Azure 服务总线】Azure.Messaging.ServiceBus 多次发送消息报超时错误,是否可以配置
    问题描述使用AzureServiceBus,提供应用程序之间松耦合的消息交换,但是有时候发送消息多次出现超时错误。Aconnectionattemptfailedbecausetheconnectedpartydidno......
  • 【Azure 应用服务】Azure Web App 服务默认支持一些 Weak TLS Ciphers Suite,是否有办
    问题描述当AzureWebApp进行安全扫描后,发现依旧支持很多弱TLS加密套件(WeakTLSCiphersSuite),那么是否有办法来关闭这些弱的加密套件呢?在WindowsIIS环境中,可以通过修......
  • ElasticSearch关于term&terms搜索大小写问题
    最近在es使用term查询是,发现查询结果一直为空GET/movies/_doc/100结果:{"_index":"movies","_type":"_doc","_id":"100","_version":1,"_seq_n......
  • Function
    第五章函数内容回顾使用while嵌套实现表格效果使用for循环实现九九乘法表本章内容函数的定义函数的5种方式网页中事件和函数的应用CEMAScript6(js6)中的函数......
  • Windows Terminal 设置
    WindowsTerminal设置文章目录​​WindowsTerminal设置​​​​外观​​​​语言选择​​​​主题深​​​​主题浅​​​​标题栏隐藏与显示​​​​启动​​​​启动......
  • 将class转换为function
    classExample{constructor(name){this.name=name}func(){console.log(this.name)}}/***1.class使用严格模式*2.Example只能通过new调......
  • MobaXterm
    SSH客户端具体是什么哦?比较好用的终端吗?之后用明白了再来补上,先记在这里。嘿嘿。下载链接:​​MobaXterm​​如何使用?​​MobaXterm详细使用教程系列一​​​​No.1MobaXter......