Rename an Azure Function

AzureAzure WebjobsAzure FunctionsServerless FrameworkServerless Architecture

Azure Problem Overview


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

Azure Solutions


Solution 1 - Azure

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.

Solution 2 - Azure

Now (2017.10) we can use console to rename the Azure Function name

  1. Open the Console from your Function APP -> Platform features:

Open the console

  1. Rename the Function folder using command line:

Rename the folder

  1. Restart the Function:

Restart the function

  1. Refresh

Refresh

Solution 3 - Azure

Create a new function and you will have an option to name it, then delete the default one(HttpTriggerCSharp1).

I know it's not renaming, but the easiest option around.

enter image description here

Solution 4 - Azure

Go to Function Apps Click on platform features Click on app service editor Right click on your default function name-select

Solution 5 - Azure

Below worked for me.

I wanted to rename my azure function from "HttpTriggerCSharp1" to "my-new-func1"

Go to

Function Apps > 
 My-Function-App > 
  Platform Features TAB > 
   Console >

Run below commands:

cd D:\home\site\wwwroot
move HttpTriggerCSharp1 my-new-func1

Now restart the application:

Function Apps > 
 My-Function-App > 
  Overview TAB > 
   Restart

NOTE: The function 'code' query param changes by doing this.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPawel MagaView Question on Stackoverflow
Solution 1 - Azure4c74356b41View Answer on Stackoverflow
Solution 2 - AzureSLdragonView Answer on Stackoverflow
Solution 3 - AzureAbhijeetView Answer on Stackoverflow
Solution 4 - AzureAmardeep Kumar AgrawalView Answer on Stackoverflow
Solution 5 - AzureManohar Reddy PoreddyView Answer on Stackoverflow