Quick Tip: Rename a Function in an Azure Function App

A function app provides an execution context in Azure in which your functions run. As such, it is the unit of deployment and management for your functions. A function app is comprised of one or more individual functions that are managed, deployed, and scaled together. All of the functions in a function app share the same pricing plan, deployment method, and runtime version. Think of a function app as a way to organize and collectively manage your functions.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference?tabs=blob#function-app

Out of my own struggles to rename the following function, I feel a blog post is deserved.

I have the following function that is created with a default name HttpTrigger2. I didn’t have the option to select any custom name during the creation UI dialogs.

I tried to see if the name can be defined in the function.json, but the Microsoft documentation states this file is about bindings.

The function.json file defines the function’s trigger, bindings, and other configuration settings. Every function has one and only one trigger. The runtime uses this config file to determine the events to monitor and how to pass data into and return data from a function execution.” – https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference?tabs=blob#function-code

So the name can’t be changed here.

So to start, go to Advanced Tools.

Go to Debug Console > CMD

Go to the \home\site\wwwroot\ folder and change the name of the folder that represents the function name.

You will see the folder name change reflected

An alternative way to the command line is to go to the Console blade

When you got back to the function blade you will see the name update after a minute or more. If the name doesn’t change, try to Restart the function app.

Let’s test the function URL in the browser.

You will see the function name updated in the URL path.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s