When you create an Http triggered API, Azure function hosts it on
https://[function-app-name].azurewebsites.net/api/[Route-configured-in-application]
Is there any way of getting rid of the term api from the URL and make it look like:
https://[function-app-name].azurewebsites.net/[Route-configured-in-application]
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. Note: doing this can lose some historical logging.
In order to get the actual URL of the function go to Azure Portal and find your Azure Function resource. Click on it. You will see an overview where your Azure Function Space is defined. Here you could have more than one actual function.
Import an Azure Function App as a new API Follow the steps below to create a new API from an Azure Function App. Navigate to your API Management service in the Azure portal and select APIs from the menu. In the Add a new API list, select Function App.
The recommended way to disable a function is with an app setting in the format AzureWebJobs. <FUNCTION_NAME>. Disabled set to true . You can create and modify this application setting in a number of ways, including by using the Azure CLI and from your function's Overview tab in the Azure portal.
The Azure Functions v2 solution is covered in this answer, the http bit needs to be wrapped in an extensions property.
{
"version": "2.0",
"extensions": {
"http": {
"routePrefix": "customPrefix"
}
}
}
Edit the host.json file and set routePrefix to empty string:
{
"http": {
"routePrefix": ""
}
}
The accepted answer no longer works if you're using version 2 functions, instead you need to put the http settings in an extensions property:
"extensions": {
"http": {
"routePrefix": ""
}
}
You can get caught out looking at the hosts.json reference because if you only look at the http section it shows just the http properties so make sure to check the start of the doc for the top level hosts.json format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With