Azure functions is the idea of events and code, developers will provide the Azure with a function or code and you till what event should trigger that function.
Azure Cloud Services: Developer can also use web roles or Worker roles. Web roles are used for hosting websites and web APIs, and Worker roles are designed for your background tasks, like processing queues and other batch work. So in cloud services all the environment related work is taken care by Microsoft and this model looks perfect for developers
Why do we need Azure Functions?
Server less doesn’t means there are no server involved, of course servers are involved but it’s abstract from the users/developers. But we delegate all the management of the server to Azure instead of us doing it. So we can purely focus on business requirement.
All the big enterprise application relies on the third party platform or backend. For example, for database we might use Azure DocumentDb and for authentication we might use some other third party platform. And with growing number of third party platform service, we might need to write our own custom backend code as per our requirement and that’s were Azure Functions comes to help us. So you can just tell the Azure function which events you need to respond to and you can write your own custom code. So with this comes a new term “Function as a Service (FaaS)”.
Traditionally web application are deployed to the server and published either publicly or internally. Prior to cloud, deploying web application was quite a long and tedious process and you need to have a proper infrastructure to deploy it. But with cloud service its very easy and even cheaper since now you don't have to worry about the infrastructure, everything will be taken care by the service provider. There are some pros and cons to it but this post is more related to deploying it to cloud, so will stick to the topic. So today I will show you how you can deploy the web application to azure using Visual Studio.
Visual Studio 2013 and up
Creating a Azure Web App
Navigate to Azure Portal, and login to your account or sign-up for the trial.
Once you are logged-in, you'll will see plus sign as shown below and clicking on that will give various option as shown below. Select "Web App" and then click "Quick Create".
Enter the valid URL and should be unique and then you need to click on CREATE WEB APP. Verify that site is created and its running.
Now switch to Visual Studio and when you are ready to publish your website, follow the below steps to publish
Download Publishing File
Publish Process in Visual Studio
The Settings page provides you an option to deploy as a Release or Debug as well as a place to define a database. Configure to suit your needs and select “Next >”
Finally the Preview page provides a view of all the files to be uploaded to your Windows Azure Web Site. Click on "Publish".
Visual Studio will give you a log of information as it deploys to Windows Azure. Once the above process is completed, navigate to the url which we created and you will be able to see the website, if there are no build issue.
Congrats, you have deployed your first web application to Azure.
I hope my post was helpful and please share if it was useful to you. Happy Coding.