pap*_*tty 1 powershell azure azure-cli azure-function-app
我有在本地运行的 powershell 脚本。但是那些脚本没有运行现场函数应用程序 > powershell (windows) 机器。
az login --service-principal -u $ServicePrincipalId -p $ServicePrincipalPass --tenant $ServicePrincipalTenant
当我运行脚本时得到下面
ERROR: The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program.
Run Code Online (Sandbox Code Playgroud)
因为我没有在 Windows 机器上安装 az cli,所以我在我的脚本中添加了以下行来安装 az 命令。
Install-Module -Name Az -AllowClobber -Scope CurrentUser
Run Code Online (Sandbox Code Playgroud)
安装 az 时出现访问问题。
2019-06-11T12:42:59.698 [Warning] WARNING: InternalWebProxy: Could not find a part of the path 'D:\Program Files (x86)\SiteExtensions\Functions\2.0.12507\32bit\workers\powershell\runtimes\win-x86\lib\netcoreapp2.1\ref'.
2019-06-11T12:42:59.843 [Warning] WARNING: Win32Helpers: Could not find a part of the path 'D:\Program Files (x86)\SiteExtensions\Functions\2.0.12507\32bit\workers\powershell\runtimes\win-x86\lib\netcoreapp2.1\ref'.
2019-06-11T12:43:05.023 [Warning] WARNING: User declined to install module (Az).
Run Code Online (Sandbox Code Playgroud)
即使 -Force 也不起作用。需要知道是什么导致了问题。
注意:- 该脚本在本地 Windows 机器上完美运行。问题是当尝试在门户> functionapp> timertrigger 上运行时
附加使用 Windows 机器创建的 azure 函数应用程序
将cli文件夹添加到kudu后出错
> 2019-06-13T12:29:40.510 [Error] ERROR: File
> "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\__init__.py", line 523, in execute Microsoft.Azure.WebJobs.Script.Rpc.RpcException :
> Result: ERROR: File
> "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\__init__.py", line 523, in execute Exception: File
> "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\__init__.py", line 523, in execute
Run Code Online (Sandbox Code Playgroud)
kudu 控制台
由于错误表明您没有在环境中安装 Azure CLI。要安装 Azure CLI,一种可能的方法是将您安装在本地计算机中的整个 CLI 目录复制到您的函数 KUDU 路径/home。
测试中,函数KUDU中的复制路径为D:/home/CLI2/.
测试代码:
D:/home/CLI2/wbin/az.cmd login --service-principal -u 'xxxxxx' -p 'xxxxxx' --tenant 'xxxxxx' | Write-Host
Run Code Online (Sandbox Code Playgroud)
输出截图:
| 归档时间: |
|
| 查看次数: |
6543 次 |
| 最近记录: |