DevOps.com

  • Latest
    • Articles
    • Features
    • Most Read
    • News
    • News Releases
  • Topics
    • AI
    • Continuous Delivery
    • Continuous Testing
    • Cloud
    • Culture
    • DevSecOps
    • Enterprise DevOps
    • Leadership Suite
    • DevOps Practice
    • ROELBOB
    • DevOps Toolbox
    • IT as Code
  • Videos/Podcasts
    • DevOps Chats
    • DevOps Unbound
  • Webinars
    • Upcoming
    • On-Demand Webinars
  • Library
  • Events
    • Upcoming Events
    • On-Demand Events
  • Sponsored Communities
    • AWS Community Hub
    • CloudBees
    • IT as Code
    • Rocket on DevOps.com
    • Traceable on DevOps.com
    • Quali on DevOps.com
  • Related Sites
    • Techstrong Group
    • Container Journal
    • Security Boulevard
    • Techstrong Research
    • DevOps Chat
    • DevOps Dozen
    • DevOps TV
    • Digital Anarchist
  • Media Kit
  • About
  • AI
  • Cloud
  • Continuous Delivery
  • Continuous Testing
  • DevSecOps
  • Leadership Suite
  • Practices
  • ROELBOB
  • Low-Code/No-Code
  • IT as Code
  • More Topics
    • Application Performance Management/Monitoring
    • Culture
    • Enterprise DevOps

Home » Blogs » Continuous Delivery » Deploying into Azure App Service using Azure DevOps CI/CD Pipeline

Deploying into Azure App Service

Deploying into Azure App Service using Azure DevOps CI/CD Pipeline

By: Srinivas Kudipudi on February 19, 2019 2 Comments

This article demonstrates how to deploy an application into Azure App Service using Azure DevOps (VSTS) continuous integration/continuous delivery (CI/CD) pipeline.

Related Posts
  • Deploying into Azure App Service using Azure DevOps CI/CD Pipeline
  • A Closer Look at Azure DevOps
  • Pre-Commit Job Workflow in Azure DevOps
    Related Categories
  • Blogs
  • Continuous Delivery
    Related Topics
  • application development
  • CI/CD
  • cloud application
  • Microsoft Azure
Show more
Show less

In this article, you’ll create a sample environment to:

DevOps/Cloud-Native Live! Boston
  • New build based on code commit to your Azure DevOps Repo.
  • Automatically deploy your app into Azure.

Prerequisites:

  • Azure Portal Account, Azure subscription and Azure DevOps (VSTS) account.
  • Azure Resource Group.
  • Create a web app in Azure. Make note of the app service URL—you need it later.

What is Azure App Service?

Azure App Service enables you to build and host web apps, mobile backends and RESTful APIs in the programming language of your choice without managing infrastructure. It offers auto-scaling and high availability, supports both Windows and Linux, and enables automated deployments from GitHub, Azure DevOps or any Git repo.

Creating Resource Group in Azure

Once you have a subscription in Azure, you need to create a resource group to manage resources in Azure. The best practice is to maintain a separate resource group for each environment (DEV, INT, QA, STAG, PERF, PROD) and follow the proper naming conventions. To create a resource group, select Resource Group from left-side blade, click on +Add, then select Subscription, give a proper name to the resource group and click on Review + Create.

Creating App Service

Click on All resources from the left-side blade of the panel and click on Add, then select Web App and give a proper name to your app service. Then select Subscription and select the existing resource group. Keep the remaining option as default. and click on Create.

Once you have created the app service, click on that app service and go to Overview. There you can identify all the details that belong to this app service, including status, resource group, subscription and URL (please make a note of this; you’ll need it later).

Creating Service Principal

When an application needs access to deploy or configure resources through ARM or VSTS in Azure, you’ll need to create a service principal, which is a credential for your application.

Go to Azure Active Directory -> App registrations -> New application registration, then give a name to the service principle, select application type and give it a URL of your choice. After creating the app registration, go to Settings from that service and make note of application ID,  then go to Keys create a key and copy the secret value. (Note: It doesn’t appear later, so please store it in safe place.)

 

Create a New Project in VSTS

The first step is to create an account in Azure DevOps (VSTS), then follow the steps below to start an application deployment. Here I’m taking sample open source java-based code from GitHub repository and importing it to Azure DevOps repo. (You can push your own source code into repo.) It is a simple multi-module Maven project. The application is a very simple online version of Conway’s “Game of Life.”

To create a new project, click on Create new project, give a proper name to your project and select create. Then go to Repos, click on Import, then select source type, type in the above URL in the Clone URL tab and select Import. The source code will import into your repository.

We need give service connections to our project, so go to project settings from the bottom of blade in our project home directory and then select Service Connections -> New Service connection -> Azure Resource Manager. Click on “Use the full version of the service connection dialog” from the pop-up, then paste the Application ID into the Service principal client ID tab and the secret key value into the Service principal key tab (which you saved during app registration creation). Then click OK.

Creating a Continuous Integration (CI) Build

