我写了一个使用第三方CMDLET的PowerShell脚本()。
该脚本在我的本地环境上正常工作,但是我需要将其应用于Azure函数以生成每日执行(因为它将数据处理到Azure SQL数据库中)。
在其第一行(请参阅下面的脚本< / em>)上,我建立了出现提示 /弹出窗口的连接参数,当通过用户从local EnviroMnt(PowerShell ISE)进行用户交互时,这很容易anwser(PowerShell ISE)

但是,当我尝试在Azure函数上运行脚本时,以下错误出现:
错误:提示用户失败的命令是因为主机程序或命令类型不支持用户交互。主持人试图用以下消息请求确认:您现在想安装许可证吗? (您可以将“试验”用作激活试用许可证的产品密钥。)< / em>
我需要调整脚本以自动提示 /弹出窗口,或找到其他解决方案。
PowerShell脚本:
Import-Module OdooCmdlets
$odoo = Connect-Odoo -User 'xxxxx' -Password 'xxxx' -URL 'xxxxx' -Database "xxxx"
I have written a powershell script which uses a third party Cmdlet (https://www.powershellgallery.com/packages/OdooCmdlets/21.0.8137.1).
The script is working fine on my local enviroment, but i need to apply it to an Azure Function to generate a daily execution (since it process data into a Azure SQL Database).
On its first line (see script below), i have establish the connection parameters where a prompt / pop-up window appears, which is easy to anwser when via user interaction from a local enviromnt (Powershell ISE)

However, when i try to run the script on the azure function the following error appears:
ERROR: A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Would you like to install a license now? (You may use "TRIAL" as the Product Key to activate a trial license.)
I need to adapt the script in order to auto-anwser the prompt / pop-up window, or find another solution.
Powershell Script:
Import-Module OdooCmdlets
$odoo = Connect-Odoo -User 'xxxxx' -Password 'xxxx' -URL 'xxxxx' -Database "xxxx"
发布评论
评论(1)
我以前从未使用过cmdlet,而从未检查过帮助文件:https://www.powershellgallery.com/packages/OdooCmdlets/21.0.8137.1/Content/lib%5Cnet20%5CCData.OdooCmdlets.Commands.dll-help.xml似乎有一个
-RTK
可用的参数。您是否有可能有一个键可以作为连接的一部分传递的钥匙,以抑制提示?
如果失败,开发人员文档有python的示例,您可以将其转换为powershell,而不使用cdata odoo模块,或者只是在Azure函数中使用Python
https://wwwww.odoo.com/documentation/15.0/developer/misce/misce/misce/misci/external/external_api/external_api.html
I've never used the cmdlets before but inspecting the help files: https://www.powershellgallery.com/packages/OdooCmdlets/21.0.8137.1/Content/lib%5Cnet20%5CCData.OdooCmdlets.Commands.dll-help.xml it appears there is an
-RTK
parameter available.Is it possible you have a key which you can pass as part of the connection which would suppress the prompt?
Failing that, the developer docs have examples for Python which you could either translate to PowerShell and not use the Cdata Odoo module or just use python in your Azure Functions
https://www.odoo.com/documentation/15.0/developer/misc/api/external_api.html