重命名 Azure 函数 [英] Rename an Azure Function

查看:21
本文介绍了重命名 Azure 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何重命名 Azure 函数?

我想将默认的 'HttpTriggerCSharp1' 名称替换为我自己的.目前不幸的是,这个名称包含在函数 url 中,并且没有选项可以更改它:

解决方案

UI 不直接支持重命名函数,但您可以使用以下手动步骤解决此问题:

  • 停止您的 Function App.为此,请转到功能应用设置"/转到应用服务设置"下,然后单击停止"按钮.
  • 转到 Kudu 控制台:功能应用设置/转到 Kudu(关于 那个)
  • 在 Kudu 控制台中,进入 D:homesitewwwroot 并将 Function 文件夹重命名为新名称
  • 现在转到 D:homedataFunctionssecrets 并将 [oldname].json 重命名为 [newname].json
  • 然后转到 D:homedataFunctionssampledata 并将 [oldname].dat 重命名为 [newname].dat
  • 在上面停止它的地方启动你的函数应用在 Functions UI 中,单击左上角的刷新按钮,您的重命名函数应该会出现
    注意:这样做可能会丢失一些历史记录.

用于重命名 Azure Function 的 Github 问题


编辑新信息

对于像我一样来到这里希望重命名其函数的任何人,尽管这是以前正确的答案,但现在有一个更顺畅的基于 CMD 的过程,如 此答案 由 SLdragon 提供,并且基于 GUI 的流程更流畅,详见 此答案Amerdeep 下面.

How to rename an Azure Function?

I want to replace a default 'HttpTriggerCSharp1' name to my own. At the moment unfortunately this name is included in the function url and there is no option to change it:

https://functions-xxx.azurewebsites.net/api/HttpTriggerCSharp1

解决方案

The UI does not directly support renaming a Function, but you can work around this using the following manual steps:

  • Stop your Function App. To do this, go under Function app settings / Go To App Service Settings, and click on the Stop button.
  • Go to Kudu Console: Function app settings / Go to Kudu (article about that)
  • In Kudu Console, go to D:homesitewwwroot and rename the Function folder to the new name
  • Now go to D:homedataFunctionssecrets and rename [oldname].json to [newname].json
  • Then go to D:homedataFunctionssampledata and rename [oldname].dat to [newname].dat
  • Start your function app, in the same place where you stopped it above In the Functions UI, click the refresh button in the top left corner, and your renamed function should appear
    Note: doing this can lose some historical logging.

Github Issue for renaming Azure Function


Edit for new info

To anyone like myself that arrived here looking to rename their function, despite this being the previously correct answer, there is now a much smoother CMD based process as detailed in this answer by SLdragon and an even smoother GUI based process detailed in this answer by Amerdeep below.

这篇关于重命名 Azure 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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