我已经创建并成功测试了一个函数应用程序,该应用程序由于遗留库而需要 .net Framework,并且设置为使用运行时版本 ~1。我正在寻找调用 URL 和代码,以帮助自动化部署。
\n\n按照这篇MS 文章并使用azure-functions-core-tools v2 ( npm i -g azure-functions-core-tools@^2),我可以在使用该选项调用发布时看到Invoke Url--verbose。
但是,由于 .net Framework 要求和运行时版本 ~1,我们必须使用azure-functions-core-tools v1 ( npm i -g azure-functions-core-tools@^1)(请参阅此处)。从 func azure functionapp 执行任何命令都会\xe2\x80\x99t 包含调用 Url。该--verbose选项不可用。
>func azure functionapp publish <MyApp>\n\nGetting site publishing info...\nPublish C:\\<MyProject> contents to an Azure Function App. Locally deleted files are not removed from destination.\nCreating archive for current directory...\nUploading archive...\nUpload completed successfully.\n …Run Code Online (Sandbox Code Playgroud) 我知道可以基于 Azure Functions 运行时创建 Docker 容器。本文描述了此过程的一个示例。
\n\n好处是 Azure Functions 可以在任何地方使用 - 如果我愿意,我可以将容器部署到 AWS。
\n\n但我不清楚的地方是:\n当您在 Azure 门户中创建新的 Functions 应用程序时,\xe2\x80\x99 会出现一个标记为 \xe2\x80\x9cPublish\xe2\x80\x9d 的开关,并且它允许选择 \xe2\x80\x9cCode\xe2\x80\x9d 或 \xe2\x80\x9cDocker Container\xe2\x80\x9d。
\n\n如果我选择“Docker Container”,我可以配置要使用的 Docker 映像。这在Microsoft 的文档中有记录。
\n\n我的问题是:
\n\n我想使用 python 语言创建一个 Azure Function App。但我不想使用任何像可视化代码编辑器这样的工具。我想使用azure的内联代码编辑器,因为我的代码不是那么大。
我创建了一个具有以下详细信息的函数应用程序:
publish: code
stack: python
version: 3.7
Region: Central US
OS: Linux
Plan Type: Consumption
Run Code Online (Sandbox Code Playgroud)
但在创建函数应用程序后,它不允许我使用内联编辑器。我收到以下错误
Editing functions in the Azure portal is not supported for Linux Consumption Function Apps.
Run Code Online (Sandbox Code Playgroud) 我在 Jenkins 构建中使用 Azure Cli 将我的nodejsazure 函数部署到 azure。我需要 Kudu 构建 npm 包以减少 Jenkins 端的部署时间。
我有SCM_DO_BUILD_DURING_DEPLOYMENT = trueAzure Functions 配置,但 Azure Cli 在部署工件时明确将其设置为 false!因此,该应用程序将被排除在没有node_modules文件夹的情况下。
我正在使用类似于以下的命令:
az functionapp deployment source config-zip --src artifacts.zip --resource-group MyGroup --subscription MySubscription --name MyFunction --slot pre
知道如何修复它吗?
我正在使用用 NODE JS 编写的 azure 函数。我正在启动本地服务器
func host start
Run Code Online (Sandbox Code Playgroud)
一切正常。但问题是当我更改我的 azure 函数中的某些内容时 - 例如当我添加一个简单的控制台日志时
module.exports = async function (context, req) {
console.log('request came');
context.res = {
body: { success: true, message: null, response: context.bindings.inputDocument }
};
};
Run Code Online (Sandbox Code Playgroud)
服务器没有重新启动,我需要停止服务器再次运行 func host start 以查看更改,这不好。在nodejs中,我们有nodemon,在azure函数中是否有一些东西可以让我监视更改而无需停止并在每次更改时启动服务器?
我尝试了什么
我尝试添加我的 host.json 文件
"watchDirectories": [ "*" ]
Run Code Online (Sandbox Code Playgroud)
但没有成功。
我也尝试过
scripts编辑package.json 文件中的 start 属性
"scripts": {
"start": "start npm run watch & npm run start:host",
"test": "echo \"No tests yet...\""
},
Run Code Online (Sandbox Code Playgroud)
反而
"scripts": {
"start": "func start", …Run Code Online (Sandbox Code Playgroud) 我有一个 Azure Function App,其函数在 blob 触发器上运行。我已经证明这个函数可以通过 Azure 门户运行并响应这个 blob 触发器而不会出现问题......或者至少是这样。
现在我已经添加了使用 EF Core (2.2.4) 的功能,在本地调试和发布到 Azure 时都会出现以下错误:
Microsoft.Azure.WebJobs.Host:索引方法“ParseThings”出错。Microsoft.Azure.WebJobs.Host:无法将参数“context”绑定到 AvastusContext 类型。确保绑定支持参数类型。如果您使用绑定扩展(例如 Azure 存储、ServiceBus、计时器等),请确保您已在启动代码中调用扩展的注册方法(例如 builder.AddAzureStorage()、builder.AddServiceBus( )、builder.AddTimers() 等)。
我Startup按照 Azure Function App 文档的指示开设了一个课程,并且严格按照他们的示例进行操作,除了以下行代替其配置的示例服务之外:
[assembly: FunctionsStartup(typeof(AvstFunctionApp.Startup))]
namespace AvstFunctionApp
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
builder.Services.AddDbContext<AvastusContext>(options => options.UseSqlServer(Environment.GetEnvironmentVariable("AvastusDb")));
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的函数的开头:
public static class ParseThings
{
[FunctionName("ParseThings")]
public static void Run([BlobTrigger("summaries/{name}", Connection = "StorageConnectionString")]Stream myBlob, string name, ILogger log, AvastusContext context)
Run Code Online (Sandbox Code Playgroud)
我可以确认该AddDbContext …
c# azure entity-framework-core asp.net-core azure-function-app
有什么方法可以查看管理门户中函数应用程序中 man 实例的运行情况吗?我尝试查看实时指标,但它只显示传入的请求,而不显示正在运行的实例的数量。
我们在标准应用服务计划中托管了功能应用。为了保护功能应用程序的安全,我们将其集成到 VNet,并仅允许来自 API 管理服务的流量。现在,我们希望允许来自具有函数应用程序端点 Web 挂钩的事件网格(它具有 IoTHub 和 SignalR 订阅)的流量。
我们的一种选择是将所有事件网格 IP 范围列入白名单。我们尝试的第二个选项是允许使用网络安全组的事件网格服务标记。但是,azure 不允许 NSG 中的入站规则到 VNet。除了将所有 Event-Grid IP 范围列入白名单之外,还有其他干净的方法吗?
我已经编写了一个 Azure Funciton API(使用 python 运行时)来自动化我们正在做的一些工作的 git 签入过程(使用 gitPython)。它在我当地的环境中运行良好。但是,当我尝试将其发布到 azure 函数时,API 失败了。
---> Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException: Result: Failure
Exception: ImportError: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
- be included in your $PATH
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- explicitly set via git.refresh()
All git commands will error until this is rectified.
This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one …Run Code Online (Sandbox Code Playgroud) gitpython azure-app-service-plans azure-functions azure-function-app
我创建了 Azure 函数应用程序来执行 powershell 脚本。想先在我的本地运行它来测试它。当我运行它时,无论有没有调试选项,都会出现一个弹出窗口,其中显示:“您必须安装 azure 函数核心工具才能调试本地函数。” 当我单击此弹出窗口上的“安装”时,它似乎自动开始安装 Azure 函数核心工具。
但它停留在某一点 -尝试获取“ https://functionscdn.azureedge.net/public/3.0.2534/Azure.Functions.Cli.win-x64.3.0.2534.zip ”
确认我的网络良好,尝试重新启动电脑并再次按照步骤操作,但没有成功。
其他观察结果是,即使我使用以下命令使用命令提示符手动安装它,
npm install -g azure-functions-core-tools@3
Run Code Online (Sandbox Code Playgroud)
它仍然显示“您必须安装 azure 函数核心工具才能调试本地函数。”
powershell azure azure-functions azure-functions-core-tools azure-function-app
azure ×7
azure-cli ×2
asp.net-core ×1
azure-cli2 ×1
azure-devops ×1
c# ×1
docker ×1
gitpython ×1
node.js ×1
powershell ×1