Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Azure Functions

You're reading from  Learning Azure Functions

Product type Book
Published in Sep 2017
Publisher Packt
ISBN-13 9781787122932
Pages 240 pages
Edition 1st Edition
Languages
Concepts

Chapter 7. Managing and Deploying your Code

"Do the difficult things while they are easy and do the great things while they are small. A journey of a thousand miles must begin with a single step."

– Lao Tzu

DevOps is currently one of the most discussed terms at conferences, in technical discussions, team meetings, and in customer engagements too. It is a buzzword nowadays and everyone wants to implement DevOps practices to gain the advantages of them.

Let's be very clear on the definition of DevOps. This term is a combination of development and operations. DevOps is not a tool or a technology or a framework. DevOps is a culture. It is a culture that brings improvement in the outcome and productivity of the resources.

As we have already stated, it is not a tool or technology; however, tools and technology play an important role in the implementation of DevOps practices. Along with tools, technology, and disruptive innovation in information technology, there are two other important aspects that...

Projects in VSTS


We want to achieve CI/CD as depicted in the following diagram:

We will utilize Visual Studio Team Services (VSTS) for Continuous Integration and Continuous Delivery to deploy Azure Functions as and when code changes are committed in the Git repository hosted in VSTS:

  1. First, we will create a project in VSTS so that we can store code and configure Continuous Integration and Continuous Delivery using the build and release definitions:
  2. Visit visualstudio.com and sign in:
  1. On the VSTS dashboard, create a new account or select an existing account.
  2. We already have a few projects available in the dashboard.
  3. Click on New Project:
  1. Provide the details for the Project name, Version control, and Work item process. Click on Create:
  1. Click on Generate Git credentials:
  1. Provide the details as required and click on Save Git Credentials:
  1. Once we have Git set up in the VSTS dashboard, go to the directory where Azure Function code is available.
  2. If Git for Windows is not installed, then install it first...

Continuous Integration


Continuous Integration is one of the most popular and core DevOps practices. Continuous Integration is a practice where code is committed to a shared repository such as Git, and the committed code is verified against static code analysis, automated build, and unit test cases.

  1. Let's create a build definition.
  2. Click on the Git repository and click on Set up build:
  1. Select a template Azure Web Appand click on Apply:
  1. Keep only Get sources and Publish Artifact tasks.
  2. Click on Add Task and add Copy Files task to the Build definition:
  1. We want to copy all the files available from the Azure Functions project.
  2. Provide the details for Target Folder:
  1. Publish Artifact is used to make available files to be used in the Release definition:
  1. In the Triggers section, enable the Continuous Integration trigger. Now, if any new code is checked in, then Continuous Integration will take place:
  1. Click on Save. Our Build definition is ready.

In the next section, we will create the Release definition.

Continuous Delivery


Continuous Delivery is the practice of deploying a package into a non-production environment in an automated manner.

Once our Continuous Integration process is completed successfully, we can deploy a package using the Continuous Delivery practice in an automated way.

  1. Click on the Releases in VSTS.
  1. Click on New definition:
  1. Select the Azure App Service Deployment template and click on Next:
  1. Select the Project and Build definition that we created in the previous section.
  2. Select the Continuous Deployment checkbox.
  1. It means that whenever the associated Build definition is successfully executed, release definition will be triggered automatically. Click on Create:
    • The new Release definition is ready.
    • Let's configure it.
    • We need to configure Azure Subscription first.
  1. Click on Manage:
  1. Click on New Service Endpoint.
  2. Select new Azure Resource Manager:
  1. Provide a Connection name and select Subscription:
  1. Verify the newly created endpoint:
  1. Go to the Release Definitions. Refresh the list of Azure subscriptions...

Summary


DevOps is a culture and it is more effective when people, processes, and technology come along together to change the culture.

In serverless computing too, we can utilize DevOps practices such as Continuous Integration and Continuous Delivery.

In this chapter, we have configured Continuous Integration using the Build definition and Continuous Delivery using the Release definition. We have executed them manually and also configured the Build and Release definitions triggers.

We have also used the Git repository available in VSTS for code management.

In the next chapter, we will discuss the different options available for monitoring, pricing-related details, and best practices.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Learning Azure Functions
Published in: Sep 2017 Publisher: Packt ISBN-13: 9781787122932
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}