Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename an Azure Function

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

image

like image 556
Pawel Maga Avatar asked Nov 17 '16 13:11

Pawel Maga


People also ask

Can I rename an Azure Function?

Renaming an Azure function:To rename it we first need to click on the “Platform features”. Closer to the bottom, which says “Development Tools,” we need to select “Console.” Now, because this Azure function is being hosted on a Windows machine, We can get access to the Windows command line.

How do I change the Azure Function in Visual Studio?

In the Azure portal, browse to your function app. Under Settings, choose Configuration. In the Function runtime settings tab, locate the Runtime version. Note the specific runtime version.

How do I change the name of my app service in Azure?

Answer is No, you can not rename the app service plan once it is created. Alternatively, you can create a new app service plan in the same region and same resource group where your web app exists and then remap your web app to a new app service plan and delete the old one.


1 Answers

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.

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.

like image 166
4c74356b41 Avatar answered Oct 09 '22 03:10

4c74356b41