Have you ever developed Azure Functions and suddenly they vanished into this air?
When you create Azure functions you can create functions in two different ways. You can edit the functions in Azure or you can create the functions in Visual Studio and deploy them to Azure. In this post I’m looking at both options and will described the situation I found myself in a while back when functions vanished into thin air.
First of all I’m going to have a look at the two different ways of creating functions.
Before it is possible to create a function I need to create function app.
The Function App holds all the functions that you create.
Creating a Function in Azure Manually
You can create a new function by clicking on the plus sign next to the Functions section in your function app.
You then get a few options given to create your functions. The In-Portal option is quite nice as you can type your functions and you can see what the functions do without having to refer back to your code.
Then you can select a template
In my case I selected the Webhook option and my function is ready to run. I can call this function from my favourite workflow engine, Microsoft Flow.
Ready to have a look at the other deployment options
Deploying a function to Azure with Visual Studio
It is also possible to publish your Functions to Azure using Visual Studio. This helps if you want to debug some code. You can simply set breakpoints and run the function like you would do with any other code in Visual Studio.
Imagine if you created some Functions in your Function app and you decide to create your next function in Visual Studio.
Great Idea? We will find out!
The steps in Visual Studio are.
Create a new project.
Select the template
Admire the code generated for you.
Now you can publish your function to azure functions.
Now you can publish your function to Azure:
When you click on Ok, you will get a big clue!
The delete existing files is set to true by default. So that when you create all your functions there is no mess left behind from previous versions. A good idea! But if you created some functions in a different way or different project before they will also be removed.
You can change this is the profile settings for your connection by deselecting the Remove additional files at destination setting.