Azure CLI 命令在 azure 函数应用(门户)中不起作用 [英] Azure CLI commands not working inside azure function apps (portal)

查看:23
本文介绍了Azure CLI 命令在 azure 函数应用(门户)中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在本地运行的 powershell 脚本.但是那些脚本没有在现场功能应用程序中运行 > powershell (windows) 机器.

I have powershell scripts which is running locally.But those scripts not running insite function apps > powershell (windows) machine.

az 登录 --service-principal -u $ServicePrincipalId -p$ServicePrincipalPass --tenant $ServicePrincipalTenant

az login --service-principal -u $ServicePrincipalId -p $ServicePrincipalPass --tenant $ServicePrincipalTenant

当我运行脚本时得到下面

Getting below when i run the script

ERROR: The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program.

因为我没有在 windows 机器上安装 az cli,所以我添加了以下行以在我的脚本中安装 az 命令.

since i dont have az cli installed in the windows machine, i have added below line to install az command in my script.

Install-Module -Name Az -AllowClobber  -Scope CurrentUser

在安装 az.

2019-06-11T12:42:59.698 [Warning] WARNING: InternalWebProxy: Could not find a part of the path 'D:Program Files (x86)SiteExtensionsFunctions2.0.1250732bitworkerspowershell
untimeswin-x86lib
etcoreapp2.1
ef'.
2019-06-11T12:42:59.843 [Warning] WARNING: Win32Helpers: Could not find a part of the path 'D:Program Files (x86)SiteExtensionsFunctions2.0.1250732bitworkerspowershell
untimeswin-x86lib
etcoreapp2.1
ef'.
2019-06-11T12:43:05.023 [Warning] WARNING: User declined to install module (Az).

甚至 -Force 不起作用.需要知道是什么导致了问题.

even -Force is not working. need to know what is causing the issue.

注意:- 该脚本在本地 Windows 机器上完美运行.问题是尝试在门户上运行时> functionapp> timertrigger

Note :- The script is perfectly running in local windows machine. the issue is when try to run on portal > functionapp> timertrigger

附加使用windows机器创建的azure函数应用

Attaching azure function app creating with windows machine

将 cli 文件夹添加到 kudu 后出现错误

Getting error after adding cli folder into kudu

> 2019-06-13T12:29:40.510 [Error] ERROR:   File
> "C:UsersVSSADM~1AppDataLocalTemppip-install-68v0_w99azure-cli-coreazureclicorecommands\__init__.py", line 523, in execute Microsoft.Azure.WebJobs.Script.Rpc.RpcException :
> Result: ERROR:   File
> "C:UsersVSSADM~1AppDataLocalTemppip-install-68v0_w99azure-cli-coreazureclicorecommands\__init__.py", line 523, in execute Exception:   File
> "C:UsersVSSADM~1AppDataLocalTemppip-install-68v0_w99azure-cli-coreazureclicorecommands\__init__.py", line 523, in execute

kudu 控制台

推荐答案

由于报错说明你没有在环境中安装Azure CLI.要安装 Azure CLI,一种可能的方法是将安装在本地计算机中的整个 CLI 目录复制到函数 KUDU 路径 /home.

As the error shows that you do not install the Azure CLI in the environment. To install the Azure CLI, a possible way is to copy the whole CLI directory that you installed in the local machine to your function KUDU path /home.

在测试中,函数KUDU中的复制路径为D:/home/CLI2/.

In the test, the copy path in the function KUDU is D:/home/CLI2/.

测试代码:

D:/home/CLI2/wbin/az.cmd login --service-principal -u 'xxxxxx' -p 'xxxxxx' --tenant 'xxxxxx' | Write-Host

输出截图:

这篇关于Azure CLI 命令在 azure 函数应用(门户)中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