自定义控制台应用程序可以在 Azure (PowerShell) Runbook 中执行吗?
Can custom console application be executed in Azure (PowerShell) Runbook?
我可以在 Azure Runbook(PowerShell 或任何其他)中使用我的 own/custom 控制台应用程序吗?
当我尝试 运行 我自己的控制台应用程序时(在 之后),它失败了。
当我尝试通过以下方式简单地执行它时:
.\myapp.exe
我得到:
Program 'myapp.exe' failed to run: The operation was canceled by the user
当我使用System.Diagnostics.Process
时:
$process = New-Object System.Diagnostics.Process
$process.StartInfo.FileName = $path
$process.StartInfo.UseShellExecute = $False
$process.Start()
我得到一个更有意义的错误:
Exception calling "Start" with "0" argument(s): "This program is blocked by group policy. For more information, contact
your system administrator"
Azure 自动化中是否有任何设置,我可以切换,以允许执行自定义应用程序?或者在受限的 Runbook 环境中根本不可能?
很遗憾,Azure Automation Runbook 目前不支持它。Here is a feedbackAutomation PG 团队回复,没有更新。
但是你可以
- 运行 控制台应用作为应用服务上的 Azure WebJob,并通过 SCM 端点远程调用它,或者,
将控制台应用程序编译为 PowerShell cmdlet
using System.Management.Automation;
namespace MyApp
{
[Cmdlet(VerbsCommunications.Send, "RunApplication")]
public class RunApplicationCommand : Cmdlet
{
protected override void ProcessRecord()
{
// App Code goes here
}
}
}
- 将已编译的 DLL 附加到 PowerShell 模块
- 使用模块 > 导入将 PowerShell 模型部署到自动化帐户
- 从 Runbook 调用 cmdlet
感谢您与我们联系!不幸的是,目前不支持你在 Azure 自动化 runbook 中请求 运行 .exe。是的,您可以使用 Azure Web 作业。另一位客户最近提出了类似的问题,并通过利用 Azure Web 作业解决了他们的问题。如需说明,您可以参考 this MSDN 线程。希望对你有帮助。
干杯!
我可以在 Azure Runbook(PowerShell 或任何其他)中使用我的 own/custom 控制台应用程序吗?
当我尝试 运行 我自己的控制台应用程序时(在
当我尝试通过以下方式简单地执行它时:
.\myapp.exe
我得到:
Program 'myapp.exe' failed to run: The operation was canceled by the user
当我使用System.Diagnostics.Process
时:
$process = New-Object System.Diagnostics.Process
$process.StartInfo.FileName = $path
$process.StartInfo.UseShellExecute = $False
$process.Start()
我得到一个更有意义的错误:
Exception calling "Start" with "0" argument(s): "This program is blocked by group policy. For more information, contact your system administrator"
Azure 自动化中是否有任何设置,我可以切换,以允许执行自定义应用程序?或者在受限的 Runbook 环境中根本不可能?
很遗憾,Azure Automation Runbook 目前不支持它。Here is a feedbackAutomation PG 团队回复,没有更新。
但是你可以
- 运行 控制台应用作为应用服务上的 Azure WebJob,并通过 SCM 端点远程调用它,或者,
将控制台应用程序编译为 PowerShell cmdlet
using System.Management.Automation; namespace MyApp { [Cmdlet(VerbsCommunications.Send, "RunApplication")] public class RunApplicationCommand : Cmdlet { protected override void ProcessRecord() { // App Code goes here } } }
- 将已编译的 DLL 附加到 PowerShell 模块
- 使用模块 > 导入将 PowerShell 模型部署到自动化帐户
- 从 Runbook 调用 cmdlet
感谢您与我们联系!不幸的是,目前不支持你在 Azure 自动化 runbook 中请求 运行 .exe。是的,您可以使用 Azure Web 作业。另一位客户最近提出了类似的问题,并通过利用 Azure Web 作业解决了他们的问题。如需说明,您可以参考 this MSDN 线程。希望对你有帮助。
干杯!