Wednesday, 6 June 2018

How to DevOps with Azure?

In this article, I will not explain what is and what is not DevOps. I just want to describe how to implement a DevOps Project in your Azure subscription through the new service called “DevOps Projects”. This new service has been released in November 2017. The “DevOps Projects” service allows you to deploy and monitor your application in Azure.
Visual Studio Team Services and Team Foundation Services are Microsoft’s DevOps solutions for Azure. I’m not a VS or TFS expert, but as you will see, implementing DevOps with Azure is very straightforward. Microsoft says that you can implement your project in less than 5 minutes! Let’s see if it’s true.
In the “DevOps Projects” service, you can deploy:
  • DevOps Project for ASP.NET Core
  • DevOps Project for Node.js
  • DevOps Project for Java
  • DevOps Project for Python
  • DevOps Project for PHP
  • DevOps Project for custom code
Deploying a DevOps Project will use VSTS. For those of you who don’t know what is VSTS, here is the Microsoft definition:
VSTS and Team Foundation Server (TFS) both provide an integrated, collaborative environment that supports Git, continuous integration, and Agile tools for planning and tracking work.

AZURE DEVOPS PROJECT

Thanks to Azure « DevOps Project », you can easily create from scratch your pipeline with Azure. Let’s see how it works. First, open the Azure Portal, and search for « DevOps »:
wp-image-7625
As you can notice, the service is still in preview mode. You may encounter some little bugs but after playing with this service during many days, the service works great. So, let’s start by creating the first DevOps Project:
wp-image-7626
First step: you must select the appropriate deployment type for your Application. In my case, I will create a very simple PHP Web App:
wp-image-7627
Remember what I said in the overview of this article: “implementing DevOps with Azure is very straightforward”. You just have to click next, next and finish! Here, you must select an application framework. Depending which deployment type you selected in the previous step, application frameworks will not be the same as the following screenshot:
wp-image-7628
Select an Azure Service to deploy the application. The available options are:
  • Web App for Containers
  • Web App based on Windows
  • Web App based on Linux
Depending your deployment type, you could also deploy your application in a Virtual Machine.
In my case, I will use a Web App based on Windows:
wp-image-7629
Now, you need to provide the following information:
  • VSTS account: If you don’t already have a VSTS account, you must select “Create new” and Azure will create your VSTS account during the deployment.
  • Project name: Type a friendly name for your project.
  • Subscription: Select your Azure subscription in which your DevOps project will be located.
  • App name: Type a FQDN for your Web App. (e.g. http://<fqdn>.azurewebsites.net)
  • App Service Location: Select the location for your App Service
wp-image-7630
Before clicking “Done”, don’t forget to click “Change” in order to configure the other options such as the VSTS location:
wp-image-7631
And click once again “Change” to configure the Azure Web App:
  • Subscription: Select your Azure subscription
  • Resource Group: Create a new Resource Group to store the project
  • App name: Type a FQDN for your Web App. (e.g. http://<fqdn>.azurewebsites.net)
  • App Service location: Select the location for your App Service
  • Pricing tier: Change the Pricing Tier depending your needs (Core and RAM)
  • Application Insights location: Select the location for Application Insights service
wp-image-7632
Click “Create” and in a few minutes, the project dashboard loads in the Azure portal. In my case, Azure will deploy the following components:
  • Microsoft.Insights/components
  • Microsoft.Web/serverfarms
  • Microsoft.Web/sites
  • Microsoft.Web/sites/siteextensions
  • Microsoft.Resources/deployments
Finally, the deployment only took 5 minutes and 28 seconds:
wp-image-7633
Note: You can also deploy DevOps Projects using ARM template. The template can be exported at the end of the process.
StarWind HyperConverged Appliance is a turnkey, entirely software-defined hyperconverged platform purpose-built for intensive virtualization workloads. Bringing the desired performance and reducing downtime, the solution can be deployed by organizations with limited budgets and IT team resources. Also, it requires only one onsite node to deliver HA for your applications that make the solution even more cost-efficient.
Find out more about ➡  StarWind HyperConverged Appliance
Now, let’s focus on the dashboard. This dashboard provides visibility into your code repository, VSTS CI/CD pipeline, and your application in Azure. By default, you will notice only 1 commit in your repository which corresponds to the default page for your Web App. On top of the dashboard, you can navigate to your VSTS project:
  • VSTS Home Page
  • Repositories
  • Build Pipelines
  • Release Pipelines
  • Backlogs
wp-image-7634
On the right side of the dashboard, select Browse to view your running application. In my case, my Web App only contains the default Azure PHP page.
wp-image-7635
Go back to the dashboard and select “Project homepage” to view your VSTS home page.
wp-image-7636
For those of you who need more information about VSTS and TFS, below is the official user guide:
VSTS is the cloud offering that provides a scalable, reliable, and globally available hosted service
Team Foundation Server is the on-premises offering built on a SQL Server backend. Organizations typically choose on-premises TFS when they need their data to stay within your network
Let’s check our DevOps Project in VSTS. The project has been created automatically by Azure and VSTS has created a GIT repository with a default application.
wp-image-7637
Navigate to “Build and Release”, and “Builds”. Here, I can confirm that the build has been created:
wp-image-7638
Now, go to “Build and Release”, and “Releases” and confirm that the release has been created based on the previous build:
wp-image-7639
Ok now, I want to modify my PHP home page and commit the change in my Web App. This step is very easy. You just need to edit the “index.php”, add or replace the existing code:
wp-image-7640
Save the code and click “Commit”.
wp-image-7641
At this step, VSTS will automatically create a new build based on the new code version. Let’s check if a new build has been successfully created:
  • 20180318.1: This build is the initial build created by Azure
  • 20180318.2: This is a new build that will be deployed in my Web App
wp-image-7642
The build is ready to be deployed, so VSTS will automatically create a new release. Let’s confirm that the release has been created based on the previous build:
wp-image-7643
Finally, I can refresh the home page and confirm that my PHP Web App has been successfully updated:
wp-image-7644
I successfully deploy my first DevOps Project. So now, I can create another DevOps project in my VSTS account. To create a new one, I can click “Add”. Here, I added a DevOps Project based on .NET langage:
wp-image-7645
I can notice that a new project called “get-cmd-NET” has been created:
wp-image-7646
Now, if I open my .NET Web App, the default page is displayed. To publish my .NET Application, I just have to follow the same steps as I did for the PHP Web App.
wp-image-7647
After deploying your application, you may want to monitor the application. One interesting feature is Application Insights. Application Insights is an extensible Application Performance Management (APM) service for web developers. It includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your app.

What does Application Insights monitor?

  • Request rates, response times, and failure rates
  • Dependency rates, response times, and failure rates
  • Exceptions
  • Page views and load performance
  • AJAX calls
  • User and session counts
  • Performance counters
  • Host diagnostics
  • Diagnostic trace logs
  • Custom events and metrics
wp-image-7648
When you want to delete a DevOps Project, Azure will remove automatically all the components in your Azure subscription, as well as in your VSTS account. It means that, Work Items, Source Control Items, Builds, Releases, … will be deleted. So be careful!
wp-image-7649

Conclusion

Azure DevOps Projects is a great service. Every IT Pro can use this service, even if you don’t have VSTS/TFS skills. Thanks to Azure DevOps Projects, you can very easily deploy an application in an Azure WebApp / Virtual Machine.
You will save time and developers are autonomous in order to publish applications from scratch in Azure.

No comments:

Post a Comment