Open the program.cs file to add code to your application.
Edit the code to ourput the current datetime. Then save the file.
static void Main(string args)
Console.WriteLine("The current time is " + DateTime.Now);
Time to run your application once again!
Great work! Now go and build some .NET apps!
Now let’s create the console application.
dotnet new console -o myApp
Great! Now make your way to the folder and let’s run the application!
Great work! In the next post we’ll edit some code.
Let’s create a .NET console application
First download and install the .NET SDK from the Microsoft .NET
Next go ahead and check that you’ve installed as expected.
Great work! In the next post we’ll create our own app!
Okey, now with our new update added to another slot let’s finally swap this to our production.
In Azure, select your function app and deployment slots, press Swap and verify the source to destination.
Done and done! Now head over to your root function app url and verify that your deployed Azure function have swapped places.
So now with the Azure Function in Azure we better update our code so it doesn’t say in our local environment.
Create a deployment slot in the Azure portal and give it a name.
Now head over to Visual Studio Code and inside the local project folder change the .cs code to read IN AZURE and save the file.
Right click and deploy to the new slot!
Jump back into Azure and select the deployment slot and fetch the url and append the text and Voila!
You’ve just pushed an new Azure Function app into a dev slot! Remove the -slot1 and you’ll see your old values.
In the final blog post we’ll swap this slot1 to the production slot.
Now let’s upload this function to Azure to use online!
Go into the Azure extension and press on sign in to Azure.
After you have logged in press on the Deploy to function app.
Select create a new function app in Azure, create a global unique name and select a region.
Once done check if it’s complete by pressing the bell button.
Next jump into Azure and get the function URL and check out your function app in Azure!
But wait a minute, now our code is wrong! It’s in Azure right? Let’s push an update in the next blog post!
Last time we had our Azure Function with C# and deployed and tested it. Let’s go into the function code and make a change and pass a query string and watch our function reply.
Go into the project folder and change the text after hello to say
"on my local environment!"
Launch the debugging again and append below to your string.
There you go! Now in the next post we will deploy to Azure!
Last time we installed both the Azure Function extension for Visual Studio Code and the local Azure Functions Core tools. This time we’ll create a local Azure Function and try it out!
In Visual Studio Code select the extension and create a new project and browse and create a new folder.
Select C# as language and select httptrigger as the template.
Finally give it a namespace.
Set the access level to anonymous.
You’ll find the path to your Azure Function running in the console window. Visit the site and enjoy your local Azure Function!
In the next tutorial we will customize the function and change the reply by passing a query string!
With an Azure subscription you get access to alot of free products, with a new Azure account some are free for 12 months and after that you can use more than 25 free products with a limit on the amount of traffic or other limits.
So let’s create a free Azure function that includes at the moment 1 million requests and 400,000 Gbs of resource consumption. You can read more about how to configure Azure Functions
Now first search in Visual Studio Code extensions for Azure Functions and install it.
Next we want to develop locally as well so let’s download and install the Azure Functions Core Tools
Restart Visual Studio Code and next time we will create a local Azure Function!