CAN YOU RENAME A FUNCTION IN AN AZURE FUNCTION APP?

Oftentimes we tend to get stuck at things that look really difficult, but are really simple. One of my students was recently playing around with Azure Function Apps and he made a spelling mistake while creating a new function and only realized it later. He tried to find an option to rename the function but he couldn’t find it. So, he chose to delete his function instead and then created a new one. Then later on when he asked me that why does Azure doesn’t give an option to rename a function, I told him that it does. You can change the name of an Azure function if you want to.

There might not be an option visible on the portal but there indeed is an option for it. And so to explain this to him, I showed made him this small demo which I am sure most of you will find helpful as well.

So, here I have a function app called ktfunctionapp. Inside it I have a function with the name IncorrectName. Of course, by looking at the function’s name, you can say that I will have to change it. But how?

If I go to the functions, it shows me these things. I can create a new function there, disable the existing functions, search for specific functions or delete an existing function. But how do I rename a function?

So, in my ktfunctionapp‘s overview, there is another section called Platform features. And inside it, I can find Console under the Development tools. So, first I will have to open it.

It opens something like this. Now, because my Azure function is being hosted on a Windows machine, I can get access to the windows command line.

So here if I type dir, I can see contents of that folder structure. And the function that I have created, the IncorrectName function, is also listed.

So, to rename that function, all I have to do is type ren IncorrectName CorrectName. It will change my current function’s name from IncorrectName to CorrectName.

If I type dir again, I can see the function with the change name.

And if I refresh my function app, the change will be reflected there as well.

That’s how easy it is to rename a function in an Azure function app.