Go to Pipelines -> Build -> New Build Pipeline, then click on “Use the visual designer.” It will ask source code repo details, so select Azure Repos Git and select Team project, which you created at the start of the project, select Repository and branch name, then click Continue.

Next, select a template Maven, type in the pipeline name and select Hosted VS2017 for the Agent pool, and click on pom.xml in the Maven POM file. There you can list the goal(s) as Clean Package and select Copy Files. At the contents section please enter **/*.war then go to Publish Artifact: drop, list the artifact name as Gameoflife and keep all remaining options as default values. Then, under Triggers, select Enable continuous integration and give branch filters listed at right, which enables the continuous integration feature. Once a developer commits their changes into master, the CI build will trigger automatically.

Once the configuration is complete, click on Save and Queue from top of pipeline to trigger a CI build. (Every commit into master will trigger a new build.)

Creating Continuous Delivery (CD) Pipeline

 Go to Pipelines -> Releases -> New Release Pipeline, then select the template Azure App Service deployment, list the stage name as DEV and click on Add an artifact. Select project and source (build pipeline), then select default version as Latest, click on Add. Cick on Task (below the DEV), select Run on agent and select agent pool as Hosted VS2017, then click on the plus(+) symbol, search for template File Rename and select the .war file from source file and give it the new name ROOT.war.

In the Display name box, list Azure App Service Deploy. In the Azure subscription field, you need to select a service principal name to authorize the resources. Then choose the App type and App Service name. In the Package or folder selection, select war file and rename it ROOT.war, because for java-based applications we need to deploy our app into a proper directory structure.

Finally, select the template Azure App service manager and select the Restart option, making sure to select the same subscription and app service name you selected in the Azure app service deploy window. Click on Save, then click on Release -> Create a release -> select artifact build number -> create. Build will then trigger and deploy into the app service.

Now, your code is successfully deployed into Azure App Service.

You can access using app service URL from any browser (e.g.,  https://xyz-abc-webjob-01.azurewebsites.net) and you can check whether code is deployed successfully or not using below URL: https://xyz-abc-webjob-01.scm.azurewebsites.net.

— Srinivas Kudipudi

Filed Under: Blogs, Continuous Delivery Tagged With: application development, CI/CD, cloud application, Microsoft Azure

Sponsored Content
Featured eBook
The State of Open Source Vulnerabilities 2020

The State of Open Source Vulnerabilities 2020

Open source components have become an integral part of today’s software applications — it’s impossible to keep up with the hectic pace of release cycles without them. As open source usage continues to grow, so does the number of eyes focused on open source security research, resulting in a record-breaking ... Read More
« DevOps Chat: Serverless and Abstraction with Nimbella’s Anshu Agarwal
SauceCon 2019 Speaker Profile: Wim Selles »

TechStrong TV – Live

Click full-screen to enable volume control
Watch latest episodes and shows

Upcoming Webinars

Building a Successful Open Source Program Office
Tuesday, May 24, 2022 - 11:00 am EDT
LIVE WORKSHOP - Fast, Reliable and Secure Access to Private Web Apps
Tuesday, May 24, 2022 - 3:00 pm EDT
LIVE WORKSHOP - Boost Your Serverless Application Availability With AIOps on AWS
Wednesday, May 25, 2022 - 8:00 am EDT

Latest from DevOps.com

DevOps/Cloud-Native Live Boston: Get Certified, Network and Grow Your Career
May 23, 2022 | Veronica Haggar
GitLab Gets an Overhaul
May 23, 2022 | George V. Hulme
DevOps and Hybrid Cloud: Life in the Fast Lane?
May 23, 2022 | Benjamin Brial
DevSecOps Deluge: Choosing the Right Tools
May 20, 2022 | Gary Robinson
Managing Hardcoded Secrets to Shrink Your Attack Surface 
May 20, 2022 | John Morton

Get The Top Stories of the Week

  • View DevOps.com Privacy Policy
  • This field is for validation purposes and should be left unchanged.

Download Free eBook

Hybrid Cloud Security 101
New call-to-action

Most Read on DevOps.com

DevOps Institute Releases Upskilling IT 2022 Report 
May 18, 2022 | Natan Solomon
Apple Allows 50% Fee Rise | @ElonMusk Fans: 70% Fake | Micro...
May 17, 2022 | Richi Jennings
Making DevOps Smoother
May 17, 2022 | Gaurav Belani
Creating Automated GitHub Bots in Go
May 18, 2022 | Sebastian Spaink
DevSecOps Deluge: Choosing the Right Tools
May 20, 2022 | Gary Robinson

On-Demand Webinars

DevOps.com Webinar ReplaysDevOps.com Webinar Replays
  • Home
  • About DevOps.com
  • Meet our Authors
  • Write for DevOps.com
  • Media Kit
  • Sponsor Info
  • Copyright
  • TOS
  • Privacy Policy

Powered by Techstrong Group, Inc.

© 2022 ·Techstrong Group, Inc.All rights reserved.