重命名Azure函数 [英] Rename an Azure Function
问题描述
如何重命名 Azure函数?
我想将默认的'HttpTriggerCSharp1'名称替换为我自己的名称.不幸的是,此名称现在包含在函数url中,并且没有更改它的选项:
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
推荐答案
UI不直接支持重命名功能,但是您可以使用以下手动步骤来解决此问题:
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:\home\site\wwwroot and rename the Function folder to the new name
- Now go to D:\home\data\Functions\secrets and rename [oldname].json to [newname].json
- Then go to D:\home\data\Functions\sampledata 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.
对于像我这样来到这里想要重命名其功能的任何人,尽管这是先前的正确答案,但现在有了一个更加流畅的基于CMD的流程,详细信息请参见此答案的更加平滑的基于GUI的过程下面是Amerdeep.
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屋!