简体   繁体   English

C# 中的 Azure Function App 是否可以执行命令行应用程序?

[英]Is it possible for an Azure Function App in C# to execute a command line application?

I'm looking to create a Function App in C# with a timer trigger which will occasionally (eg once per day) manipulate our Salesforce environment.我希望在 C# 中创建一个带有计时器触发器的函数应用程序,该触发器偶尔会(例如每天一次)操纵我们的 Salesforce 环境。 Specific tasks may (will) include:具体任务可能(将)包括:

  1. (Re)setting trace flags for Users and Apex Classes. (重新)设置用户和 Apex 类的跟踪标志。
  2. Downloading the debug logs so they can be persisted (and searched).下载调试日志,以便它们可以被持久化(和搜索)。

I'm hoping to do this without reinventing too many wheels.我希望在不重新发明太多轮子的情况下做到这一点。 As Sfdx Cli should be able to do these tasks from the command line, I'm wondering whether/how I can manipulate Sfdx from an Azure C# scheduled function app.由于 Sfdx Cli 应该能够从命令行执行这些任务,我想知道是否/如何从 Azure C# 计划函数应用程序操作 Sfdx。

  • How can I make Sfdx available to whatever "serverless" server is hosting the Function App?如何使 Sfdx 可用于托管 Function App 的任何“无服务器”服务器?
  • How can I tell the Function App where to find it on this server?如何告诉 Function App 在此服务器上的何处找到它?
  • How can I tell the Function App to do something with it by providing some command, including arguments, as might be provided through a command line?我如何通过提供一些命令(包括参数)来告诉 Function App 使用它来做某事,这可能是通过命令行提供的?
  • How can I capture any response(s) which may be provided as console/terminal output, that these response can be parsed?如何捕获可以作为控制台/终端输出提供的任何响应,以便可以解析这些响应?
  • When I use Sfdx Cli to download logs from Salesforce, how can I either store them somewhere (perhaps on blob storage instead of local file storage) or intercept them so the application might do something with the data?当我使用 Sfdx Cli 从 Salesforce 下载日志时,我怎样才能将它们存储在某个地方(可能在 blob 存储而不是本地文件存储上)或拦截它们以便应用程序可以对数据做一些事情?

What you can do is dockerize the function and then deploy it.你可以做的是对函数进行 dockerize,然后部署它。

This will help you to run the console app in the function.这将帮助您在函数中运行控制台应用程序。

Also, you will get all the desired functionality of the function while the dockerization will help you run console app on it.此外,您将获得该功能的所有所需功能,而 dockerization 将帮助您在其上运行控制台应用程序。

You have to bundle the console app with the function app.您必须将控制台应用程序与函数应用程序捆绑在一起。
refer the following documentation on deploying using docker.请参阅以下有关使用 docker 进行部署的文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM