Download as pdf or txt
Download as pdf or txt
You are on page 1of 290

IIE Module Manual APPR6312

APPLIED PROGRAMMING
MODULE MANUAL 2023
(First Edition: 2020)

This manual enjoys copyright under the Berne Convention. In terms of the Copyright
Act, no 98 of 1978, no part of this manual may be reproduced or transmitted in any
form or by any means, electronic or mechanical, including photocopying, recording or
by any other information storage and retrieval system without permission in writing
from the proprietor.

The Independent Institute of Education (Pty) Ltd is registered with the


Department of Higher Education and Training as a private higher
education institution under the Higher Education Act, 1997 (reg. no.
2007/HE07/002). Company registration number: 1987/004754/07.

© The Independent Institute of Education (Pty) Ltd 2023 Page 1 of 290


IIE Module Manual APPR6312

DID YOU KNOW?

Student Portal

The full-service Student Portal provides you with access to your academic
administrative information, including:
• an online calendar,
• timetable,
• academic results,
• module content,
• financial account, and so much more!

Module Guides or Module Manuals

When you log into the Student Portal, the ‘Module Information’ page displays the
‘Module Purpose’ and ‘Textbook Information’ including the online ‘Module Guides or
‘Module Manuals’ and assignments for each module for which you are registered.

Supplementary Materials

For certain modules, electronic supplementary material is available to you via the
‘Supplementary Module Material’ link.

Module Discussion Forum

The ‘Module Discussion Forum’ may be used by your lecturer to discuss any topics
with you related to any supplementary materials and activities such as ICE, etc.

To view, print and annotate these related PDF documents, download Adobe
Reader at following link below:
www.adobe.com/products/reader.html

© The Independent Institute of Education (Pty) Ltd 2023 Page 2 of 290


IIE Module Manual APPR6312

IIE Library Online Databases

The following Library Online Databases are available. These links will prompt you for
a username and password. Use the same username and password as for student
portal. Please contact your librarian if you are unable to access any of these. Here
are links to some of the databases:

Library Website This library website gives access to various online


resources and study support guides
[Link]

LibraryConnect The Online Public Access Catalogue. Here you will be


(OPAC) able to search for books that are available in all the IIE
campus libraries.
[Link]

EBSCOhost This database contains full text online articles.


[Link]

EBSCO eBook This database contains full text online eBooks.


Collection [Link]

SABINET This database will provide you with books available in


other libraries across South Africa.
[Link]

DOAJ DOAJ is an online directory that indexes and provides


access to high quality, open access, peer-reviewed
journals.
[Link]

DOAB Directory of open access books.


[Link]

IIESPACE The IIE open access research repository


[Link]

Emerald Emerald Insight


[Link]

HeinOnline Law database


[Link]

JutaStat Law database


[Link]

© The Independent Institute of Education (Pty) Ltd 2023 Page 3 of 290


IIE Module Manual APPR6312

Table of Contents
Introduction………………………………………………………………………………….11
This Module at a Glance ......................................................................................... 12
Conventions Used in this Manual ............................................................................ 13
Glossary……………………………………………………………………………………..14
Learning Unit 1: Software Development Methodologies……………………………….17
1 Introduction…………………………………………………………………………….17
1.1.1 Advantages ........................................................................................ 20
1.1.2 Disadvantages ................................................................................... 20
1.2 Rational Unified Process ........................................................................... 20
1.2.1 Advantages ........................................................................................ 21
1.2.2 Disadvantages ................................................................................... 21
1.3 Agile Manifesto ......................................................................................... 21
1.4 Extreme Programming .............................................................................. 23
1.4.1 Advantages ........................................................................................ 24
1.4.2 Disadvantages ................................................................................... 25
1.5 Other Agile Methodologies ........................................................................ 25
2 Scrum…………………………………………………………………………………..26
2.1 Framework, Not a Methodology ................................................................ 26
2.2 Values ....................................................................................................... 27
2.3 Principles .................................................................................................. 27
2.3.1 Empirical Process Control .................................................................. 28
2.3.2 Self-Organisation ............................................................................... 28
2.3.3 Collaboration ...................................................................................... 28
2.3.4 Value-based Prioritisation ................................................................... 28
2.3.5 Time-boxing ....................................................................................... 28
2.3.6 Iterative Development ........................................................................ 29
2.4 Team......................................................................................................... 29
2.4.1 Product Owner ................................................................................... 29
2.4.2 Development Team ............................................................................ 29
2.4.3 Scrum Master ..................................................................................... 29
2.5 Events ....................................................................................................... 30
2.5.1 Sprint Planning ................................................................................... 31
2.5.2 Daily Stand-up/Daily Scrum ............................................................... 31
2.5.3 Sprint Review Meeting ....................................................................... 31
2.5.4 Sprint Retrospective Meeting ............................................................. 31
2.6 Artifacts ..................................................................................................... 32
3 Kanban…………………………………………………………………………………32
3.1 Principles .................................................................................................. 32
3.2 Practices ................................................................................................... 33
3.2.1 Visualise............................................................................................. 33
3.2.2 Make Policies Explicit ......................................................................... 34
3.2.3 Implement Feedback Loops ............................................................... 34
3.2.4 Limit Work-in-Progress (WIP) ............................................................. 34
3.2.5 Improve Collaboratively, Evolve Experimentally ................................. 34
3.2.6 Manage Flow ..................................................................................... 34

© The Independent Institute of Education (Pty) Ltd 2023 Page 4 of 290


IIE Module Manual APPR6312

3.3 Benefits ..................................................................................................... 34


3.4 What is Scrumban? ................................................................................... 35
4 Azure Boards…………………………………………………………………………..35
4.1 Why use Azure Boards?............................................................................ 35
4.2 Organisations, Projects and Teams........................................................... 36
4.2.1 Signing Up for Azure DevOps............................................................. 36
4.2.2 Organisations ..................................................................................... 37
4.2.3 Projects .............................................................................................. 39
4.2.4 Project Settings .................................................................................. 42
4.2.5 Teams ................................................................................................ 45
4.3 Setting Up Sprints ..................................................................................... 49
4.4 Work Items ................................................................................................ 52
4.4.1 Project Processes and Work Item Types ............................................ 52
4.4.2 Creating a Work Item ......................................................................... 55
4.4.3 Setting the Parent Task ...................................................................... 57
4.4.4 Using Backlogs .................................................................................. 59
4.5 Managing Capacity ................................................................................... 59
4.5.1 Setting Capacity Limits ....................................................................... 59
4.5.2 Assigning Tasks to Team Members .................................................... 60
4.6 Kanban Boards ......................................................................................... 63
4.6.1 Using Boards ..................................................................................... 63
4.6.2 Customising Boards ........................................................................... 65
4.7 Using Dashboards..................................................................................... 67
5 Recommended Additional Reading…………………………………………………69
5.1 Lean Start-up ............................................................................................ 69
5.2 Scrum ....................................................................................................... 69
5.3 Kanban ..................................................................................................... 69
5.4 Scrumban.................................................................................................. 69
5.5 Azure Boards ............................................................................................ 70
6 Recommended Digital Engagement and Activities………………………………..70
6.1 Scrum ....................................................................................................... 70
6.2 Azure Boards ............................................................................................ 71
Learning Unit 2: Web Application Development for Azure Cloud……………………..72
1 Introduction…………………………………………………………………………….72
2 Cloud Terminology……………………………………………………………………72
2.1 Cloud Computing ...................................................................................... 73
2.2 Local Providers ......................................................................................... 73
2.3 Deployment Models .................................................................................. 74
2.4 Types of Cloud Computing ........................................................................ 74
2.4.1 Infrastructure as a service (IaaS) ....................................................... 75
2.4.2 Platform as a service (PaaS) .............................................................. 75
2.4.3 Software as a service (SaaS) ............................................................. 75
3 Azure Web Architecture………………………………………………………………76
3.1 Basic Web Application............................................................................... 76
3.1.1 Storage Blob ...................................................................................... 77
3.1.2 Azure SQL Database ......................................................................... 77
3.1.3 Azure App Service.............................................................................. 78
3.2 Scalable Web Application.......................................................................... 79

© The Independent Institute of Education (Pty) Ltd 2023 Page 5 of 290


IIE Module Manual APPR6312

3.2.1 Azure Functions ................................................................................. 80


4 Azure SQL Database…………………………………………………………………81
4.1 Deployment Options .................................................................................. 81
4.2 Provisioning an Azure SQL database ........................................................ 82
4.2.1 The Scenario – DJs and their gigs ..................................................... 82
4.2.2 Entity Relationship Diagram ............................................................... 82
4.2.3 Working with Databases in Azure ....................................................... 83
4.2.4 Creating the Database ....................................................................... 84
4.3 Querying an Azure SQL Database ............................................................ 89
4.3.1 Setting up the Firewall ........................................................................ 89
4.3.2 Running Queries ................................................................................ 91
4.3.3 Accessing Data from a Console Application ....................................... 94
5 Azure App Services…………………………………………………………………...97
5.1 .NET Framework vs .NET Core ................................................................. 97
5.2 Creating an ASP.NET Core Web App ....................................................... 98
5.2.1 Creating the Project ........................................................................... 99
5.2.2 Running the App Locally....................................................................101
5.2.3 Creating the Entities ..........................................................................101
5.2.4 Adding the EF Core NuGet Package .................................................104
5.2.5 Create a Database Context Class .....................................................105
5.2.6 Reading and Displaying Data ............................................................107
5.3 Publishing the Web App to Azure .............................................................109
5.3.1 Publishing from Visual Studio ............................................................109
5.3.2 Configuring the Database Firewall .................................................... 113
5.4 Updating and Redeploying .......................................................................114
5.5 Managing the Web App ............................................................................115
6 Azure Functions……………………………………………………………………...118
6.1 Serverless Computing ..............................................................................118
6.1.1 What is Serverless Computing? ........................................................ 118
6.1.2 Serverless Options in Azure .............................................................. 118
6.1.3 Portability of Azure Functions ............................................................ 119
6.1.4 Cost of Azure Functions .................................................................... 119
6.2 Creating an Azure Function in Visual Studio ............................................121
6.2.1 Triggers and Bindings .......................................................................121
6.2.2 Creating the Function Project ............................................................121
6.2.3 Sample Function ...............................................................................123
6.3 Running Function Locally .........................................................................124
6.4 Creating a Custom Function .....................................................................126
6.4.1 Creating the Function ........................................................................126
6.4.2 Adding the SqlClient Library ..............................................................128
6.4.3 Adding Database Access Code .........................................................129
6.5 Publishing Function to Azure ....................................................................131
6.6 Creating an Azure Function with Azure Portal ..........................................135
6.6.1 Creating a New HTTP Triggered Function .........................................136
6.6.2 Developing the Function in Azure Portal............................................139
6.6.3 Editing the Trigger and Binding Properties ........................................140
6.6.4 Testing the Function in the Portal ......................................................141
6.6.5 Disabling a Function..........................................................................142

© The Independent Institute of Education (Pty) Ltd 2023 Page 6 of 290


IIE Module Manual APPR6312

6.7 Consuming Azure Functions ....................................................................143


6.8 Cleaning Up .............................................................................................144
7 Recommended Additional Reading………………………………………………..145
7.1 Azure Web Architecture ...........................................................................145
7.2 Azure Cloud .............................................................................................145
7.3 Azure SQL Database ...............................................................................145
7.4 Azure Functions .......................................................................................145
8 Recommended Digital Engagement and Activities………………………………146
8.1 Cloud Concepts........................................................................................146
8.2 Azure Cloud .............................................................................................146
8.3 Azure SQL Database ...............................................................................146
8.4 Azure App Service ...................................................................................146
8.5 Azure Functions .......................................................................................147
Learning Unit 3: Continuous Integration………………………………………………..148
1 Introduction…………………………………………………………………………...148
2 Distributed Repositories…………………………………………………………….148
2.1 Shared Code Repositories .......................................................................148
2.1.1 What is Version Control? ...................................................................148
2.1.2 Best Practices ...................................................................................149
2.2 Centralised vs Distributed Version Control ...............................................150
2.2.1 Centralised Version Control ...............................................................151
2.2.2 Distributed Version Control ................................................................152
2.3 Azure Repos ............................................................................................153
2.3.1 Azure DevOps...................................................................................153
2.3.2 Local Tools ........................................................................................156
2.4 Git Workflows Introduced .........................................................................159
2.4.1 Centralised Workflow ........................................................................159
2.4.2 Feature Branching Workflow .............................................................160
2.4.3 GitFlow Workflow ..............................................................................161
2.4.4 Forking Workflow ..............................................................................162
2.5 Cloning a Repository ................................................................................162
2.6 Staging, Committing and Rollback ...........................................................164
2.6.1 Initial Project Creation .......................................................................164
2.6.2 Adding a. gitignore File .....................................................................167
2.6.3 Creating the Project ..........................................................................168
2.6.4 Staging..............................................................................................168
2.6.5 Committing ........................................................................................171
2.6.6 Rollback ............................................................................................172
2.7 Pushing, Pulling and Rebasing.................................................................174
2.7.1 Pushing Commits ..............................................................................174
2.7.2 Pulling Commits ................................................................................176
2.7.3 Rebasing ...........................................................................................177
2.8 Branching, Merging and Pull Requests ....................................................179
2.8.1 Branching ..........................................................................................180
2.8.2 Working on the Branch ......................................................................181
2.8.3 Merging .............................................................................................182
2.8.4 Pull Requests ....................................................................................182
3 Continuous Builds……………………………………………………………………187

© The Independent Institute of Education (Pty) Ltd 2023 Page 7 of 290


IIE Module Manual APPR6312

3.1 What is Continuous Integration? ..............................................................187


3.2 Benefits of Continuous Integration ...........................................................189
3.3 Creating a Pipeline ...................................................................................189
3.4 Building a Project .....................................................................................193
3.5 Using Build Agents ...................................................................................195
4 Package Hosting……………………………………………………………………..196
4.1 What are Azure Artifacts? ........................................................................196
4.2 Benefits of Azure Artifacts ........................................................................198
4.3 Azure Artifacts Best Practices ..................................................................199
4.3.1 Creating Packages ............................................................................199
4.3.2 Consuming Packages .......................................................................199
4.4 Using Azure Artifacts ................................................................................199
4.4.1 Creating a Feed ................................................................................200
4.4.2 Adding Upstream Sources ................................................................200
4.4.3 Consuming Packages from a Feed in Visual Studio ..........................201
4.4.4 Consuming Packages from a Feed in Azure Pipelines ......................203
4.4.5 Publishing NuGet Packages from Azure Pipelines ............................205
4.4.6 Publishing Universal Packages from Azure Pipelines ........................206
5 Recommended Additional Reading………………………………………………..208
6 Recommended Digital Engagement and Activities………………………………208
Learning Unit 4: Continuous Testing……………………………………………………209
1 Introduction…………………………………………………………………………...209
2 Unit Testing…………………………………………………………………………..210
2.1 What is a Unit Test? .................................................................................210
2.1.1 When to Write Tests .......................................................................... 211
2.1.2 Unit Testing Frameworks ................................................................... 211
2.2 Benefits of Unit Testing ............................................................................212
2.3 MSTest Unit Tests....................................................................................212
2.3.1 Creating Testable Code .....................................................................212
2.3.2 Creating Unit Tests ............................................................................213
2.3.3 Writing Test Code ..............................................................................214
2.3.4 Running Tests ...................................................................................215
2.4 Test Explorer............................................................................................215
2.5 Fakes: Mocks and Stubs ..........................................................................216
2.6 Using Microsoft Fakes ..............................................................................219
2.6.1 Stubs.................................................................................................220
2.6.2 Shims ................................................................................................220
3 Integration Testing…………………………………………………………………...221
3.1 What is an Integration Test?.....................................................................221
3.2 Creating Tests ..........................................................................................221
3.3 Using WebApplicationFactory ..................................................................222
3.3.1 Tests with WebApplicationFactory .....................................................222
3.3.2 Customising the WebApplicationFactory ...........................................224
3.4 Customising the Client .............................................................................224
3.5 Mock Services ..........................................................................................225
4 Load and Stress Testing…………………………………………………………….226
4.1 What is a Load Test? ...............................................................................226
4.2 Creating a Load Test ................................................................................226

© The Independent Institute of Education (Pty) Ltd 2023 Page 8 of 290


IIE Module Manual APPR6312

4.2.1 Creating a Basic Test ........................................................................226


4.2.2 Editing Test Settings ..........................................................................228
4.3 Running a Load Test ................................................................................232
5 User Interface Testing……………………………………………………………….233
5.1 What is User Interface Testing? ...............................................................233
5.1.1 Selenium ...........................................................................................233
5.1.2 Best Practices ...................................................................................234
5.2 Creating a Test Project.............................................................................234
5.3 Creating Selenium Tests ..........................................................................235
5.3.1 Finding Elements ..............................................................................236
5.3.2 Performing Actions ............................................................................236
6 Integrating Tests into Azure Pipelines…………………………………………….237
6.1 Running Tests in a Pipeline ......................................................................237
6.1.1 Running Integration Tests ..................................................................237
6.1.2 Running UI Tests ...............................................................................238
6.2 Collecting Code Coverage .......................................................................238
7 Recommended Additional Reading………………………………………………..241
8 Recommended Digital Engagement and Activities………………………………242
Learning Unit 5: Continuous Deployment………………………………………………243
1 Introduction…………………………………………………………………………...243
2 Continuous Deployment…………………………………………………………….243
2.1 What is Continuous Deployment? ............................................................243
2.2 Continuous Delivery vs Continuous Deployment ......................................244
2.3 Benefits of Continuous Deployment .........................................................245
2.4 Best Practices ..........................................................................................245
3 Deploying to Azure App Services………………………………………………….246
3.1 Two Options .............................................................................................246
3.2 Using Kudu App Service ..........................................................................246
3.3 Using Azure Pipelines ..............................................................................250
3.3.1 Publishing Artifacts in the Build Pipeline ............................................251
3.3.2 Deploying Artifacts in the Release Pipeline .......................................251
3.4 Deployment Slots .....................................................................................256
4 Deploying to Azure Functions………………………………………………………256
4.1 Setting Up Continuous Deployment..........................................................256
4.2 Deploy Using Azure Pipelines ..................................................................258
5 Deploying to Azure SQL Database………………………………………………..260
5.1 Data-tier Applications ...............................................................................260
5.2 Creating a DACPAC using Visual Studio ..................................................260
5.2.1 Adding a Table ..................................................................................262
5.2.2 Configuring the Publish Settings .......................................................263
5.2.3 Publishing from Visual Studio ............................................................265
5.2.4 Adding a SQL Script ..........................................................................266
5.2.5 Adding Lookup Data..........................................................................266
5.2.6 Configuring the DACPAC Behaviour .................................................267
5.3 Deploy Using Azure Pipelines ..................................................................268
6 Concluding Remarks………………………………………………………………...272
7 Recommended Additional Reading………………………………………………..272
8 Recommended Digital Engagement and Activities………………………………272

© The Independent Institute of Education (Pty) Ltd 2023 Page 9 of 290


IIE Module Manual APPR6312

Bibliography………………………………………………………………………………..273

© The Independent Institute of Education (Pty) Ltd 2023 Page 10 of 290


IIE Module Manual APPR6312

Using this Manual


This manual has been developed to meet the module's specific objectives and uses
several different sources. It functions as a stand-alone resource for this module, and
no prescribed textbook or material is required. There may, however, be occasions
when additional readings are also recommended to supplement the information
provided. Where these are specified, please ensure you engage with the reading as
indicated.

Various activities and revision questions are included in the learning units of this
manual. These are designed to help you engage with the subject matter and help you
prepare for your assessments.

Introduction
Software development is an ever-changing field of work. With the advent of cloud
technologies, the software enterprises want to develop changed dramatically, and so
have the tools we use to develop these systems. Increasingly, the tools used by
software developers and testers are also cloud-based.

Microsoft understands this is a real need and has made available a suite of cloud-
based tools known collectively as Microsoft Azure DevOps. In this module, we will
explore how to use the following Microsoft Azure DevOps tools:

• Azure Boards – used to manage agile software development projects;


• Azure Repos – distributed source control;
• Azure Pipelines – online build services to automate build processes; and
• Azure Artifacts – hosting and consuming binary artefacts.

All the Microsoft Azure DevOps tools can be used for any software development.
These tools are also not limited to the traditional Microsoft development .NET
development ecosystem. But the tools really shine when used to develop Azure
Cloud applications. In this module, we will learn how to create web applications using
Visual Studio 2022 and deploy these applications to the Azure Cloud – the first
primary cloud provider with data centres in Africa. We will learn about the following
Azure Cloud components:

• Azure App Services – hosting for web applications;


• Azure Functions – a serverless environment for web services;
• Azure SQL Database – the evolution of Microsoft SQL Server in the cloud
space.

By the end of this module, you will have all the skills to build, automatically test and
deploy the cloud-based web applications of the future.

© The Independent Institute of Education (Pty) Ltd 2023 Page 11 of 290


IIE Module Manual APPR6312

You will need to sign up for a student account for Microsoft Azure services. (This is
ideal – only get the free account if the student account process does not work.)
Student accounts can be renewed for a second year if necessary.

Microsoft Azure for Students Starter is also an option, although that won’t include
access to Azure SQL Server. You can make use of MySQL, though, which will still
allow you to do most things in this module (but this module manual will not help you
with how to do that).

If you struggle with both student options, you can still sign up for a free account for
Microsoft Azure services (a credit card is required). If you sign up for the free edition,
note that certain services are only free for 12 months. Remember to disable those
services at the end of the semester to avoid being billed for services you are
not using!

Read more about what is included in the 12-month free period on the Azure free
account FAQ available here: https://azure.microsoft.com/en-us/free/free-account-faq/
For more information about preventing unexpected charges, read this page:
https://docs.microsoft.com/en-us/azure/billing/billing-getting-started

This Module at a Glance


The outline of the module content is shown in Figure 1.

Each learning unit will contain some theory and practical guidelines for how to do the
various tasks. It is highly recommended that you follow along with the steps.

Figure 1: Module Outline

© The Independent Institute of Education (Pty) Ltd 2023 Page 12 of 290


IIE Module Manual APPR6312

Conventions Used in this Manual

Where you see this icon, you will find a freely available online resource
such as an e-book.

Where you see this icon, there will be information about how the
software development aspects of enterprise systems link up with other
disciplines.

Where you see this icon, there will be an opportunity to think about a
real-world example that links to the theory.

© The Independent Institute of Education (Pty) Ltd 2023 Page 13 of 290


IIE Module Manual APPR6312

Glossary

Term Definition

Azure Boards “Azure Boards delivers a suite of Agile tools to


support planning and tracking work, code defects,
and issues using Kanban and Scrum methods.”
(Sherer, et al., 2019)

Cloud Computing “Cloud computing, often referred to as simply ‘the


cloud’, is the delivery of on-demand computing
resources — everything from applications to data
centres — over the internet on a pay-for-use
basis.” (IBM, n.d.)

Continuous Delivery “Continuous Delivery is the ability to get changes


of all types—including new features, configuration
changes, bug fixes and experiments—into
production, or into the hands of users, safely and
quickly in a sustainable way.” (Humble, 2017)

Continuous Deployment “Continuous Deployment (CD) is a software


release process that uses automated testing to
validate if changes to a codebase are correct and
stable for immediate autonomous deployment to a
production environment.” (Pittet, n.d.)

Continuous Integration “Continuous Integration (CI) is a development


practice that requires developers to integrate code
into a shared repository several times a day. Each
check-in is then verified by an automated build,
allowing teams to detect problems early.”
(ThoughtWorks, 2018)

Data-tier application (DAC) “A data-tier application (DAC) is a logical database


management entity that defines all of the SQL
Server objects – like tables, views, and instance
objects, including logins - associated with a user’s
database.” (Guyer, et al., 2016)

DevOps “DevOps is the blending of tasks performed by a


company’s application development and systems
operations teams.” (TechTarget, 2017)

© The Independent Institute of Education (Pty) Ltd 2023 Page 14 of 290


IIE Module Manual APPR6312

Term Definition

Fake “Fakes are objects that have working


implementations, but not same as production one.
Usually, they take some shortcut and have
simplified version of production code.” (Lipski,
2017)

Integration Tests “Integration tests determine if independently


developed units of software work correctly when
they are connected to each other.” (Fowler, 2018)

Kanban “Kanban is a workflow management method


designed to help you visualize your work,
maximize efficiency and be agile. From Japanese,
kanban is literally translated as billboard or
signboard.” (Kanbanize, 2019)

Load Tests Load tests “[t]est whether the app can handle a
specified load of users for a certain scenario while
still satisfying the response goal. The app is run
under normal conditions.” (Anderson, et al., 2019b)

Mock “Mocks are objects that register calls they receive.


In test assertion we can verify on Mocks that all
expected actions were performed.” (Lipski, 2017)

Methodology “[A]n approach to ‘doing something’ with a defined


set of rules, methods, tests activities, deliverables,
and processes which typically serves to solve a
specific problem.” (Ellis, 2008)

Source Code Management “Source code management (SCM) is used to track


(SCM) modifications to a source code repository. SCM
tracks a running history of changes to a code base
and helps resolve conflicts when merging updates
from multiple contributors. SCM is also
synonymous with Version control.” (Atlassian, n.d.)

Scrum “A framework within which people can address


complex adaptive problems, while productively and
creatively delivering products of the highest
possible value.” (Schwaber & Sutherland, 2017)

© The Independent Institute of Education (Pty) Ltd 2023 Page 15 of 290


IIE Module Manual APPR6312

Term Definition

Software Development “[A] process used by the software industry to


Lifecycle (SDLC) design, develop and test high quality software’s.
The SDLC aims to produce a high-quality software
that meets or exceeds customer expectations,
reaches completion within times and cost
estimates.” (Tutorials Point, n.d.)

Software Development A software development methodology is “a


Methodology framework that is used to structure, plan, and
control the process of developing an information
system.” (Association of Modern Technologies
Professionals, 2018)

Stub “Stub is an object that holds predefined data and


uses it to answer calls during tests. It is used when
we cannot or don’t want to involve objects that
would answer with real data or have undesirable
side effects.” (Lipski, 2017)

Unit Test “[U]nit tests are low-level, focusing on a small part


of the software system.” (Fowler, 2014)

Unit Testing Frameworks “[S]oftware tools to support writing and running unit
tests, including a foundation on which to build tests
and the functionality to execute the tests and
report their results.” (Hamill, 2004)

© The Independent Institute of Education (Pty) Ltd 2023 Page 16 of 290


IIE Module Manual APPR6312

Learning Unit 1: Software Development


Methodologies
Learning Objectives: My notes
• Describe the differences between different software
development methodologies.
• Identify the benefits of agile software development
methodologies.
• Explain the core values of the Agile Manifesto.
• Apply the Scrum methodology to a project.
• Apply the Kanban methodology to a project.
• Motivate why to use either Scrum or Kanban for a specific
project.
• Use Azure Boards to track work items in an agile project.
Material used for this learning unit:
• This module manual.
• Microsoft Azure Boards.
How to prepare for this learning unit:
• Read through the content of this learning unit.
• Work through the activities on Learn.

1 Introduction
In this module, you will gain the knowledge and skills to develop enterprise software
systems within the Microsoft Cloud ecosystem effectively. This module builds on the
programming skills that you already have and
focuses on the application of those skills.

Enterprise software systems are large systems that require many people to work together
to make
them a reality. To coordinate the efforts of many people, sometimes across different
teams,
methodologies and tools are needed to keep track of what is happening.
That is the focus of this learning unit.

Software Development Methodologies

This section (up to the end of 2.4) is adapted from (The Independent Institute of Education,
2018),
Learning Unit 5.

A software development methodology is “a framework used to structure, plan, and control


the process
of developing an information system.” (Association of Modern Technologies Professionals,
2018)
Many different methodologies exist, each with its advantages and disadvantages. To a
large extent,

© The Independent Institute of Education (Pty) Ltd 2023 Page 17 of 290


IIE Module Manual APPR6312

newer methods were created in response to the drawbacks of older ones.

We will cover the basics of several critical methodologies here, but this is a partial list of all
the
methodologies. The following two sections will examine Scrum and Kanban in detail.

© The Independent Institute of Education (Pty) Ltd 2023 Page 18 of 290


IIE Module Manual APPR6312

Waterfall

The waterfall methodology was invented in 1970. It was based on the work of Henry Ford
on his car
assembly lines in 1913. (Sacolick, 2018)

Figure 2: Waterfall Methodology

In the waterfall methodology, the different phases (see Figure 2) in the software
development lifecycle (SDLC) are followed linearly. Each step must be completed before
moving on to the next one. (Korkishko, 2017) All the requirements are gathered up front and
documented in detail.
Once the specification is set in stone, the software can be designed. And so on.

Waterfall works well with traditional project management, where everything is planned
upfront and tightly managed.

© The Independent Institute of Education (Pty) Ltd 2023 Page 19 of 290


IIE Module Manual APPR6312

This is the same process used in engineering projects such as bridge construction. (Roseke,
2012) It is a sensible methodology for a bridge where the requirements are fixed, and you
get only one shot at building the right thing. Getting halfway through making the bridge only
to realise that it won’t be able to carry the required weight is an expensive mistake to fix.

When waterfall was first introduced, software was very different from today's. Things
changed slowly, and the computers and their software were large and complex. (Sacolick,
2018) Today, everything changes rapidly, including requirements.

Even though the waterfall is generally considered outdated, there are still cases where it is
used successfully. Waterfall is a simple and straightforward process for small projects (that
take less than 100 hours of development). (Kuprenko, 2017)

The aerospace and defence industries also still heavily rely on the waterfall process. In this
instance, the motivation behind using the waterfall process is the safety requirements of the
developed software. Imagine, for example, how dire the consequences could be if the
passenger liner's navigation system malfunctioned.

1.1.1 Advantages

• The methodology is straightforward to learn and apply. (TatvaSoft, 2015)


• The projects are easy to manage because the methodology is so inflexible.
(TatvaSoft, 2015)
• Detailed documentation is produced, enabling new developers to get all the
information required to get started. (Lvivity, 2018)
• The completion date and total cost can be determined upfront. (Lvivity, 2018)

1.1.2 Disadvantages

• Waterfall only works if the requirements are well understood up front or are likely to
change. (TatvaSoft, 2015)
• The process needs more flexibility, making it complex and expensive to cope with
changes. (Lvivity, 2018)
• Functional software is only available at the end of the project. (TatvaSoft, 2015)
• The client is not involved in the development and only gets to use the product when
it is complete. (Lvivity, 2018)

1.2 Rational Unified Process


The Rational Unified Process (RUP) was first described under this name in 1998 by the
company Rational. Rational was later acquired by IBM. (Kruchten, 2004)

In RUP, there are also phases like in Waterfall. Moreover, the four phases (inception,
elaboration, construction and transition) occur in order. But unlike waterfall, this process is
completed in multiple iterations. Each iteration only deals with a part of the more extensive
system, and functional software is delivered at the end of each iteration. (Ambler, 2005)

© The Independent Institute of Education (Pty) Ltd 2023 Page 20 of 290


IIE Module Manual APPR6312

Figure 3: RUP Methodology

1.2.1 Advantages

• Exact documentation is created during the process. (Powell-Morse, 2017b)


• Stakeholders can be frequently informed of progress and see the software early on.
(Ambler, 2005)
• The process is flexible enough to handle changes in the requirements. (Powell-
Morse, 2017b)
• Integration occurs continuously instead of at the end of the whole project. (Powell-
Morse, 2017b)

1.2.2 Disadvantages

• RUP is a complex methodology that can be daunting to learn. (Powell-Morse, 2017b)


• Tasks are assigned to specific team members, and each team member needs to be
an expert in producing the right artefacts. (Powell-Morse, 2017b)
• RUP still needs to be more flexible. (Green, 2016)
• The focus on continuous integration can make the testing stages clear. (TatvaSoft,
2015)

1.3 Agile Manifesto


With the introduction of the internet, the software development landscape changed.
Innovation and the ability to keep up with rapidly changing demands became increasingly
critical. Out of this, in 2001, the agile manifesto was born. (Sacolick, 2018)

© The Independent Institute of Education (Pty) Ltd 2023 Page 21 of 290


IIE Module Manual APPR6312

Figure 4: Agile Manifesto from: http://agilemanifesto.org/

This section is the odd one among the methodologies since agile is not a software
development methodology. Agile has four values, shown in Figure 4, and 12 principles
(see Figure 5).
However, agile development does not prescribe practices, so it is not a methodology.
(Gratis, 2018)
There are, however, several agile methodologies that all strive to adhere to the values and
principles in their own unique ways. Examples of agile methodologies are:

• Extreme Programming (TatvaSoft, 2015);


• Scrum (Korkishko, 2017);
• Kanban (Radigan, 2018); and
• Feature-Driven Development (FDD) (Synopsis, 2017).

© The Independent Institute of Education (Pty) Ltd 2023 Page 22 of 290


IIE Module Manual APPR6312

Figure 5: Agile Principles from: http://agilemanifesto.org/principles.html

1.4 Extreme Programming


Extreme Programming (XP) is the first agile methodology that we will touch on. It was first
used at Chrysler in the mid-1990s. (Agile Alliance, 2018b) At its core, XP has 12 practices
that are all taken to the extreme (see Figure 6). (Kuprenko, 2017)

© The Independent Institute of Education (Pty) Ltd 2023 Page 23 of 290


IIE Module Manual APPR6312

Figure 6: Extreme Programming Practices

XP also has its own set of values: “communication, simplicity, feedback, courage, and
respect”.
(Agile Alliance, 2018b)

XP is meant to be used in a small team that works in the same physical office, using a
technology that can have automated unit and functional tests. It is ideal in the situation
where requirements change often.
(Agile Alliance, 2018b)

Figure 7: Extreme Programming Practices

1.4.1 Advantages

• XP works well when productivity needs to be high. (Green, 2016)


• Customers are involved in XP projects, allowing them to contribute early opinions.
(TatvaSoft, 2015)

© The Independent Institute of Education (Pty) Ltd 2023 Page 24 of 290


IIE Module Manual APPR6312

• The developers on an XP project personally commit to the schedules. (TatvaSoft,


2015)

1.4.2 Disadvantages

• Not all people can work in an environment that is so unstructured. (Green, 2016)
• XP requires many face-to-face meetings with the customer, which can be
expensive. (TatvaSoft, 2015)
• The full project scope has yet to be discovered, making it impossible to provide a
price for the whole project. (TatvaSoft, 2015)

1.5 Other Agile Methodologies


CollabNet VersionOne publishes an annual agile report based on survey
responses from software professionals worldwide. The 15th Annual State of
Agile Report (Digital.ai, 2021) provides several interesting insights from the
Read the
more 1 380 responses collected. report for more
interesting
Extreme Programming (XP) is only used by 1% of respondents. If you look details.
at that statistic, this methodology is no longer popular in its original form. So,
what are the most popular methods, then? At the top of the list, with a very
clear lead in popularity, is Scrum, with a 66% adoption rate. A further 6% of respondents
indicated using a hybrid of Scrum and XP. When we explore Scrum in detail in the next
section, it will become clearer why this kind of hybrid is possible.

Scrumban is used by 9% of respondents, and Kanban by 6%. Only 1% use Lean Start-up.

© The Independent Institute of Education (Pty) Ltd 2023 Page 25 of 290


IIE Module Manual APPR6312

Before moving on to Scrum and Kanban, it is worthwhile to look at Lean Start-up briefly.
Here is the definition by Eric Ries, creator of Lean Start-up:

“The Lean Start-up provides a scientific approach to creating and managing start-ups and
getting customers a desired product faster. The Lean Start-up method teaches you how to
drive a start-up, steer when to turn and persevere, and grow a business with maximum
acceleration. It is a principled approach to new product development.” (Ries, n.d.)

The focus of Lean Start-up is very much on how to get a product into the market as quickly
as possible. It is designed for start-up companies whose continued existence depends on
getting that product into the market. Lean Start-up is more of an agile business process
than specifically a software development methodology. A convincing argument is made by
(Mantini, 2018) that it is ideal to combine Lean Start-up with the Design Thinking
methodology to define the customer’s problem and agile software development to create
the software.

2 Scrum
2.1 Framework, Not a Methodology
Hirotaka Takeuchi and Ikujiro Nonaka first described the concepts of Scrum in the 1980s.
Ken Schwaber and Jeff Sutherland elaborated on Scrum in the 1990s. (SCRUMstudy,
2017) Here is their definition of Scrum:

Scrum is “[a] framework within which people can address complex adaptive problems
while productively and creatively delivering products of the highest possible value.”
(Schwaber & Sutherland, 2017)

Before we can make sense of the title of this subsection, we need to know what a
methodology is. Here is one definition:

“A methodology is an approach to ‘doing something’ with a defined set of rules, methods,


tests activities, deliverables, and processes which typically solve a specific problem.”
(Ellis, 2008)

Methodologies are typically very prescriptive. The software must be developed in this way,
and the team must produce the following artefacts, and so on.
In contrast, Scrum was developed from the start to be a framework. It provides basic
guidelines for developing software but needs to be more prescriptive. What Scrum does
prescribe has become more about what needs to be done rather than how to accomplish it
over time. (Verheyen, 2013) This explains why it is possible to use Extreme Programming
(XP) in combination with Scrum – XP provides the how.

© The Independent Institute of Education (Pty) Ltd 2023 Page 26 of 290


IIE Module Manual APPR6312

2.2 Values
If Scrum is a framework and needs to be more prescriptive, what makes it Scrum? The first
topic to discuss is the set of values on which the framework is based since the principles
of Scrum all tie back to these values. These values should give direction to the actions of
team members. (Verheyen, 2013b)

Figure 8: Scrum Values

The five Scrum values are:

• Commitment is described in this context as “dedication and applies to the actions,


the effort, not the final result.” Commitment is doing the best possible work without
fail. It can include a commitment to continuous improvement, constant learning, etc.
(Verheyen, 2013b)
• Focus is about staying focused on things such as future work or features that will
never be needed. Because Scrum is iterative-incremental, the team gets to focus on
a small part of the project at a time. (Verheyen, 2013b)
• Openness means that the team and other stakeholders agree to openly communicate
about what needs to happen, progress and any challenges that arise. (Schwaber &
Sutherland, 2017) More than that, it is also open to collaboration and learning.
(Verheyen, 2013b)
• Respect for other team members is critical for well-functioning teams. This includes
respect for diversity, different opinions and the experience that each team member
brings to the table. (Verheyen, 2013b)
• Courage is required to tackle hard problems. (Schwaber & Sutherland, 2017) It takes
courage to admit when things are going wrong, share risks, and change direction
when required. (Verheyen, 2013b)

2.3 Principles
There are six principles that form the core guidelines for applying Scrum. All these principles
are mandatory – if these are not used, it is not Scrum. (SCRUMstudy, 2017)

© The Independent Institute of Education (Pty) Ltd 2023 Page 27 of 290


IIE Module Manual APPR6312

2.3.1 Empirical Process Control

Empirical process control theory forms the basis of Scrum. This means that we learn from
experience and then make decisions based on what we have learned. There are three main
ideas behind empirical process control: transparency (linked to the value of openness),
inspection (measuring how well things are going), and adaptation (changing what doesn’t
work). (Schwaber & Sutherland, 2017)

In practice, Scrum encourages teams to evaluate processes and change what doesn’t work
regularly.

2.3.2 Self-Organisation

In traditional teams, a manager tells the team working under them what to do. This can work
well in some circumstances, for example, in the military, where the chain of command is
important. However, there are better solutions than this when managing creative problem
solvers such as software developers.

In a self-organising Scrum team, the team members collaborate rather than being told what
to do. There is a servant leader that facilitates the process, which is very different from
traditional management. Such a leader focuses on the team's needs; when those are met,
the team can function well. (Visual Paradigm, n.d.)

2.3.3 Collaboration

Collaboration is about the team working well together to create something more significant
than just the sum of all the work done. It also implies interacting with other stakeholders.
(SCRUMstudy, 2017)

There are three central aspects to collaboration:

• Awareness – knowing what people are working on;


• Articulation – splitting work up and then integrating the smaller parts; and
• Appropriation – using technology in specific ways.

2.3.4 Value-based Prioritisation

Whatever features will provide the best business value will be implemented first. Risks and
dependencies should also be considered when prioritising items since these affect a
specific feature's value. (SCRUMstudy, 2017)

When we consider the team members later, you will see how this is done.

2.3.5 Time-boxing

Time is an essential constraint in any project, and Scrum recognises this. Activities are time-
boxed, which means there is a limit on the amount of time spent on each activity.
(SCRUMstudy, 2017)

© The Independent Institute of Education (Pty) Ltd 2023 Page 28 of 290


IIE Module Manual APPR6312

We will look at this concept again when we get to the section on events.

2.3.6 Iterative Development

This ties in with value-based prioritisation. If we develop the high-value features first but
don’t deliver them, we might as well be doing waterfall development. Scrum makes use of
iterative development with frequent delivery of usable features. (SCRUMstudy, 2017)

2.4 Team
We have already seen that Scrum teams are self-organising and have servant-leaders. But
there is more to it than that.

2.4.1 Product Owner

The first role defined by Scrum is the Product Owner. This person is responsible for making
sure that the best possible value is achieved for the business. (Schwaber & Sutherland,
2017) Who this is varies from organisation to organisation. However, it is ideally somebody
from the business who understands the needs of the business and has some authority to
make decisions.

The Product Owner prioritises features according to business value – they can decide what
is done first. And a single person (not a group of people) ultimately has the say. They can
be advised by others, but the buck stops at the Product Owner. (Schwaber & Sutherland,
2017)

2.4.2 Development Team

The development team consists of all the people working towards developing the software.
This group of people is cross-functional – there can be people with a wide variety of skills
working on the same project. (Schwaber & Sutherland, 2017)

Optimal team sizes range from three to nine developers. With smaller teams, there needs
to be more interaction. With more than nine developers, the coordination becomes too
challenging to manage. (Schwaber & Sutherland, 2017)

2.4.3 Scrum Master

The scrum master is the servant-leader in the team. They are responsible for helping
everyone (on the team and outside of it) understand the values, practices and rules of
Scrum. The Scrum Master facilitates events as needed, helps the team remove any
obstacles to their progress, and helps the organisation adopt Scrum. (Schwaber &
Sutherland, 2017)

© The Independent Institute of Education (Pty) Ltd 2023 Page 29 of 290


IIE Module Manual APPR6312

2.5 Events
We have explored many topics around Scrum, but we have yet to learn how it works. That
is where the events come in. Figure 9 shows all the events long before developers even
become involved for the first time.

Figure 9: Scrum Flow


From: (The Independent Institute of Education, 2018)

When the need for a new software system arises, the case typically needs to be made to
management, explaining why money should be spent on this. Once approved, a project
vision statement is often created to describe at a very high level what the project is trying to
achieve.

The first activity that developers may be aware of is the creation of a prioritised product
backlog. The Product Owner puts together a wish list of everything that can be implemented
(as understood at that point) and prioritises the items. This is called the Prioritised Product
Backlog.

In parallel with this, release planning may be done. Big organisations often have set dates
to release new software already, and releases of the new software will need to be planned
accordingly.

After all of that, the first Sprint starts. A sprint is a time-boxed period (typically one month or
less) during which the development team works on a releasable product. The product should
meet the definition of “Done” as agreed between the team and the Product Owner.
(Schwaber & Sutherland, 2017)

© The Independent Institute of Education (Pty) Ltd 2023 Page 30 of 290


IIE Module Manual APPR6312

2.5.1 Sprint Planning

The first step in a Sprint is Sprint Planning – a time-boxed meeting (maximum of eight hours)
during which the Sprint Backlog is created. The team works together to determine how
much work from the complete Product Backlog can fit into the Sprint. It is here that the
definition of “Done” is also agreed on.
During the sprint, no changes should be made to the backlog that will endanger the success
of a sprint. (Schwaber & Sutherland, 2017)

2.5.2 Daily Stand-up/Daily Scrum

During a Sprint, there is a daily meeting called Daily Stand-up (the meeting is short and
usually conducted standing up) or Daily Scrum. This is a 15-minute meeting for everybody
to chat. Every team member typically answers only the following three questions:
(Schwaber & Sutherland, 2017)

• What did I do yesterday?


• What will I do today?
• What is standing in my way?

These meetings are very useful for collaboration. You may recall that one of the aspects of
collaboration is awareness. It will be hard to collaborate effectively if you do not know what
your fellow team members are doing.

2.5.3 Sprint Review Meeting

At the end of the Sprint, there are two meetings. The first is the Sprint Review Meeting (time-
boxed to four hours). During this meeting, all the work done is reviewed, and it is determined
whether the “Done” requirement was met. The development team often does a
demonstration during this meeting. (Schwaber & Sutherland, 2017)

This meeting can also discuss Steps for future work, which can serve as input for an
updated Product Backlog. (Schwaber & Sutherland, 2017)

2.5.4 Sprint Retrospective Meeting

The last meeting during a Sprint is the Sprint Retrospective Meeting. This is where the
empirical process control comes in – this is the inspection to measure how things are going.
It is an aspect of project management where software projects are ahead of many other
types of project, where reflecting on practices are often a very foreign idea.

In this meeting, the team gets together to determine what worked well and what didn’t work.
This can include things related to people, relationships, processes and tools. Improvements
should be suggested for how to fix the things that did not work as well as they could have.
(Schwaber & Sutherland, 2017)

This meeting takes courage, especially to admit if you were doing something that didn’t
work well.

© The Independent Institute of Education (Pty) Ltd 2023 Page 31 of 290


IIE Module Manual APPR6312

In the next sprint, the process improvements can be implemented. It is highly disruptive to
change too many things simultaneously, so it is recommended to choose the most important
item and only change that single thing.

2.6 Artifacts
We have already come across the concepts of the Product Backlog and Sprint Backlog –
the two most important artifacts in Scrum. So far, we have been intentionally vague about
the nature of items in these backlogs.

The Product Backlog contains user stories. A user story is a requirement written from a
user's perspective that will use the feature once it is developed. (Rehkopf, n.d.) It could be
something like, “As a user, I would like to be able to change my profile picture.”

Sometimes Product Owners also come up with what is called epics. Epics are large stories
that can be broken down into smaller stories. (Rehkopf, n.d.) An example is, “As a user, I
would like to be able to do online shopping.” That could include numerous smaller stories
such as “As a user, I would like to be able to sign up for a new account.”

During a Sprint Planning Meeting, each User Story that forms a part of the Sprint Backlog
needs to be broken down into actionable tasks. (Schwaber & Sutherland, 2017) The tasks
should be roughly half a day’s work in size. Not too small since that creates too much
management overhead. And not too large, since then, tracking progress has become
difficult.

A lot more can be said about Scrum. Have a look at the Recommended Additional Reading
section as well as the Recommended Digital Engagement and Activities section for more
information.

3 Kanban
3.1 Principles
Kanban was first used by Toyota in the late 1940s to manage its car manufacturing. Only
in 2007 was Kanban in its current form applied to software development. (Kanbanize,
2019)

“Kanban is a workflow management method designed to help you visualise your work,
maximise efficiency and be agile. From Japanese, kanban is literally translated as
billboard or signboard.” (Kanbanize, 2019)

© The Independent Institute of Education (Pty) Ltd 2023 Page 32 of 290


IIE Module Manual APPR6312

There are four principles in Kanban:

• “Start with what you do now.” Not requiring huge up-front changes makes Kanban
becomes easy to adopt. (Kanbanize, 2019)
• “Agree to Pursue Incremental, Evolutionary Change.” Kanban encourages small
changes to counter resistance to change. (Kanbanize, 2019)
• “Respect the Current Process, Roles and Responsi-
bilities.” By acknowledging that what exists does have
value, resistance to change is again overcome.
(Kanbanize, 2019)
• “Encourage Acts of Leadership at All Levels.”
What would a
Continuous improvement (Kaizen in Japanese) can only
software
happen if people at all levels participate. (Kanbanize, development
2019) methodology
based on
As we can see, the principles are thoroughly grounded in the African culture
very respectful Japanese culture where it originated. look like?

3.2 Practices
All this is interesting but has yet to be useful. How does Kanban work? There are six core
practices that form part of Kanban. (Meiling, 2019)

3.2.1 Visualise

Visualising is the heart of Kanban, and it is how transparency is promoted. This is


accomplished using a Kanban board – which can be anything from a whiteboard with sticky
notes to a sophisticated electronic board. (Meiling, 2019)

An example of a Kanban board is shown in Figure 10. You can see what is still to be done,
who is currently working on which task, and what is done. Tasks are moved from one column
to the next as they progress through the process.

Figure 10: Kanban Board


From: (The Independent Institute of Education, 2018)

© The Independent Institute of Education (Pty) Ltd 2023 Page 33 of 290


IIE Module Manual APPR6312

3.2.2 Make Policies Explicit

It is important to be clear about policies, such as what criteria a task should meet to be
complete, and whether clients should be informed when new work is started. (Meiling, 2019)

3.2.3 Implement Feedback Loops

It is tempting to continue working on work items without ever touching base. But just like in
Scrum, stand-up meetings are recommended to ensure everyone is on the same page.
(Meiling, 2019)

3.2.4 Limit Work-in-Progress (WIP)

There is no equivalent to a Sprint in Kanban to limit the work done over a period. So, a
different way must be found to maintain balance. This is done by limiting the number of tasks
that can be in the work-in-progress state at the same time. (Meiling, 2019)

3.2.5 Improve Collaboratively, Evolve Experimentally

Just as with Scrum, the idea is to improve processes continuously. However, in Kanban,
there is no specific point in time when this is scheduled, so it requires collaboration to
happen.

3.2.6 Manage Flow

There should be a process that manages the tasks that flow into the board to ensure that
customer needs are met.

3.3 Benefits
The main benefits of Kanban are (The Independent Institute of Education, 2018):

• Kanban is a flexible methodology. (Yodis, 2016)


• Kanban is a simple methodology that can be learned very quickly. (Yodis, 2016)
• The software can be delivered very regularly. (Yodis, 2016)

Kanban allows for greater flexibility in terms of releases because you don’t have to wait until
the end of a Sprint to release. This is useful when releasing features very quickly is
important, and there is no requirement for fixed release schedules and approvals. (Rehkopf,
2019) Kanban can often be used very successfully for teams that are focused on software
maintenance (production support), while Scrum is best suited for product and system
development. (Pahuja, n.d.)

© The Independent Institute of Education (Pty) Ltd 2023 Page 34 of 290


IIE Module Manual APPR6312

3.4 What is Scrumban?


We have now seen that Scrum provides more structure, and Kanban provides more
freedom. But there are cases where you want elements from both methodologies. And that
is called Scrumban, which combines elements from both into one method.

Scrumban uses the Scrum processes but with the Kanban principles applied on top of that.
The first principle is to visualise. Here you can use a Kanban-like board to imagine what you
are doing in the sprint. (Singh, 2018) An example of a Scrumban board is shown in Figure
11.

Figure 11: Scrumban Board. From:


https://commons.wikimedia.org/wiki/File:Scrumban_task_board_example.jpg

The second principle is to define work-in-progress limits, typically one to two times the
number of team members. The third principle is to improve flow by addressing bottlenecks.
(Singh, 2018)

Scrumban can be used as a process of its own, or it can be used on a migration path from
Scrum to Kanban. (Singh, 2018)

4 Azure Boards
4.1 Why use Azure Boards?
Azure DevOps is a collection of tools used by entire software development teams. The tools
integrate well with existing tools such as Visual Studio. (Microsoft, 2019)

A little history will be useful to explain the various product names that you are likely to come
across online. Microsoft used to have a tool called Team Foundation Server (TFS). It was
an on-premises software management tool that included features such as source control,
automated builds and project management tools.

© The Independent Institute of Education (Pty) Ltd 2023 Page 35 of 290


IIE Module Manual APPR6312

By 2018, there was also a cloud-based version with the same features, called Visual Studio
Team Services (VSTS). (Grammatikos, 2018)

Azure DevOps was announced on 10 September 2018. It was not just a rebranding of the
existing tools but also included an updated user experience. (Cool, 2018) After the name
change, TFS became Azure DevOps Server, and VSTS became Azure DevOps Services.
Companies can and do still choose to use the on-premises Azure DevOps Server if they
want to keep their data protected within their own network or customise their work tracking
beyond what is possible in the cloud version. (Sherer, et al., 2019)

The five main Azure DevOps services are shown in Figure 12.

Figure 12: Azure DevOps Services

“Azure Boards delivers a suite of Agile tools to support planning and tracking work, code
defects, and issues using Kanban and Scrum methods.” (Sherer, et al., 2019)

Scrum and Kanban have inspired many software tools to be created to support task tracking
and planning. One of the questions in the 15th Annual State of Agile Report was which tools
are used to manage agile projects.
In this question, respondents could pick multiple answers. Jira came out at the top with 81%,
followed by Digital.ai Agility at 70% and then Azure DevOps at 66%. Microsoft Project was
used by 35% of respondents, and Microsoft Excel by 32% (Digital.ai, 2021)
There are numerous comparisons between Jira and Azure DevOps, for example,
(Automation Consultants, 2019) and (IT Central Station, 2019). There is no easy answer for
the best tool; in practice, the choice between the various tools will often come down to what
the organisation is already using.

For the purpose of this module, we focus on Azure DevOps since it is part of the well-
integrated suite of Microsoft tools.

4.2 Organisations, Projects and Teams

4.2.1 Signing Up for Azure DevOps

Throughout this module, we will use Azure DevOps Services – the online service.
Specifically, we will use Azure Boards in this learning unit.

© The Independent Institute of Education (Pty) Ltd 2023 Page 36 of 290


IIE Module Manual APPR6312

Microsoft provides these services, and you will need to sign up for a free account. To sign
up for a student account, visit https://azure.microsoft.com/en-us/free/students/. You will
need your student email address and a phone number to sign up – no credit card is required.

If you experience issues with signing up for the student account, you can also sign up for
the generally available free tier of the services. For more information about the sign up
process for Azure DevOps, read QuickStart: Sign up, sign in to Azure DevOps, available at
https://docs.microsoft.com/en-us/azure/devops/user-guide/sign-up-invite-
teammates?view=azure-devops. If you sign up in this way, you will have to sign up
separately for Azure Cloud here (credit card required even though it is free):
https://azure.microsoft.com/en-us/. Remember to disable services once you stop using
them to avoid getting changed after 12 months of free usage!

4.2.2 Organisations

Once you have signed up, you will see that an organisation has been created that is linked
to the user that you signed up with.
An organisation is a way to group related projects together.
In a large company, an organisation could, for example, be used for a business division. Or
a single organisation could be created for the whole company.
The choice is up to the user. What is important to note is that each organisation gets its free
tier of services. (Danielson, et al., 2019)

To create a new organisation:

1. Browse to http://dev.azure.com. You might need to login again, and it will redirect to your
default organisation’s page.

Figure 13: Creating a New Organisation

2. Click New organisation.

© The Independent Institute of Education (Pty) Ltd 2023 Page 37 of 290


IIE Module Manual APPR6312

Figure 14: Organisation Terms and Conditions

3. You can read the Terms of Service, Privacy Statement and Code of Conduct on the
next screen.
Once you are happy with those, click Continue to agree to these items.

Figure 15: Organisation Name and Region

4. Enter a name for the new organisation and choose where


the projects will be hosted.

While writing this module manually, DevOps was not yet


available to be hosted in South Africa (despite the data centres
Software
for Azure Cloud being available already). When this does
developers
become available, it is recommended that you choose to host need to
the projects in South Africa. This will be helpful in real-world comply to local
projects when complying with the Protection of Personal laws.
Information (PoPI) Act.

5. Click Continue.

© The Independent Institute of Education (Pty) Ltd 2023 Page 38 of 290


IIE Module Manual APPR6312

Figure 16: Organisation Being Created

6. Wait for the organisation to be created.


The organisation page will be loaded automatically when the process is complete.

Continue reading the projects section below. We will get back to what happens next.

4.2.3 Projects

The next thing we need is to create a project – without a project, there is no point in using
Azure DevOps. A project is exactly what the term sounds like – it represents a project being
worked on. Each project has its boards and backlogs, pipelines, repos and continuous
testing. (Danielson, et al., 2019)

It gets more complicated when we also introduce teams, but let us first look at how to create
a project
before we get to that.

Following on from the steps in the Organisations section to create the first project:

Figure 17: Creating a Project

© The Independent Institute of Education (Pty) Ltd 2023 Page 39 of 290


IIE Module Manual APPR6312

1. Enter a name for the project.


2. Choose whether to make it Public (anybody can view the project) or Private (by invite
only).
It is recommended that you choose Private.
3. Click Create project.

To create a new project later, click New Project in the organisation view (see Figure 18).

Figure 18: New Project Button

When this method is used to create a project, the dialog looks a little different (as shown in
Figure 19).

© The Independent Institute of Education (Pty) Ltd 2023 Page 40 of 290


IIE Module Manual APPR6312

Figure 19: Create New Project Dialog

On this dialog, click Advanced to gain access to two additional settings:

• Version control. This specifies which version control system will be used for the
project
– Git or Team Foundation Version Control. We will look at the options in Learning
Unit 3. For now, use Git.
• Work item process. This specifies which types of work items can be created and how
they are linked together by default. We will look at this in more detail in Section 4.4.1
below.

© The Independent Institute of Education (Pty) Ltd 2023 Page 41 of 290


IIE Module Manual APPR6312

Once the project is created, the project’s summary page will be displayed, as shown in
Figure 20.

Figure 20: Project Summary (with annotations)

This view has a couple of interesting features. On the left-hand side of the page is a
navigation pane.
Here we can see all the services that are available to the project. In addition to the main
Azure DevOps services that we have mentioned before (all available by default), there is
also a dashboard feature and
a built-in wiki for information sharing. Both are available under Overview.

At the top of the page, there are breadcrumbs. It shows at a glance where the current
page fits in
– organisation, project, and which service and page. When only one organisation has one
project,
this might not seem very useful. But it will be useful when working with multiple projects
and/or teams.

4.2.4 Project Settings

Azure DevOps, like most other agile project management tools, distinguishes between
the day-to-day operational tasks and things that are considered settings.
It is a sensible distinction since it would often not be desirable for all the team members to
have access to buttons like Delete project. Plus, there are many things that you might
change only every now and again that would otherwise clutter the day-to-day user
interface.

Let’s explore what can be done in project settings.

© The Independent Institute of Education (Pty) Ltd 2023 Page 42 of 290


IIE Module Manual APPR6312

Figure 21: Project Settings

With Azure DevOps, the project window shows details that are common to all projects, but
also, the settings for each service for the current project. We will get into more details about
those settings later in the module.

On the overview page, the name and description of the project can be changed, and a
project profile image can be selected.

To set a project profile image:

Figure 22: Project Profile Image Button

1. Click the square button to the right of the project name (outlined in green in Figure 22 –
letters will vary).

© The Independent Institute of Education (Pty) Ltd 2023 Page 43 of 290


IIE Module Manual APPR6312

Figure 23: Project Profile Image

Take note of the information message displayed here. You must have the right to
distribute the picture to use it as a profile image. For example, it would not be allowed to
use a trademark of another company, or a copyrighted image.

2. Click Choose image.


3. Browse to the desired image and click Open.
4. Click Save.

The image might not appear until you close the Azure DevOps page and load it again.
But eventually the image will appear as in Figure 24. The image will be used in quite small sizes,
so don’t pick something with too much detail.

Figure 24: Project with Profile Image

© The Independent Institute of Education (Pty) Ltd 2023 Page 44 of 290


IIE Module Manual APPR6312

The process used by the project can be changed (more about this later), and the visibility
can be updated to the public if desired. New administrators can be added, and DevOps
services can be enabled and disabled.

Remember, we are using the free tier of Azure DevOps.


A company with many users will pay for features such as Pipelines.
So, if a project doesn’t require some feature, it can be turned off.

4.2.5 Teams

The next category of settings for a project is called Teams.


Let’s start the discussion by looking at what is already created by this point.

Figure 25: Teams with Default Team

A default team with the same name (with Team at the end) was also created when the
project was
created. But it is possible to create multiple teams under one project.

To create a new team:

1. In Project Settings, under General and then Teams, click New Team. (The dialog
in Figure 26, on the next page, will be displayed.)
2. Choose a Team Avatar Image (if desired) by clicking on the icon above the team
name text field.
3. Specify a team name.
4. Add members if there are already other users in the organisation that should be
added here.
5. Provide a short description.
6. Choose who the administrators should be for the project.
7. Choose the permissions that the new project should inherit.
8. Click Create.

The new team will now also appear on the list of teams within the project.
We have now seen that a team has team members (these are direct members).
Additionally, teams also have their own backlogs. (Danielson, et al., 2019)

© The Independent Institute of Education (Pty) Ltd 2023 Page 45 of 290


IIE Module Manual APPR6312

Figure 26: Create New Team

If we view the team’s settings, there are links to configuring notifications, dashboards and
iterations and area paths for the team.

Figure 27: Team Settings

© The Independent Institute of Education (Pty) Ltd 2023 Page 46 of 290


IIE Module Manual APPR6312

Now that we have two teams let’s see what happens when we invite somebody to the
team.

To invite a person to a team:

1. Navigate to the summary page of the project.


2. Click Invite.

Figure 28: Inviting a Member

3. Enter the email address (or GitHub ID) of the person that you want to invite.
4. Choose which team(s) to add the person to.
5. Click Add.

For a different approach to adding users, have a look at (KathrynEE, et al., 2019b).

Think about this for a moment: Azure DevOps, the collection of


tools used to develop other software, is also software with its own
designs and implementation and tests and tasks and issues. Very
meta …

We can now start to see how the different entities are related. Think back to databases –
we can draw an entity relationship diagram (ERD) to capture what we learned.
This is not by any means the original ERD used by the developers but merely a
representation of what we have seen so far ourselves.

© The Independent Institute of Education (Pty) Ltd 2023 Page 47 of 290


IIE Module Manual APPR6312

Figure 29: Azure DevOps Entity Relationship Diagram

We now know how to create an organisation, a project, and a team, and how to invite team
members. The remaining question to be answered here is when (or maybe why) we should
create each of these. The answer is: that it depends.

It is possible to have a single project for a huge organisation. This means all the teams
share the same repositories, builds, etc. This works well if many teams work on a large
product, and if the teams are all synchronised in terms of iteration schedule. (Danielson, et
al., 2019)

The other option is to create many projects. This allows teams to operate more
autonomously and provides better access control since everybody does not need access
to all the projects. This is useful to separate different business units that use very differently
and thus need custom work tracking processes. (Danielson, et al., 2019)

The last option is to have multiple organisations. This is useful for establishing hard
security boundaries, but it does mean that there needs to be better collaboration and reuse.
(Danielson, et al., 2019)

This is quite a complex question, and for the most part, one that graduates software
developers will not have to answer independently. It is useful to know about the possibilities
when these come up in conversations.

© The Independent Institute of Education (Pty) Ltd 2023 Page 48 of 290


IIE Module Manual APPR6312

4.3 Setting Up Sprints


The next thing that needs to be done is to set up sprints if we will be using Scrum (or any
other methodology where there are iterations, for that matter).

To create an iteration:

1. Click Project Settings.


2. Under the Boards category, click Project Configuration. The Iterations tab will by
default, be selected.

Figure 30: Project Iterations

3. Select the project that should contain the iteration.


4. Click New child.

Figure 31: New Iteration

© The Independent Institute of Education (Pty) Ltd 2023 Page 49 of 290


IIE Module Manual APPR6312

5. Enter a name for the iteration, and optionally specify a Start date and End date.
6. Click Save and Close.

The iteration will now appear under the project, as shown in Figure 32.

Figure 32: Newly Created Iteration

To assign an iteration to a team:

1. Click Project Settings.


2. Under the General category, click Teams.
3. Click the team with which the iteration will be associated.

Figure 33: Project Settings

4. Click Iterations and Area Paths.


5. A new browser tab is opened, and now we are in Azure Boards settings for the
specific team.

© The Independent Institute of Education (Pty) Ltd 2023 Page 50 of 290


IIE Module Manual APPR6312

Figure 34: Team Configuration

6. Click Iterations.

Figure 35: Iterations

7. Click Select iteration(s).

Figure 36: Select Iteration(s)

© The Independent Institute of Education (Pty) Ltd 2023 Page 51 of 290


IIE Module Manual APPR6312

8. Select the iteration to add. In this case, let’s use the recently created Iteration Two.
9. Click Save and close.

Figure 37: Iteration Selected for Team

On the same configuration page, it is also possible to set the default iteration and backlog
iteration for the team.

4.4 Work Items

4.4.1 Project Processes and Work Item Types

A work item is anything that will be worked on at varying levels of abstraction. Which work
item types are available to a project depends on the project's process. By default, new
projects are assigned the basic process – we saw that in our project earlier.

To view the work item types for the Basic process:

1. Go back up to the organisation level and click Organisation Settings.


2. Under the Boards category, click Process.
3. Click the Basic (default) process.
4. The list of all the work item types will be displayed.

Figure 38 shows the work item types for the basic process: Epic, Issue, Task, Test Case,
Test Plan and Test Suite. The Agile, Scrum and CMMI (Capability Maturity Model
Integration) processes all have more types of work items.

© The Independent Institute of Education (Pty) Ltd 2023 Page 52 of 290


IIE Module Manual APPR6312

Figure 38: Basic Process Work Item Types

The process used by a project can be changed after a project has been created. But it is
well hidden since this should not happen during normal use of Azure Boards. If the project
already has work items, a lot of manual fixing will be involved.

It is best to create the project with the correct process. Now that you know the various
options, you can make an informed decision when creating the next project.

To change the process used by a project (continuing from the steps to view the work item
types):

1. Click Projects.
2. Hover over the project to change, and a button with three dots (…) will appear. Click
the button.

Figure 39: Change Process

3. Click Change process.

© The Independent Institute of Education (Pty) Ltd 2023 Page 53 of 290


IIE Module Manual APPR6312

Figure 40: Change Process Dialog

4. Choose the Agile target process and read the warning that is displayed.
5. Click Save.

Figure 41: Change Process Dialog – Manual Steps

6. If your project does have work items, carefully note the information on this dialog.
Then click Close.

© The Independent Institute of Education (Pty) Ltd 2023 Page 54 of 290


IIE Module Manual APPR6312

Now you might wonder which process to choose. It depends on the needs of the team.
Figure 42 compares which work items will be available for each type of process.

Figure 42: Process Comparison.


Based on diagrams from (KathrynEE, et al., 2019c)

Note that both the Agile and Scrum processes include the concept of a feature that is a
child of an epic. Epics don’t get displayed in the backlog view. So, if an item needs to be
displayed in the backlog, it is advisable to use a feature instead of an epic.

For more information about the processes, including the transitions between the various
states that work items can be in, read (KathrynEE, et al., 2019c).

4.4.2 Creating a Work Item

The moment has finally arrived when the first work item can be created. This is one of the
day-to-day activities that form part of the normal (non-administrative) use of Azure Boards.

To create a new work item or type task:

1. Navigate to the project (the operational part, not settings).


2. Under the Board category, click Work Items.

Figure 43: Empty Work Items List

© The Independent Institute of Education (Pty) Ltd 2023 Page 55 of 290


IIE Module Manual APPR6312

3. Click New Work Item and click Task on the drop-down list that appears.

Figure 44: New Task Properties

4. Enter a title for the task. Make it descriptive enough but keep it short.
5. Enter a description with as much detail as possible about the task at hand.
6. Under Area, select the team working on the work item.
7. Under Iteration, select the iteration (if known at this point).
8. Specify the Priority and any other details that are available.
9. Click Save.
10. Under Boards in the navigation pane, click Work items to return to the list. The new
item should now appear on the list, as in Figure 45.

Figure 45: First Work Item Appearing on the List

Think back to the section about Scrum earlier in this learning unit. In Scrum we have epics
which are broken down into user stories, and the user stories are in turn broken up into
tasks. Our first task is a little out of place since it doesn’t have a parent user story.

Create a user story, following the same steps as for the work item above (except choosing
to create a User Story in Step 3, of course). Then proceed with the next set of
instructions to allocate the parent to our original work item.

© The Independent Institute of Education (Pty) Ltd 2023 Page 56 of 290


IIE Module Manual APPR6312

4.4.3 Setting the Parent Task

To add an existing parent to a work item:

1. Open the work item.


2. Click the Links tab (the one with the icon).

Figure 46: Links Tab of a Work Item

3. Click Add Link.

Figure 47: Link Options

4. On the drop-down list that appears, click Existing item.

© The Independent Institute of Education (Pty) Ltd 2023 Page 57 of 290


IIE Module Manual APPR6312

Figure 48: Add Link – Link Type

5. On the Link type drop-down list, scroll down to the Work category and choose
Parent.

Figure 49: Work Items to Link

6. Click the Work items to link box and choose the User Story from the drop-down
list that appears.
7. Click OK.
8. Click Save on the work item.

Create one more work item with the same parent before continuing the following process.

We can see the work items in several different views, each with a specific focus. The Work
items list we have been looking at so far shows a flat list of all the items created in the
project. Various filters can be applied, but this list is not the easiest way to see which tasks
are in which sprint and so on. And there is also an easier way to create a job under a user
story.

© The Independent Institute of Education (Pty) Ltd 2023 Page 58 of 290


IIE Module Manual APPR6312

4.4.4 Using Backlogs

To view the backlog of a team:

1. On the navigation pane under Boards, click Backlogs.


2. Under My Team backlogs, click the name of the team.

Figure 50: Team Backlog

There are a few useful features of this view:

• Drag user stories on the list to change the order in which the items should be done
(1 being the highest priority item).
• Click the + to the left of a user story (marked in green in 59) to add a task that has
that user story as a parent.
• Click New Work Item to add a new user story to the team.
• Drag and drop items onto a sprint to include them in the sprint.
• Click on the name of the sprint to the right to view the sprint backlog.

4.5 Managing Capacity


Part of sprint planning is estimating how long tasks will take and then committing to
completing specific tasks during the sprint based on those estimates. Azure Boards can
help manage how much capacity is available in a sprint.

4.5.1 Setting Capacity Limits

To set capacity limits:

1. On the navigation pane under Boards, click Sprints.


2. Click on the name of the team.
3. Click the Capacity tab.

© The Independent Institute of Education (Pty) Ltd 2023 Page 59 of 290


IIE Module Manual APPR6312

Figure 51: Managing Capacity

4. For each team member, choose an activity and specify the capacity per day.

Figure 52: More Actions for Activities

5. Optionally, hover over an activity to display the (…) button. This provides access to
actions such as Add an activity, which adds another activity for the same user.
6. Click Save.

Now that we have set up the capacities for the team members, this information can be
used to know who has the capacity to perform specific tasks.

4.5.2 Assigning Tasks to Team Members

To assign tasks to team members (continuing from the previous set of steps):

1. Click the Backlog tab.


2. Expand a user story to see a task under it.
3. Click on the task.

© The Independent Institute of Education (Pty) Ltd 2023 Page 60 of 290


IIE Module Manual APPR6312

Figure 53: Entering an Estimate

4. Enter an Original Estimate for the task.


5. Set the Remaining effort for the task.

If you forget to set the Remaining effort, the hours will not appear on the Work details
page later in these steps.

6. Choose what type of Activity the task is.


7. Click Save & Close.

Figure 54: Viewing Work Details

8. Click the View options button (with the icon ).


9. From the drop-down list, choose Work details.

© The Independent Institute of Education (Pty) Ltd 2023 Page 61 of 290


IIE Module Manual APPR6312

Figure 55: Work Details View

10. Drag and drop a task onto a team member to assign it to that person. Notice how
the allocated number of hours for the person changes.
11. Another way to change the activity associated with a task is to drag the task to the
activity.

This is great, but what is the value of this feature? Let us create a big task (100 hours of
effort), allocate it to the same team member, and see what the effect is.

Figure 56: Over Committed Team

© The Independent Institute of Education (Pty) Ltd 2023 Page 62 of 290


IIE Module Manual APPR6312

Not only does the bar turn red, but it also extends beyond the black vertical line, which is
the maximum capacity of the team. This shows that, given the capacity that was defined,
the work will not be completed during this sprint.

If more team members were available, the work could be split up between them.

Remember, real tasks should never be that huge. A big task like that should be split into
smaller tasks of half a day or maybe one day in size.

4.6 Kanban Boards


Now we are finally getting to the feature where Azure Boards got its name from – boards.
A Kanban board can be used to quickly, briefly, see what is happening.

4.6.1 Using Boards

To view the board for a team:

1. On the navigation pane, under Boards, click Boards.


2. Click the team to view.

Figure 57: Team Board

We can see at a glance that we have two user stories, and the first one has three tasks. All
of these are in the New state, meaning work has not yet begun.

In Kanban board terminology, each of these columns is called a swim lane. Each swim
lane, by default represents a state that the items can be in.

When work is started on the user story’s tasks, drag the user story to the Active swim lane.

© The Independent Institute of Education (Pty) Ltd 2023 Page 63 of 290


IIE Module Manual APPR6312

Figure 58: Team Board with One Active User Story

To mark a task as complete:

1. Click the task button (with the icon) on the user story.

Figure 59: Tasks Expanded

2. The list of tasks associated with the user story will be displayed. Click the checkbox
to the left of the task that is complete.

Figure 60: Task Completed

Continue completing tasks until everything is done. Eventually, the user story will get
moved on to the next lane. When this happens depends on how the team uses the swim
lanes and the definition of done.

© The Independent Institute of Education (Pty) Ltd 2023 Page 64 of 290


IIE Module Manual APPR6312

4.6.2 Customising Boards

There are lots of customisations that can be done for boards for each specific team. Here
we will focus on how to create more columns, but you can explore the rest of the settings
yourself.

To create a new column on the board:

Figure 61: Configure Team Settings Button

1. Click the Configure team settings button (with the icon) at the top right of the
board.

2. Under the Board category, click Columns.


3. Click Column. The new column properties will be displayed on a new tab, as
shown in Figure 62.
4. Enter the Name for the new column. The name would depend on how the team
uses the board. Let us just call it Preparation for illustration purposes.

© The Independent Institute of Education (Pty) Ltd 2023 Page 65 of 290


IIE Module Manual APPR6312

Figure 62: New Column Properties

5. Enter a Work in progress limit.

Figure 63: More New Column Properties

6. Choose which state items in this column get set to.


7. Enter text that explains what the definition of done is – when the user story can be
moved out of this swim lane to the next one.
8. Optionally, move the column to a different position by dragging the bar of dots at the
top of the tab, just to the left of the column name.
9. Click Save & Close.

Figure 64: New Column Added to the Board

© The Independent Institute of Education (Pty) Ltd 2023 Page 66 of 290


IIE Module Manual APPR6312

4.7 Using Dashboards


A dashboard in Azure DevOps is a central place where you can at a glance see a lot of
information. The dashboards are highly configurable, and you can add many kinds of
widgets and graphs. (KathrynEE, et al., 2019)

To view the project’s dashboard, click Dashboards under Overview on the navigation
pane.

When a new project is created, the dashboard doesn’t have any widgets yet. This is up to
the users to configure exactly as they want.

To add a widget to a dashboard:

1. Click Edit.

Figure 65: Add Widgets Interface

2. Drag and drop any of the widgets into a position in the grid of grey squares. The
sizes of the widgets differ according to how much space each needs to display its
information.
3. When you are satisfied with the layout, click Done Editing.

If you want to add something you do not see, browse the Extension Gallery (link at the
bottom of Figure 65). There are many available extensions, some free and some paid.

© The Independent Institute of Education (Pty) Ltd 2023 Page 67 of 290


IIE Module Manual APPR6312

To create a new dashboard:

Figure 66: Dashboards Actions

1. At the top of the dashboard, click the down arrow next to the dashboard name.
2. Click New dashboard.

Figure 67: Create a Dashboard

3. Enter a Name for the new dashboard.


4. Choose which Team the dashboard will be associated with.
5. Enter a Description for the dashboard.
6. Choose whether to automatically refresh the dashboard every five minutes.
7. Click Create.

© The Independent Institute of Education (Pty) Ltd 2023 Page 68 of 290


IIE Module Manual APPR6312

5 Recommended Additional Reading


5.1 Lean Start-up
Mantini, N., 2018. Design Thinking, Lean Start-up and Agile: What is the difference?
[Online]. Available at: https://medium.com/xplor8/design-thinking-lean-startup-and-agile-
what-is-the-difference-1eed3594b121
[Accessed 12 July 2021].

5.2 Scrum
Schwaber, K. & Sutherland, J., 2017. The Scrum Guide. The
Definitive Guide to Scrum: The Rules of the Game. [Online]
Available at: E-book
https://www.scrumguides.org/docs/scrumguide/v2017/2017-
Scrum-Guide-US.pdf#zoom=100 [Accessed 12 July 2021].

Free registration is required to access the following resource:

SCRUM study, 2017. A Guide to the Scrum Body of Knowledge


(SBOK™ Guide) – Third edition. [eBook] Available at:
https://www.scrumstudy.com/sbokguide/ [Accessed 12 July E-book
2021] ed. Avondale, Arizona: SCRUM study.

5.3 Kanban
Kanbanize, (2019). Kanban Explained for Beginners. [Online]. Available at:
https://kanbanize.com/kanban-resources/getting-started/what-is-kanban/ [Accessed 12
July 2021].

Free registration is required to access the following resource:

Karaivanov, D., n.d. Project Manager’s Guide to Kanban. [eBook] Available at:
https://universe.kanbanize.com/project-managers-guide-to-kanban/?cm=PMbookdownl&
cn=whatiskanban [Accessed 12 July 2021].

5.4 Scrumban
Pahuja, S., n.d. What is Scrumban? [Online]. Available at:
https://www.agilealliance.org/what-is-scrumban/
[Accessed 12 July 2021].

PlanView, 2019. What is Scrumban? [Online]. Available at:


https://leankit.com/learn/agile/what-is-scrumban/
[Accessed 12 July 2021].

© The Independent Institute of Education (Pty) Ltd 2023 Page 69 of 290


IIE Module Manual APPR6312

5.5 Azure Boards


Automation Consultants, 2019. Azure DevOps vs Jira. [Online]. Available at:
https://www.automation-consultants.com/azure-devops-vs-jira/ [Accessed 12 July 2021].

Azure DevOps Labs, (2019). Agile Planning and Portfolio Management with Azure
Boards. [Online]. Available at:
https://www.azuredevopslabs.com/labs/azuredevops/agile/#prerequisites [Accessed 12
July 2021].

Danielson, S. et al., 2019. Plan your organisational structure. [Online]. Available at:
https://docs.microsoft.com/en-us/azure/devops/user-guide/plan-your-azure-devops-org-
structure?toc=%2Fazure%2Fdevops%2Forganizations%2Ftoc.json&bc=%2Fazure%2Fde
vops%2Forganizations%2Fbreadcrumb%2Ftoc.json&view=azure-devops [Accessed 12
July 2021].

IT Central Station, 2019. Compare JIRA vs. Microsoft Azure DevOps. [Online]. Available
at: https://www.itcentralstation.com/products/comparisons/jira_vs_microsoft-azure-devops
[Accessed 12 July 2021].

KathrynEE et al., 2019. What are Azure Boards? [Online]. Available at:
https://docs.microsoft.com/en-us/azure/devops/boards/get-started/what-is-azure-
boards?view=azure-devops&tabs=basic-process [Accessed 12 July 2021].

KathrynEE, et al., 2019c. Choose a process. [Online].


Available at: https://docs.microsoft.com/en-us/azure/devops/boards/work-
items/guidance/choose-process?view=azure-devops&tabs=basic-process [Accessed 12
July 2021].

6 Recommended Digital Engagement and Activities


6.1 Scrum
If you want to learn more about Scrum, do the free Scrum Fundamentals Certified training
available at https://www.scrumstudy.com/certification/scrum-fundamentals-certified. You
can also complete the free online Scrum Fundamentals Certification (only the first level of
certification is free).

© The Independent Institute of Education (Pty) Ltd 2023 Page 70 of 290


IIE Module Manual APPR6312

6.2 Azure Boards

Watch the video How to pronounce the name of Microsoft’s cloud: Azure, available at
https://www.youtube.com/watch?v=AmP11EgEM4g

Watch the video Plan your work with Azure Boards at https://sec.ch9.ms/ch9/6f7f/424c1d79-4896-
4b8e-9034-0aa80ecb6f7f/AzureBoards_high.mp4

© The Independent Institute of Education (Pty) Ltd 2023 Page 71 of 290


IIE Module Manual APPR6312

Learning Unit 2: Web Application Development for Azure


Cloud
Learning Objectives: My notes
• Identify the components of a web application in Azure.
• Explain how the architecture of a web application can be
changed to improve scalability.
• Explain the different Azure SQL Database deployment
models.
• Explain the difference between .NET Framework and .NET
Core.
• Create and publish an Azure ASP.NET Core web application.
• Explain why Azure Functions is described as serverless.
• Create and deploy an Azure Functions application.
Material used for this learning unit:
• This module manual.
• Microsoft Visual Studio 2022.
• Microsoft Azure SQL Database.
• Microsoft Azure App Services.
• Microsoft Azure Functions.
How to prepare for this learning unit:
• Read through the content of this learning unit.
• Work through the activities on Learn.

1 Introduction
In this learning unit, we will learn how to develop a web application for the Microsoft Azure
platform. You already have much of the knowledge required for this task. You know how to
design a database, you know how to create a web service, and you know how to create a
web front end. Here we will be applying all that knowledge to creating a cloud application.

2 Cloud Terminology
Before we jump into the how of it, there is some cloud terminology that you will need to
know to understand where things fit in.

In enterprise software applications, everything was traditionally located at the company.


This means the company would have to buy physical servers, install network infrastructure,
maintain airconditioned and fireproof server rooms, and install and maintain operating
systems, databases, and application software. Everything had to be done in-house since
there were just no other options available. However, the cloud changed all that.

© The Independent Institute of Education (Pty) Ltd 2023 Page 72 of 290


IIE Module Manual APPR6312

2.1 Cloud Computing


So, what is cloud computing?

“Cloud computing, often referred to as simply ‘the cloud,’ is the delivery of on-demand
computing resources — everything from applications to data centres — over the internet on
a pay-for-use basis.” (IBM, n.d.)

The cloud provider is responsible for buying servers, maintaining server rooms, and
providing enough bandwidth. If a company needs a new database, it is as easy as just
signing up and requesting the resource. And, of course, paying for the service. Minutes
later, the new database is up and running.

“Simply put, cloud computing is the delivery of computing services – including servers,
storage, databases, networking, software, analytics, and intelligence – over the Internet
(“the cloud”) to offer faster innovation, flexible resources, and economies of scale. You
typically pay only for cloud services you use, helping you lower your operating costs, run
your infrastructure more efficiently, and scale as your business needs change.” (Microsoft,
2019b)

Microsoft’s definition adds a little more information. We have already seen that cloud
computing provides flexible resources. But added to that, Microsoft says that it also
encourages “faster innovation” and that it makes it possible to take advantage of
“economies of scale”. This means that by providing cloud services on a large scale, a cloud
provider can do it cheaper than a company would have been able to on their own.

Another point in the Microsoft definition mentions that cloud computing allows businesses
to scale as their needs change. Consider a Black Friday sale. An online retailer that offers
Black Friday specials can expect many times the normal volume of traffic over a period of
a couple of days. It would be great if the infrastructure can scale with this sudden increase
in demand. And cloud computing does precisely that.

2.2 Local Providers


To ensure the lowest possible latency, as well as compliance with the Protection of
Personal Information (PoPI) Act, it is important to use cloud providers with a physical
South African presence.
There are several options available for cloud hosting providers with South African data
centres:

• Microsoft Azure opened data centres in Johannesburg and Cape Town in March
2019. (Moyo, 2019)
• Huawei also opened a data centre in Johannesburg in March 2019. (McKane, 2019)
• Amazon has a data centre for Amazon Web Services (AWS) in Cape Town.
(Amazon, 2022)
• Oracle opened a cloud data centre in Johannesburg in January 2022. (Oracle,
2022)

© The Independent Institute of Education (Pty) Ltd 2023 Page 73 of 290


IIE Module Manual APPR6312

2.3 Deployment Models


The above discussion sounds like the services are always run in the cloud provider’s data
centre. But that is not the only deployment model, called a public cloud. “With a public
cloud, all hardware, software, and other supporting infrastructure is owned and managed
by the cloud provider.” (Microsoft, 2019b)

The second deployment model is a private cloud. It is a model where the resources are
used by only a single organisation, and it can be located on the client’s own data centre or
located in a dedicated third-party data centre. (Microsoft, 2019b) But this sounds a lot like
the traditional on-site situation – why would you even consider going this route? Some
companies have security and regulatory requirements that make storing data in a public
cloud impossible. In that case, a private cloud means that they can still take advantage of
the technologies but of course at the cost of maintaining a data centre.

The third deployment model is hybrid cloud. In this model, a private and public cloud is
used together, and they can exchange data. (Microsoft, 2019b) The most sensitive data can
be stored on the private cloud, but the processing resources of the public cloud can still be
used.

2.4 Types of Cloud Computing


There are three types of cloud computing (Microsoft, 2019b):

• Infrastructure as a service (IaaS)


• Platform as a service (PaaS) (which overlaps with the serverless computing concept)
• Software as a service (SaaS)

The difference between these three types of cloud computing is all about which parts are
managed by the cloud provider, as shown in Figure 68.

© The Independent Institute of Education (Pty) Ltd 2023 Page 74 of 290


IIE Module Manual APPR6312

Figure 68: Aspects managed by the cloud provider in IaaS, PaaS and SaaS. (Based
on (Microsoft, 2019c))

2.4.1 Infrastructure as a service (IaaS)

IaaS is cloud computing where infrastructure can be acquired on demand, including


physical servers and virtual machines (VMs). (Microsoft, 2019b) This is the easiest
migration step if a company already has on-site infrastructure. Nothing needs to be
changed to the enterprise software itself – it just needs to be installed on configured on a
new server in the cloud.

2.4.2 Platform as a service (PaaS)

This is the type of cloud computing that we are most interested in for this learning unit since
the web application that we will create will make use of the Microsoft Azure PaaS offering.

PaaS means that the service provider takes care of a lot of things for us. We don’t need to
worry about installing and keeping an up-to-date an operating system or even the database
management system (DBMS) we will use. We can instead focus on developing the
application software that will add business value. (Microsoft, 2019b)

2.4.3 Software as a service (SaaS)

With SaaS, software applications are delivered on a subscription basis. The cloud provider
manages everything, including the hosted applications. (Microsoft, 2019b) Microsoft Azure
DevOps is an example of SaaS. In the first learning unit, we made use of the software

© The Independent Institute of Education (Pty) Ltd 2023 Page 75 of 290


IIE Module Manual APPR6312

functionality without ever needing to know any of the underlying infrastructure or even the
details of the software implementation. It is an end-user application, even though, in this
case the end users are sometimes software developers themselves.

3 Azure Web Architecture


3.1 Basic Web Application
Microsoft Azure offers many products out of the box. These products can be arranged into
categories, for example (Microsoft, 2019d):

• AI and machine learning;


• Blockchain;
• Compute;
• Containers;
• Databases;
• Internet of Things;
• Security;
• Web.

No single module could even touch on all these categories, let alone all the available
products. And in addition to the Microsoft offerings, there is also a marketplace where
third parties offer many more apps and even services. So, we will focus on creating a web
application.
Let’s look at the reference architecture components for a basic web application, as shown
in Figure 69.

Figure 69: Basic Azure Web Application – Reference Architecture


(from (Wasson, et al., 2017))

© The Independent Institute of Education (Pty) Ltd 2023 Page 76 of 290


IIE Module Manual APPR6312

A resource group is a way to group several related items so that they can be managed
together and, more importantly, the cost of the resource group can be controlled. (Owen,
2019)

The dotted boundary in Figure 69 indicates that two items fall outside the scope of the
specific resource group: Azure DNS and Azure Active Directory.

Azure DNS is a Domain Name System (DNS) that makes it possible for domain names to
resolve to domains hosted in Azure. To use this, a domain name must be registered first,
and then Azure DNS can be used for the address resolution. (Horne, et al., 2019)

What does this mean in practice? By default, when you work with Azure services, you get
assigned a subdomain on one of the existing Azure domains. For a database, for example,
it could be mynewamazingdatabase.database.windows.net where the part in bold is the
existing Azure domain. (Microsoft, n.d.) But what if you wanted the database to be reachable
by mynewamazingdatabase.co.za instead? You would configure that in Azure DNS.

The other element outside the resource group is Azure Active Directory (AD). It is a cloud-
based identity service – users can sign in and be granted access to internal or external
resources based on their logins that are configured in Azure AD. (Ross, et al., 2019) Using
Azure AD is beyond the scope of this module.

With those two things out, let us look at the items inside the resource group – and within
our control.

3.1.1 Storage Blob

Azure Storage, specifically the blob storage service, is used in this reference architecture
to store diagnostic logs. (Wasson, et al., 2017)

Azure Blob storage is “optimised for storing massive amounts of unstructured data, such
as text or binary data.” (Myers, et al., 2019) Diagnostic logs fit the bill perfectly – it is
unstructured text data. Diagnostic logs can be generated at various levels, from the
database to the web front end.

3.1.2 Azure SQL Database

Azure SQL Database is a platform as a service (PaaS) database product. Microsoft


handles all the maintenance of the database engine as the cloud provider. (Microsoft, n.d.
b) This is by no means the only available database in the Azure cloud, but for this module,
it is what we will use.

© The Independent Institute of Education (Pty) Ltd 2023 Page 77 of 290


IIE Module Manual APPR6312

Figure 70: SQL Database – extract from Figure 69.

Figure 70 shows just the database part of the bigger diagram. We can see that there are
two parts to it – a logical server and some databases. The logical server hosts one or
more databases. (Wasson, et al., 2017) The logical server will have its own subdomain
that we can use to access it.

3.1.3 Azure App Service

“Azure App Service enables you to build and host web apps, mobile back ends, 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.”
(Microsoft, n.d. c)

Azure App Service is the cloud product where the web application will be hosted. It is
very flexible in terms of what you can host there – applications can range from .NET to
Node.js to PHP and even Java. (Microsoft, n.d. c) For our purposes, we will be creating
C# .NET web applications since that is what we know already.

Figure 71: App Service – extract from Figure 69.

Figure 71 shows just the App Service part of the bigger picture. Like the SQL Database
picture, this consists of two parts: App Service plan and App Service web app.

© The Independent Institute of Education (Pty) Ltd 2023 Page 78 of 290


IIE Module Manual APPR6312

Web apps run within an App Service plan, which defines the resources available to a
web app when it is running. Multiple apps can be configured to run on the same
resources. (Lin, et al., 2017)

It is important to note that there are different pricing tiers for an App Service plan. This
ranges from Free to Shared (inexpensive but paid per hour) all the way to Isolated which
provides dedicated VMs at a premium. Free should be more than enough for our
purposes.

Read more about the different pricing tiers at: https://azure.microsoft.com/en-


gb/pricing/details/app-service/windows/

3.2 Scalable Web Application


The basic architecture described above can be scaled, but it is not the best possible
architecture for scaling. A reference architecture that is designed for scaling is shown in
Figure 72.

Figure 72: Scalable Azure Web Application – Reference Architecture


(from (Wasson, et al., 2019))

We see a few familiar products in this architecture: Azure Active Directory, Azure DNS,
Azure App Service, Azure Blob storage and Azure SQL Database. Read Section 3.1
again for information about those.

Let’s briefly consider the new items that we will not discuss in detail:

• Azure Front Door is a load balancer, that also includes a web application firewall.
(Wasson, et al., 2019)
• Azure Content Delivery Network (CDN) is a product that caches publicly available
content as close to the end user as possible. (Wasson, et al., 2019)

© The Independent Institute of Education (Pty) Ltd 2023 Page 79 of 290


IIE Module Manual APPR6312

• Azure Cache for Redis stores data that changes infrequently, to avoid reading that
from the database and thus improve performance. (Wasson, et al., 2019)
• Azure Search used with one or more data stores, provides search suggestions,
language-specific search and more. (Wasson, et al., 2019)
• Azure Cosmos DB can be used for non-relational data. (Wasson, et al., 2019) It is a
highly scalable database accessed through NoSQL application programming
interfaces (APIs) such as MongoDB, Cassandra, or Gremlin. And it can even be
accessed using Structured Query Language (SQL). (Gentz, et al., 2019)
• Azure Queue storage is a mechanism that is used to queue background tasks.
(Wasson, et al., 2019)

3.2.1 Azure Functions

The Azure Functions app in Figure 72 is used to run background tasks. (Wasson, et al.,
2019)

“Azure Functions is an event-driven, compute-on-demand experience that extends the


existing Azure application platform with capabilities to implement code triggered by events
occurring in Azure or third-party service as well as on-premises systems.” (Mashkowski,
2016)

This is the definition of Azure Functions from the initial product announcement, but it still
captures the essence well. Firstly, it is event-driven – something happens that triggers the
code. Secondly, it is a compute-on-demand product. Let’s unpack these two facts more,
starting with the second one.

A function is what it sounds like – it is a small piece of code that can run in the cloud.
Applications developed using Functions are considered serverless – no infrastructure or
even an application needs to be managed. It is just a piece of code that has a specific job.
(Gailey, et al., 2017)

There are different pricing plans for Functions: consumption (pay just when the function
runs), premium (pre-warmed instances can run immediately) and app service plan (run
functions as part of an existing App Service). (Gailey, et al., 2017)

There are several different triggers that can start the execution of a function, including
(Gailey, et al., 2017):

• Hypertext Transfer Protocol (HTTP) request;


• Timer task;
• Database trigger;
• Queue message received.

© The Independent Institute of Education (Pty) Ltd 2023 Page 80 of 290


IIE Module Manual APPR6312

4 Azure SQL Database


4.1 Deployment Options
Azure SQL is Microsoft’s flagship relational database solution for the Azure cloud. We
already saw one of the possible deployment options in the basic web application
reference architecture. But as you might expect of their flagship product, this is not by any
means the only option.

Figure 73: Azure SQL Deployment Options

• SQL Virtual Machines is an IaaS option for hosting a SQL server in the cloud. This
option gives complete access to the virtual machine where a SQL server instance is
installed. This is a good option when migrating to the cloud, if operating system-level
access is required. (Rabeler, et al., 2019)
• SQL Managed Instance is a PaaS option. This means that it provides the benefits
of PaaS such as automatic updates of the database engine. However, it does allow
more control of the database engine. This means it is also a good option for many
migrations to the cloud. (Rabeler, et al., 2019)
• SQL Databases is the deployment option that we have already seen. It is the best
PaaS solution for modern cloud applications. In fact, this is also called a relational
database-as-a-service (DBaaS). Three options falls under this: single database
with its resources, elastic pool with resources shared between databases, and a
database server (the logical server that we saw before) that is the central
management point for databases and pools. (Rabeler, et al., 2019)

Related to the deployment options are the two purchase models for SQL Databases:

• Database transaction unit (DTU)-based purchasing model. This model is available


for single database and elastic pool deployments. Each package under this model
bundles both compute and storage resources. (Oslake, 2019)
• Virtual core (vCore)-based purchasing model. This model is available for a single
database, elastic pool and managed instance deployments. This allows the user to
choose compute and storage resources independently. (Oslake, 2019)

© The Independent Institute of Education (Pty) Ltd 2023 Page 81 of 290


IIE Module Manual APPR6312

The purchasing model can be changed without taking the database offline. A rule of
thumb is that if a database or elastic pool consumes more than 300 DTUs, it may be
cheaper to change from DTU to vCore-based purchasing. (Oslake, 2019)

4.2 Provisioning an Azure SQL database

4.2.1 The Scenario – DJs and their gigs

A group of DJs (disk jockeys) has approached you to build a website to promote
themselves. They want to have a dynamic site where their fans can see when they are
scheduled to play at which venue. Past events should automatically be removed from the
site.

Throughout the rest of this learning unit, we will build a web application based on this
scenario.

4.2.2 Entity Relationship Diagram

We are going to be storing some relational data in an Azure SQL Database. Figure 74
shows an entity relationship diagram (ERD) that was drawn for the business rules
specified by the DJs.

© The Independent Institute of Education (Pty) Ltd 2023 Page 82 of 290


IIE Module Manual APPR6312

Figure 74: ERD for the DJ data

Revision Question
What type of relationship is depicted in this ERD? Why?

4.2.3 Working with Databases in Azure

We will be using a single SQL database – the PaaS version. This means that the
database is somewhere in the cloud, and we don’t have access to the virtual machine or
the database engine instance. So, how do we access this then?

There are multiple ways in which one can interact with a SQL database in Azure:

• Command line tools:


▪ PowerShell – locally installed tools, see (huypub, 2019)
▪ Azure Command Line Interface (CLI) – locally installed tools, see (Clark, et al.,
2019)
▪ Azure Cloud Shell – command line tools (Bash or PowerShell) accessed in
your browser at https://shell.azure.com/. For more information, see (Luk, et al.,
2019)
• Azure Portal – graphical web interface available at https://portal.azure.com/

For this module, we will use the Azure Portal to create and manage the database. This is
the most user-friendly way of interacting with the database. Note that if you ever need to
create many databases, however, using a command line script will be more efficient.

© The Independent Institute of Education (Pty) Ltd 2023 Page 83 of 290


IIE Module Manual APPR6312

4.2.4 Creating the Database

To create a database using the Azure Portal:

1. Browse to the Azure Portal at https://portal.azure.com/ (you will need to log in with
your credentials).

Figure 75: Azure Portal – home page

2. On the home page of the portal, under the Azure services category, click Create a
resource.

Figure 76: New Resource

3. Select the Database category on the left.


4. The list of items on the right will update to show the database options. Click SQL
Database (top link, not the QuickStart tutorial).

© The Independent Institute of Education (Pty) Ltd 2023 Page 84 of 290


IIE Module Manual APPR6312

Figure 77: Project Details

5. On the Basics page, under Project details, select a subscription. You should have
only one subscription available.
6. If you don’t have a Resource group yet, click Create new.

Figure 78: Create Resource Group

7. Enter a Name for the resource group and click OK.

Figure 79: Database Name

8. Enter a Database name. Note that the name is validated as you type – make sure
that all the checks pass (show green check marks).

© The Independent Institute of Education (Pty) Ltd 2023 Page 85 of 290


IIE Module Manual APPR6312

Figure 80: Server

9. If you don’t have a Server yet, click Create new. This is where you create the
logical server that will contain the database.

Figure 81: Server Name

10. Enter a Server name. This must be a globally unique name, so you must choose
your own name here.

Figure 82: Server Admin Login

11. Enter the Server admin login name, again paying attention to the validation as you
type. You will need to log in with this username later, so make a note of it.

© The Independent Institute of Education (Pty) Ltd 2023 Page 86 of 290


IIE Module Manual APPR6312

Figure 83: Admin Password

12. Enter a strong Password for the admin user. Again, you will need to know this
password later, so don’t lose it.
13. Enter the same password again under Confirm password.

Figure 84: Location

14. For the Location, choose (Africa) South Africa North. This means that the
database will be stored in the Johannesburg data centre.
15. Click OK.
16. Click Review + create.
17. Click Create.

Figure 85: Creation Process Started

18. Wait for the creation process to complete.

© The Independent Institute of Education (Pty) Ltd 2023 Page 87 of 290


IIE Module Manual APPR6312

Figure 86: Database Deployment Complete

19. Once the deployment is complete, a notification will be displayed to that effect. And
the details of what was deployed is displayed.

Note that none of the R3 050 free credit of the free account was used, even though a cost
was displayed during the creation process. This is because the created server is within the
limits of the free 12 months of SQL Database access.

20. Click Go to resource to view the properties of the database.

Figure 87: Database Properties Overview

Tip: Now that the resource has been created, it will also appear under Recent resources
on the home page of the Azure Portal. If you want to return later to the page shown in
Figure 87, that is the easiest way to find it again.

© The Independent Institute of Education (Pty) Ltd 2023 Page 88 of 290


IIE Module Manual APPR6312

4.3 Querying an Azure SQL Database

4.3.1 Setting up the Firewall

Security is an important concern when it comes to anything in the cloud. To provide security,
there is a firewall that is activated at the logical database server level. By default, the firewall
doesn’t allow any connections to the database. So, we need to set it up so that we can
access it.

First, let’s see whether the firewall is active as we expect.

To connect to the database using the Query editor:

1. On the Azure Portal, browse to the database resource.


2. There will be a list of actions on the left, starting with Overview. Click Query editor
(preview).

Figure 88: Query Editor – Failed Login

3. Enter the admin username and password that you specified when you created the
database.
4. You will see an error message that contains the IP address that you tried to connect
with. This is the address that you will need to allow access for.

© The Independent Institute of Education (Pty) Ltd 2023 Page 89 of 290


IIE Module Manual APPR6312

When we connect to the internet, our Internet Service Provider (ISP) assigns us a
dynamically allocated address within their address range. This means that our public IP
address probably will change over time.

To allow a specific IP address to access the database:

1. On the Azure Portal, browse to the database resource.


2. Click Overview.

Figure 89: Accessing Firewall Settings

3. Click Set server firewall.

Figure 90: Firewall Settings

4. Click Add client IP. This will add a rule to allow the device that you are currently
browsing from.
5. Click Save.
6. Go back to the database and try to connect again. This time the connection should
succeed.

© The Independent Institute of Education (Pty) Ltd 2023 Page 90 of 290


IIE Module Manual APPR6312

4.3.2 Running Queries

Figure 91: Query Editor

In Figure 91, we see what the Query Editor that is built into the Azure Portal looks like
with the Tables, Views and Stored Procedures categories expanded. It is a very useful
tool to quickly access the database, but we don’t exactly have anything to look at.

As an exercise, you might want to write the CREATE TABLE SQL script yourself based
on the ERD provided in Section 4.2.2 before continuing.

To create tables using the Query editor:

1. Copy the below SQL commands into the query editor area.

CREATE TABLE DJ (
DJID INT NOT NULL IDENTITY PRIMARY KEY,
Stage Name NVARCHAR(200)
);

CREATE TABLE Venue (


VenueID INT NOT NULL IDENTITY PRIMARY KEY,
Name NVARCHAR(200),
Address NVARCHAR(200),
);

CREATE TABLE Gig (


GigID INT NOT NULL IDENTITY PRIMARY KEY,
DJID INT NOT NULL,
VenueID INT NOT NULL,
Date DATE,
Time TIME,
FOREIGN KEY (DJID) REFERENCES DJ (DJID),
FOREIGN KEY (VenueID) REFERENCES Venue (VenueID)
);

2. Click Run.

© The Independent Institute of Education (Pty) Ltd 2023 Page 91 of 290


IIE Module Manual APPR6312

Figure 92: Running a Query

3. You should see a message indicating that the query was successful, with 0 affected
rows.

Figure 93: Refresh Button

4. Above the tree on the left, click the Refresh button (the one with the icon).

© The Independent Institute of Education (Pty) Ltd 2023 Page 92 of 290


IIE Module Manual APPR6312

Figure 94: Expanded Tables Node

5. Expand the Tables node to see the brand-new tables.

Exercise: Insert some data into the tables using INSERT statements before continuing to
the next section.

What result is displayed when you run an INSERT statement?

Once you have inserted some data, run a SELECT query on one of table tables. You will
see that the results are displayed in the results pane, as shown in Figure 95.

Figure 95: Query Results Pane with Data

© The Independent Institute of Education (Pty) Ltd 2023 Page 93 of 290


IIE Module Manual APPR6312

4.3.3 Accessing Data from a Console Application

So far, we have created a database, set up the firewall to allow access from our public IP
address, and executed a couple of SQL statements. This is good progress, but it is not quite
satisfying to know the database exists out there now. It would be great to see the data in
use. So, let us create a simple console application that displays the list of all the DJs as
proof of concept.

As we saw in Programming 2B, we need to tell .NET where to find the database when we
want to access data using ADO.NET or Entity Framework. This is done by means of a
connection string. The good news is that getting the correct connection string for our
database is easy, straight from the Azure Portal.

To get the database connection string:

1. Browse to the database on the Azure Portal.


2. On the left, under the Settings category, click Connection strings.

Figure 96: Connection Strings

3. Make sure that the ADO.NET tab is active and copy the connection string.

The PHP and Go tabs provide more than just connection strings – those provide code that
can be used to connect to the database.

You will notice that everything has been filled in except for the password. So, be sure to
replace {your password} with your actual password that you used to create the admin user.

Note that in real-world applications, it is not advisable to use the administrator login
details for database access since that will provide the application (and by extension the user
access) to everything. Users can be created with the CREATE USER SQL statement. For
more information, read (Rabeler, et al., 2019b).

To read data from the database using a console application:

1. Start Visual Studio.

© The Independent Institute of Education (Pty) Ltd 2023 Page 94 of 290


IIE Module Manual APPR6312

Figure 97: Start Window Buttons

2. On the start window, under Get started, click Create a new project.

Figure 98: Create New Project Window

3. Choose Console App (.NET Framework) and click Next.


4. Specify a Project name and Location for your project.
5. Choose which Framework version to use.
6. Click Create.
7. Copy and paste the following code into the main method. The code was adapted
from (Rabeler, et al., 2019c).

© The Independent Institute of Education (Pty) Ltd 2023 Page 95 of 290


IIE Module Manual APPR6312

try
{
string connectionString = "";

using (SqlConnection connection = new SqlConnection(connectionString))


{
connection.Open();

Console.WriteLine("=========================================");
Console.WriteLine("DJs in da house!");
Console.WriteLine("=========================================\n");

String sql = "SELECT * FROM DJ;";

using (SqlCommand command = new SqlCommand(sql, connection))


{
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine("{0} - {1}",
reader.GetInt32(0), reader.GetString(1));
}
}
}
}
}
catch (SqlException e)
{
Console.WriteLine(e.ToString());
}
Console.ReadLine();

8. Add a using statement for the System.Data.SqlClient namespace.


9. Initialise the connectionString variable with the connection string to your database.
Remember to put in the password!
10. Run the application.

Figure 99: Console App Output

© The Independent Institute of Education (Pty) Ltd 2023 Page 96 of 290


IIE Module Manual APPR6312

5 Azure App Services


5.1 .NET Framework vs .NET Core
This section is adapted from (The Independent Institute of Education, 2018), Learning Unit
2.

When you create a new project in Visual Studio, you may have noticed that there is a
distinction between .NET Framework, .NET Core and .NET Standard projects (see Figure
100). What are the differences?

Figure 100: Visual Studio Projects

.NET Framework was the original platform for Windows only, developed by Microsoft. The
latest version is 4.8, which was released in 2019. (Microsoft, 2022) By tech standards, 2019
was a very long time ago. So, what had happened since?

Microsoft decided to create a new cross-platform framework and called it .NET Core. The
fact that .NET Core is cross-platform is a big advantage over the older .NET Framework.
But not all the technologies available for the .NET Framework are yet (or maybe will ever
be) available for .NET Core. So, there are several factors to weigh up when choosing which
one to use. Read (Carter, et al., 2018) for more guidance on when to choose which runtime.

So, we have two different run-times provided by Microsoft – but what then is .NET
Standard? .NET Standard is the name for the common APIs that work across all the different
runtimes. (Bisson, 2017)

Figure 101 shows a representation of the .NET ecosystem, including the Mono cross-
platform runtime that is used for Xamarin mobile apps. (Luijbregts, 2018)

© The Independent Institute of Education (Pty) Ltd 2023 Page 97 of 290


IIE Module Manual APPR6312

Figure 101: .NET Ecosystem

Read (Luijbregts, 2018) for more information about the .NET ecosystem.

With the release of .NET 5, Microsoft decided to unify .NET Framework and .NET Core.
(Michaelis, 2019) The new .NET 5 would be based on .NET Core 3, but the number was
chosen to be larger than the last version .NET Framework.

In November 2021, Microsoft released .NET 6. This is a long-term support release and the
culmination of the work done to unify the previous two platforms. (L, 2021)

In the rest of the manual, we will refer to simply to .NET, meaning this new incarnation of
.NET Core that no longer has Core in the name.

Azure App Service supports both .NET Framework and .NET. When you create a new web
app in Azure App Service, one of the options that you choose is the operating system that
the code will be running on. Choose .NET if you want to run the app on Linux.

Note that Visual Studio 2019 only supports up to .NET 5.

For this learning unit, we will be creating an ASP.NET Core web application that displays
data from our Azure SQL database.

5.2 Creating an ASP.NET Core Web App


We will be using Visual Studio 2022, with the ASP.NET workload installed.

Figure 102. Visual Studio Installer

© The Independent Institute of Education (Pty) Ltd 2023 Page 98 of 290


IIE Module Manual APPR6312

5.2.1 Creating the Project

To create the web app project:

1. Start Visual Studio.


2. Create a new project.

Figure 103: New Project Wizard – ASP.NET Core Web

3. Choose the project type ASP.NET Core Web App.


4. Click Next.

© The Independent Institute of Education (Pty) Ltd 2023 Page 99 of 290


IIE Module Manual APPR6312

Figure 104: Configure Web Project

5. Enter DJPromoWebApp for the Project name and choose a Location for the
project.
6. Click Next.

Figure 105: Configure Web Project Part 2

© The Independent Institute of Education (Pty) Ltd 2023 Page 100 of 290
IIE Module Manual APPR6312

7. Choose .NET 5.0 as the Target Framework.


8. Click Create.

So far, we haven’t done anything new yet – this should feel quite familiar from
Programming 2B (PROG6212).

5.2.2 Running the App Locally

To run the web app locally, click the run button on the toolbar in Visual Studio.

Figure 106: Running the Web App

The new web app should be displayed in your default browser, looking something like
Figure 107.

Figure 107: New ASP.NET Core Web App Running

5.2.3 Creating the Entities

When creating the project, we chose to use Model-View-Controller (MVC). We will need to
implement a model to access data from the database. Then Entity Framework (EF) Core
will be able to retrieve the data.

This section is adapted from (Anderson, et al., 2019).

© The Independent Institute of Education (Pty) Ltd 2023 Page 101 of 290
IIE Module Manual APPR6312

To create the model:

Figure 108: Adding a Folder

1. In the Solution Explorer, right-click the project, choose Add and then New Folder.
2. Name the folder Models and press Enter.

Figure 109: Adding a Class

3. Right-click the Models folder.


4. Choose Add and then Class.
5. Enter the Name DJ.cs.
6. Click Add.
7. Updated the class DJ with the following code:

© The Independent Institute of Education (Pty) Ltd 2023 Page 102 of 290
IIE Module Manual APPR6312

public class DJ
{
[Key]
public int DJID { get; set; }
public string StageName { get; set; }
}

8. Add a using statement to class DJ for the namespace


System.ComponentModel.DataAnnotations.
9. Create another class, this time called Venue.cs.
10. Update the class Venue with the following code:

public class Venue


{
[Key]
public int VenueID { get; set; }
public string Name { get; set; }
public string Address { get; set; }
}

11. Add a using statement to class Venue for the namespace


System.ComponentModel.DataAnnotations.
12. Create a third class, this time called Gig.cs.
13. Update the class Gig with the following code:

public class Gig


{
[Key]
public int GigID { get; set; }
[ForeignKey("DJ")]
public int DJID { get; set; }
[ForeignKey("Venue")]
public int VenueID { get; set; }
public DJ DJ { get; set; }
public Venue Venue { get; set; }
[Datatype(Datatype. Date)]
public Date Time Date { get; set; }
[Datatype(Datatype. Time)]
public Timespan Time { get; set; }
}

14. Add a using statement to class Gig for the namespace


System.ComponentModel.DataAnnotations and another for
System.ComponentModel.DataAnnotations.Schema.

© The Independent Institute of Education (Pty) Ltd 2023 Page 103 of 290
IIE Module Manual APPR6312

5.2.4 Adding the EF Core NuGet Package

The project that we created doesn’t come with Entity Framework (EF) support out of the
box. We need to add it using NuGet.

1. In the Solution Explorer window, right-click the DJPromoWebApp project.

Figure 110: Manage NuGet Packages

2. Click Manage NuGet Packages.


3. On the NuGet Package Manager window, click the Browse tab.

© The Independent Institute of Education (Pty) Ltd 2023 Page 104 of 290
IIE Module Manual APPR6312

Figure 111: NuGet Package Manager

4. In the search field at the top of the tab, enter Entity Framework.
5. Select Microsoft.EntityFrameworkCore.SqlServer.
6. Choose Version 5.0.16.
7. Click Install.
8. If the Preview Changes dialog is displayed, review the changes and click OK.
9. On the License Acceptance window, click I Accept.

Note that for production software, you should ensure the license agreement will work for
your project. See legal counsel if you are unsure about license agreements in a
professional context.

10. Wait for the process to complete.


11. Follow the same steps to add the Microsoft package.EntityFrameworkCore.Design
version 5.0.16 too.

Figure 112: Entity Framework Core Dependency

12. When the dependencies have been added, they will be visible in the Solution
Explorer.
13. Close the NuGet Package Manager window.

5.2.5 Create a Database Context Class

This section is adapted from (Anderson, et al., 2019) and (EntityFrameworkTutorial.net,


2019).

© The Independent Institute of Education (Pty) Ltd 2023 Page 105 of 290
IIE Module Manual APPR6312

Figure 113: Creating a New Folder

1. In the Solution Explorer, right-click the DJPromoWebApp project.


2. Click Add and then New Folder.
3. Enter Data as the folder name, and press Enter.
4. Right-click the Data folder and create a new class called DJContext.cs.
5. Overwrite the contents of the file with the following code:

using DJPromoWebApp. Models;


using Microsoft.EntityFrameworkCore;

namespace DJPromoWebApp.Data
{
public class DJContext : DbContext
{
public DJContext(DbContextOptions<DJContext> options)
: base(options)
{
}

public DbSet<Gig> Gig { get; set; }


public DbSet<DJ> DJ { get; set; }
public DbSet<Venue> Venue { get; set; }
}
}

6. This DbContext needs to be registered. To do this, open Startup.cs.


7. Add the following code to the ConfigureServices method:

services.AddDbContext<DJContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DJContext")));

8. We also need to add the connection string to the settings file. Open
appsettings.json.

© The Independent Institute of Education (Pty) Ltd 2023 Page 106 of 290
IIE Module Manual APPR6312

9. Change the file so it looks like this (bold part was added):

{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DJContext": "<your connection string here>"
}
}

10. Insert the connection string to your database. Remember the password!

5.2.6 Reading and Displaying Data

To read and display the data:

1. Under the Pages folder, create a new folder called Gigs.

Figure 114: Creating a Scaffolded Item

2. Right-click the Gigs folder, choose Add and then New Scaffolded Item.

Figure 115: Razor Page with Entity Framework

3. Under the Razor Pages category, choose Razor Page using Entity Framework.
4. Click Add.

© The Independent Institute of Education (Pty) Ltd 2023 Page 107 of 290
IIE Module Manual APPR6312

Figure 116: New Page Configuration

5. Set up all the configuration for the new page as shown in Figure 116.
6. Click Add.
7. Once the process completes, open the Gigs.cshtml file.
8. Delete the @page line from the file (if it exists) and save the file.
9. Open the Index.cshtml file, and change the contents of the file to look like this:

@page
@model DJPromoWebApp.Pages.Gigs.GigsModel
@{
ViewData["Title"] = "Home page";
}

<div class="text-center">
@await Html.PartialAsync("/Pages/Gigs/Gigs.cshtml", Model)
</div>

That is everything. Run the application to see the result.

If you can’t connect to the database, double check that your IP address is allowed by the
logical database server firewall.

© The Independent Institute of Education (Pty) Ltd 2023 Page 108 of 290
IIE Module Manual APPR6312

Exercises

• Sort the gigs according to date.


• Style the page to make it look prettier.

5.3 Publishing the Web App to Azure


Now that we have successfully created the web app, there are several options for
deploying it to Azure App Service (Microsoft, n.d. c):

• Compressed archive (ZIP);


• File Transfer Protocol (FTP);
• Azure DevOps;
• GitHub;
• Bitbucket;
• Dropbox;
• OneDrive;
• Visual Studio.

For this learning unit, we will use the tools built into Visual Studio. In Learning Unit 5, we
will learn more about the other options.

5.3.1 Publishing from Visual Studio

This section is adapted from (Lin, et al., 2019b).

To publish the web app to Azure App Service for the first time:

Figure 117: Publish Project

1. In the Solution Explorer, right-click the DJPromoWebApp project.


2. Click Publish.

© The Independent Institute of Education (Pty) Ltd 2023 Page 109 of 290
IIE Module Manual APPR6312

Figure 118: Pick a Publish Target

3. Choose Azure as the Target.


4. Click Next.

Figure 119: Pick a specific Publish Target

5. Select Azure App Service (Linux) as the Specific target.


6. Click Next.
7. Log into your Azure account when prompted to do so.

© The Independent Institute of Education (Pty) Ltd 2023 Page 110 of 290
IIE Module Manual APPR6312

Figure 120: Choosing the App Service

8. Click the + button to create a new App Service.

Figure 121: Create New App Service

9. Change the Name if you want to.


10. Use the same Resource group that we used for the database.
11. Next to Hosting Plan, click New.

© The Independent Institute of Education (Pty) Ltd 2023 Page 111 of 290
IIE Module Manual APPR6312

Figure 122: Create New Hosting Plan

12. Change the Location to South Africa North.


13. Change Size to Free.
14. Click OK.
15. Click Create.
16. Wait for the process to complete. The dialog will close when the service creation is
done.

Figure 123: Publish Window

17. The Publish window will automatically be opened, with the Azure App Service
destination picked.
18. Click Publish.
19. Wait for the process to complete.

© The Independent Institute of Education (Pty) Ltd 2023 Page 112 of 290
IIE Module Manual APPR6312

Figure 124: Error Message

A browser window will be opened with your app, displaying a (not so useful) error
message. To fix the issue, we need to configure the firewall to allow the app access to the
database.

5.3.2 Configuring the Database Firewall

1. Browse the Azure Portal at https://portal.azure.com/.


2. Navigate to the DJPromoDatabase resource.
3. Click Set server firewall.

Figure 125: Allow Azure Services

4. On the Firewall settings page, toggle Allow Azure services and resources to
access this server to ON.
5. Click Save.
6. You should see a message indicating that the firewall rules were successfully updated.
Click OK.

Now you can reload the browser page with your app, and everything should work just as it
did on your local computer.

© The Independent Institute of Education (Pty) Ltd 2023 Page 113 of 290
IIE Module Manual APPR6312

What we did here was to allow all the Azure servers access to the database on the
networking (firewall) level. Remember that you still need login credentials for the specific
database, too, so this is not as unsafe as it might sound at first.

5.4 Updating and Redeploying


If we were making changes on our local copy of the web app, we could make changes to
the cshtml files while the app was running. When reloading the page in the browser, you
would see your changes. For C# code changes, you might have to run the app again. All
very easy.

But what about deploying those changes to the live version on the Azure Cloud? Luckily,
that is also easy.

Make some small changes to Index. Cshtml and try them out locally. When you are
happy with the changes, continue reading.

To redeploy the app to Azure:

Figure 126: Publish Project

1. In the Solution Explorer, right-click the DJPromoWebApp project.


2. Click Publish.

© The Independent Institute of Education (Pty) Ltd 2023 Page 114 of 290
IIE Module Manual APPR6312

Figure 127: Publish Window

3. Since we already have a configuration, the Publish window is displayed without


further need to configure anything. Click Publish.

And that is it. The page should load in a browser, and you will see your changes.

Tip: The publish window is also a convenient place to see the site Universal Resource
Locator (URL).

5.5 Managing the Web App


We created our Azure App Service resources without ever needing to access the Azure
Portal since Visual Studio has built-in support to do that. But what if you want to scale up
the resources available to your app? Or stop or even delete the app? The Azure Portal
makes this and much more possible.

To view a resource in Azure Portal:

1. Browse to the Azure Portal at https://portal.azure.com/.

Figure 128: Show Portal Menu Button

2. Click the Show Portal menu button (with the icon ) in the top-left corner of the
Portal.

© The Independent Institute of Education (Pty) Ltd 2023 Page 115 of 290
IIE Module Manual APPR6312

Figure 129: Portal Menu

3. Click All resources.

Figure 130: All Resources

4. Click the resource that you want to access.


If you have been following along, you will have four resources under the same resource
group by now.

Just like the SQL server is a logical container where you can manage one or more SQL
databases, the App Service plan is a central place to manage one or more deployed App
Service resources and more importantly, the cost of running them.

© The Independent Institute of Education (Pty) Ltd 2023 Page 116 of 290
IIE Module Manual APPR6312

Figure 131: App Service Plan Properties

Under properties, you can see the status, location, pricing tier, and instance size. If you
want to scale up or out, there are pages available under the Settings category to do that.
Changes that you make here will apply to all the apps in the plan.

If you look at the App Service entry, you will see many more options related to
deployment, site certificates and even usage quotas.

New apps can also be created using the portal, as well as the command line. We will look
at the command line options later in this module.

© The Independent Institute of Education (Pty) Ltd 2023 Page 117 of 290
IIE Module Manual APPR6312

6 Azure Functions
6.1 Serverless Computing

6.1.1 What is Serverless Computing?

When we consider scaling in Azure App Service, there are two options (Lin, et al., 2019c):

• Scaling up – adding more resources such as CPU, memory and disk space.
• Scaling out – added more virtual machine (VM) instances to run the app.

This points to the fact that there are in fact still VMs involved in hosting the App Service.
The VMs are managed without much involvement from us, but they still exist. What if we
want seriously elastic scaling – paying only for compute power that we use, and with the
ability to scale to huge traffic volumes? That is where serverless computing comes in.
Let’s have a look at Microsoft’s definition.

“Serverless computing enables developers to build applications faster by eliminating the


need for them to manage infrastructure. With serverless applications, the cloud service
provider automatically provisions, scales, and manages the infrastructure required to run
the code.

“In understanding the definition of serverless computing, it is important to note that servers
are still running the code. The serverless name comes from the fact that the tasks
associated with infrastructure provisioning and management are invisible to the
developer.” (Microsoft, 2019e)

Serverless computing hides from the developer where the code is executed. It is running
somewhere in the region that was picked for hosting the code, and that is all that we need
to know. The server that is doing the work is entirely unimportant, since there is
sophisticated software that manages all that in the background.

6.1.2 Serverless Options in Azure

Several serverless options are available on the Azure platform, including Event Grid,
Logic Apps and Functions. (Likness, 2018) Let us have a brief look at each one.

Event Grid makes it possible to create serverless event-based applications. Events can
be published from and consumed by any platform. It is useful for integrating various
applications and building serverless apps from the ground up. (Likness, 2018)

Logic Apps is a design-first workflow engine that allows people to build workflows with a
visual designer. (Likness, 2018) This is useful for implementing business processes that
have steps that interact with various systems.

Azure Functions is a serverless way to run functions in the cloud. A function in this
context is a small piece of code that typically contains business logic. There are lots of

© The Independent Institute of Education (Pty) Ltd 2023 Page 118 of 290
IIE Module Manual APPR6312

options in terms of programming languages when it comes to implementing Azure


Functions (Likness, 2018):

• C# (.NET Framework and .NET Core);


• JavaScript;
• F#;
• Java;
• PowerShell;
• Python;
• Typescript.

There are three ways to create functions (Likness, 2018):

• Develop using an integrated development environment (IDE) such as Visual Studio;


• Script directly in the Azure Portal;
• Create the resource via the command line.

In this learning unit, we will create Azure Functions in C# using the first two methods.

6.1.3 Portability of Azure Functions

You may have noticed that the Azure App Service web app we created before was just a
normal ASP.NET Core MVC app, hosted in the cloud. You could take that same app and
deploy it in a Docker container, or to an Internet Information Services (IIS) server, without
any changes to the code.

When we create a function in Section 6.2, you will notice this looks like a very different
situation. You must define the function in a specific way, with attributes (or a configuration
file for languages other than C#) specifying when the function will run.
At first glance, it looks like this means that we are forever locked in to running our code on
the Microsoft Azure platform. However, we haven't mentioned a key feature of Azure
Functions yet – the runtime is open-source and available on GitHub. (Gailey, et al., 2017)

This means that if you are willing to spend the money (on infrastructure) and time, you
could absolutely run Azure Functions on your own servers. Or in a virtual machine on a
different cloud.

6.1.4 Cost of Azure Functions

An important factor in choosing to use Functions is the fact that you can pay only for the
computational resources that you use. But as with all things in Azure, there are multiple
options for pricing plans here too (Gailey, et al., 2017):

• Consumption plan – pay only for the time when your code is running.
• Premium plan – some instances of the function are pre-warmed and ready to
respond very fast. You pay for these instances that are always effectively running
though.

© The Independent Institute of Education (Pty) Ltd 2023 Page 119 of 290
IIE Module Manual APPR6312

• App Service plan – run the functions as part of an existing App Service plan, using
the same resources and without paying anything extra.

© The Independent Institute of Education (Pty) Ltd 2023 Page 120 of 290
IIE Module Manual APPR6312

6.2 Creating an Azure Function in Visual Studio

6.2.1 Triggers and Bindings

Before we create our first Azure Function, we need to know about triggers and bindings.

Think about a method in a plain old C# class for a moment. If you don’t call the method, it
won’t ever run. The same kind of thing is true for a function too – it is only executed when
something triggers it. But now the piece of code is a small, isolated thing, so how do we
do that?

Each function has a trigger – something that causes the function to run. Here are some
common triggers (Microsoft, n.d. d):

• Timer: Used when you want something to run on a schedule, for example, every
Monday at 08:00.
• Hypertext Transfer Protocol (HTTP): Just like web services can get called using
HTTP, functions can also be called in this way.
• Blob: Useful for monitoring files that are uploaded to Azure Blob storage.
• Queue: There is a queue implementation in Azure Storage that can trigger a
function when a message is added to the queue.
• Azure Cosmos DB: When something changes in the database, a function can be
triggered.
• Event Hub: A new event that is published to the Event Hub can trigger a function.

We will see shortly how to define these triggers. It is important to note, though, that each
function can only have exactly one trigger.

Bindings are used to provide data to a function and can also be used to output data
from a function (or can even be both input and output). Examples of output bindings are
things like publishing an event to the Event Hub, sending an email, and creating a file in
Azure Blob storage. (Dykstra, et al., 2019)

6.2.2 Creating the Function Project

If you don’t see the Visual Studio features described here, you probably need to install
the Azure development workload. (Gailey, et al., 2019)

To create a new function project:

1. In Visual Studio, start the Create a new project wizard.

© The Independent Institute of Education (Pty) Ltd 2023 Page 121 of 290
IIE Module Manual APPR6312

Figure 132: Create a New Project Wizard

2. Enter azure into the search text field.


3. Select the Azure Functions project template and click Next.

Figure 133: Configure Your New Project

4. Enter DJFunctions for the Project name.


5. Specify a Location for the project.
6. Click Create.

© The Independent Institute of Education (Pty) Ltd 2023 Page 122 of 290
IIE Module Manual APPR6312

Figure 134: Azure Functions Application Properties

7. Make sure that Azure Functions v2 (.NET Core) is selected.

If you look at the list of options here, you will see only .NET Framework and .NET Core.
This is perfect for our current purpose, but if you wanted to use another language you
would have to make a different plan. More about that in Section 6.6.

8. Select Http trigger.


9. Leave storage account as Storage Emulator. (We don’t need storage for this
function.)
10. Set the Authorization level to Function.
11. Click Create.

What is the authorisation level all about? Azure Functions uses API keys to make sure
that unauthorised people cannot call functions using HTTP requests. There are three
possible levels (Microsoft, n.d. e):

• Anonymous: Anybody can call the function – no API key is required. Use only for
things that you intend to have publicly accessible.
• Function: To call the function, you need to know the API key for this specific
function.
• Admin: A master API key is required. This grants elevated permissions, so use with
care! (Gailey, et al., 2017b)

6.2.3 Sample Function

As with many project templates in Visual Studio, a sample class is created as part of the
Azure Functions project. The code is quite useful in this case, for us to learn how to create
our own functions in C#.

The sample code (hello world) is shown in Figure 135.

© The Independent Institute of Education (Pty) Ltd 2023 Page 123 of 290
IIE Module Manual APPR6312

Figure 135: Function1 Sample Code


The function code consists of a static class with a single static async method. How does
the Functions platform know that this method is supposed to be run? By means of
attributes.

The Function Name attribute specifies the name that we will use to call the function and
the HTTP Trigger attribute tells it that an HTTP request should trigger the function. Notice
that both GET and POST requests are enabled by default.

With GET, the parameters are passed as part of the Universal Resource Locator (URL).
This is useful for testing. But if the data that is passed in is sensitive, disable the GET
option.

The sample code looks for a parameter called name, either in the URL or in the post data,
and then sends back a message saying hello to that name if it is found.

Before we create our own function, let’s first see how we can run the function locally.

6.3 Running Function Locally


This section is adapted from (Gailey, et al., 2019b).

Azure Functions Core Tools can be used to run functions on your local computer. This is
integrated into Visual Studio to make running your functions very easy.

To run the newly created function locally:

© The Independent Institute of Education (Pty) Ltd 2023 Page 124 of 290
IIE Module Manual APPR6312

1. With the project open in Visual Studio, press F5. (Or click Debug menu and then
Start Debugging.)

Figure 136: Firewall Prompt


2. If you are prompted by Windows Defender Firewall whether to allow network
access, click Allow access.

Figure 137: Functions Runtime Window

3. A Functions runtime window will be displayed, and it will show the address of
Function1. Copy the URL.
4. Open a new browser window and browse to the URL.

Figure 138: Function Error Message

© The Independent Institute of Education (Pty) Ltd 2023 Page 125 of 290
IIE Module Manual APPR6312

5. You should see an error message indicating that you were supposed to send a
name. To do this, append ?name=<YOUR_NAME> to the URL.

Figure 139: Hello World!

6. To stop debugging, press Shift + F5 in Visual Studio.

Note that authorisation levels are ignored when you run the function locally, so there is
no need to specify an API key.

6.4 Creating a Custom Function


We will be creating a function that responds to an HTTP trigger that is able to add a gig to
our DJ promotion database. We want the caller to provide the following parameters:

• stage name: The stage name of the DJ.


• venue name: The name of the venue.
• date: The date that the gig will take place.
• time: The time that the DJ will be starting their set.

6.4.1 Creating the Function

To create the custom function:

© The Independent Institute of Education (Pty) Ltd 2023 Page 126 of 290
IIE Module Manual APPR6312

Figure 140: New Azure Function Action

1. In the Solution Explorer, right-click the DJFunctions project.


2. Click Add and then New Azure Function.
3. Enter the Name AddGig.cs.
4. Click Add.

Figure 141: New Azure Function Dialog

5. Select Http trigger.

© The Independent Institute of Education (Pty) Ltd 2023 Page 127 of 290
IIE Module Manual APPR6312

6. Choose the Function Authorisation level.


7. Click OK.

6.4.2 Adding the SqlClient Library

This section is adapted from (Gailey, et al., 2019c).

To add the SqlClient library to the project:

Figure 142: Manage NuGet Packages

1. In the Solution Explorer, right-click the DJFunctions project.


2. Click Manage NuGet Packages.

Figure 143: Selecting SqlClient

3. On the NuGet Package Manager window, click the Browse tab.


4. Search for SqlClient and select System.Data.SqlClient.
5. Important: Select version 4.5.1.
6. Click Install.
7. If the Preview Changes dialog is displayed, review the changes and click OK.
8. On the License Acceptance dialog, click I Accept.
9. Wait for the process to complete.
10. Close the NuGet window.

© The Independent Institute of Education (Pty) Ltd 2023 Page 128 of 290
IIE Module Manual APPR6312

6.4.3 Adding Database Access Code

For the purpose of this implementation, we won’t be using Entity Framework. If you want
to know how to use Entity Framework with Functions, read (Hollan, 2019).

For the purpose of our function, if the DJ or venue doesn’t exist we will return an error
message.

To add the entries to the database:

1. Open AddGig.cs if it isn’t open.


2. Add a using statement to the file for the namespace System.Data.SqlClient.
3. Replace the code in the Run method with the following code:

[FunctionName("AddGig")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HTTP Request req,
ILogger log)
{
log.LogInformation("Add Gig: C# HTTP trigger function processed a request.");

string requestBody = await new StreamReader(req.Body).ReadToEndAsync();


dynamic data = JsonConvert.DeserializeObject(requestBody);

string stagename = req.Query["stagename"];


stagename = stagename ?? data?.stagename;

string venuename = req.Query["venuename"];


venuename = venuename ?? data?.venuename;

string date = req.Query["date"];


date = date ?? data?.date;

string time = req.Query["time"];


time = time ?? data?.time;

if (stagename == null || venuename == null || date == null || time == null)


{
return new BadRequestObjectResult("Please pass stagename, venuename, date " +
"and time parameters on the query string or in the request body");
}

return CreateNewGigEntry(stagename, venuename, date, time);


}

As an exercise, write the code for the CreateNewGigEntry method yourself before
continuing.

4. Add the CreateNewGigEntry method to class AddGig:

private static IActionResult CreateNewGigEntry(string stagename, string venuename,


string date, string time)
{
try
{
string connectionString = "";

© The Independent Institute of Education (Pty) Ltd 2023 Page 129 of 290
IIE Module Manual APPR6312

using (SqlConnection connection = new SqlConnection(connectionString))


{
int djID = 0;
int venueID = 0;

connection.Open();

String sql = $"SELECT * FROM DJ WHERE StageName = '{stagename}';";


using (SqlCommand command = new SqlCommand(sql, connection))
{
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.HasRows)
{
reader.Read();
djID = reader.GetInt32(0);
}
else
{
return new BadRequestObjectResult("Error: DJ " + stagename +
" doesn't exist in the database");
}
}
}
sql = $"SELECT * FROM Venue WHERE Name = '{venuename}';";
using (SqlCommand command = new SqlCommand(sql, connection))
{
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.HasRows)
{
reader.Read();
venueID = reader.GetInt32(0);
}
else
{
return new BadRequestObjectResult("Error: Venue " + venuename +
" doesn't exist in the database");
}
}
}

sql = $"INSERT INTO Gig(DJID, VenueID, Date, Time) VALUES ({djID}, " +
$"{venueID}, '{date}', '{time}');";
using (SqlCommand command = new SqlCommand(sql, connection))
{
command.ExecuteNonQuery();
return (ActionResult)new OkObjectResult($"Created gig for {stagename} " +
$"at {venuename} on {date} at {time}");
}
}
}
catch (SqlException e)
{
Console.WriteLine(e.ToString());
}
return new BadRequestObjectResult("Error: An unexpected error " +
"occurred while creating the gig");
}

Exercise: Under what circumstances will this method not work correctly? Can this be
used by attackers to gain access where they shouldn’t be able to?

© The Independent Institute of Education (Pty) Ltd 2023 Page 130 of 290
IIE Module Manual APPR6312

5. Insert the connection string for your database.


6. Run the functions app.
7. Make an HTTP request from your browser, something like the below.

http://localhost:7071/api/AddGig?stagename=shohiwa&venuename=ultra%20coo
l&date=2020-06-12&time=18:00

Figure 144: Successful Function Execution

Note that ‘&’ separates the parameters, and ‘%20’ is used to present a space.

If you get error messages (look in the console window for more information):

• Check that you are using the correct port.


• Check that the firewall is allowing your current public IP address.

6.5 Publishing Function to Azure


In this section, we will publish the function to Azure Functions using Visual Studio. We will
explore other methods later.

Before we publish a function, we need a function app first. It is a logical container for one
or more functions. The Visual Studio wizard can create this for us too.

To publish a function for the first time from Visual Studio:

Figure 145: Publish Action

1. In the Solution Explorer, right-click the DJFunctions project.


2. Click Publish.

© The Independent Institute of Education (Pty) Ltd 2023 Page 131 of 290
IIE Module Manual APPR6312

Figure 146: Publish Target

3. Choose Azure Functions Consumption Plan.


4. Choose Create New.
5. Click Create Profile.
6. Change the Name of the app if you want to (see Figure 147 on page 132).
7. Choose the Resource group DJPromoWebsite that we created earlier.
8. Choose the Location South Africa North.
9. Next to Azure Storage click New.

Figure 147: Functions Runtime Window

© The Independent Institute of Education (Pty) Ltd 2023 Page 132 of 290
IIE Module Manual APPR6312

Figure 148: Create New Azure Storage

10. Delete the last two digits of the proposed Account name.
11. Choose the Location South Africa North.
12. Click OK.
13. Click Create.
14. Wait for the process to complete.

Figure 149: Publish Window

15. When the process completes, you should see the Publish window. Click Publish.
16. Wait for the process to complete. Then click the Site URL link to view the home
page of the function app in your browser, as shown in Figure 150.

© The Independent Institute of Education (Pty) Ltd 2023 Page 133 of 290
IIE Module Manual APPR6312

Figure 150: Functions App Home Page

We chose to set the authorisation level of the functions (Function1 and AddGig) to
function. This means that we need to know the API key to be able to call these functions
now that they have been published. We can see these in Azure Portal.

To get the function URL including the API key:

1. Browse to the Azure Portal at https://portal.azure.com/.


2. Click All Resources.
3. Click the functions resource (see highlighted item in Figure 151 below).

Figure 151: All Resources List

© The Independent Institute of Education (Pty) Ltd 2023 Page 134 of 290
IIE Module Manual APPR6312

Figure 152: Functions App in Azure Portal

4. On the navigation panel at the left, click the AddGig function.


5. Wait for it to load completely, including the Get function URL link. Click Get
function URL.

Figure 153: Get Function URL

6. Make sure that the Key Function key is selected.


7. Click Copy.
8. Open a new browser window and browse to the URL that you just copied. You
should see the message about having to pass parameters to the function.

Look at the URL that you copied. It will include a code parameter with a generated value.
That is the API key for this specific function. Add the normal parameters at the end of the
URL that includes the code. Remember, separate parameters with ‘&’ .

6.6 Creating an Azure Function with Azure Portal


In this section, we will see how to create and implement functions using the Azure Portal.

“Don't mix local development and portal development for a single-function app. When
you publish from a local project to a function app, the deployment process overwrites any
functions you developed in the portal.” (Gailey, et al., 2019d)

When we looked at our Visual Studio-created functions app in the Azure Portal, you might
have noticed that it said that the “app is currently in read-only mode because you are

© The Independent Institute of Education (Pty) Ltd 2023 Page 135 of 290
IIE Module Manual APPR6312

running from a package file.” That means it is unlikely that you will run into issues with
mixing local and portal development.

For this section, we will create a new functions app using Azure portal to explore its
features. Note that it may use a small amount of your free credit.

6.6.1 Creating a New HTTP Triggered Function

To create a new function app with function in Azure Portal:

1. Browse to the Azure Portal at https://portal.azure.com/.


2. Click Create a Resource.

Figure 154: Creating a Function App

3. Click the Compute category.


4. Click Function App.

© The Independent Institute of Education (Pty) Ltd 2023 Page 136 of 290
IIE Module Manual APPR6312

Figure 155: Basic Function App Settings

5. Select the DJPromoWebsite Resource group that we have been using all along.
6. Enter a unique Function app name. Using the current date and time could help to
make it unique.
7. Choose to Publish Code.
8. Choose the Runtime stack .NET Core.
9. Choose the Region South Africa North.
10. Click Next: Hosting.

Figure 156: Hosting Function App Settings

11. Choose the Storage account that we created before for our Visual Studio created
functions.
12. Choose the Operating System Windows.
13. Choose the Plan type Consumption.
14. Click Review + create.
15. Review the settings, and then click Create.
16. You will see a page indicating, "Your deployment is underway.” Wait for the process
to complete.
17. Click Go to resource.

Figure 157: Create New Function Button

© The Independent Institute of Education (Pty) Ltd 2023 Page 137 of 290
IIE Module Manual APPR6312

18. Click the Create new button (with the icon) next to Functions.

Figure 158: Choose Development Environment

19. Choose the In-portal development environment.


20. Click Continue.
21. Choose More templates.
22. Click Finish and view templates.
23. Search for the HTTP trigger if you don’t see it.
24. Click HTTP trigger.

Figure 159: Create a New Function

© The Independent Institute of Education (Pty) Ltd 2023 Page 138 of 290
IIE Module Manual APPR6312

25. Enter a Name for the new function. Let’s call it GetDJs.
26. Choose the Authorisation level Anonymous this time – anybody can view the list of
DJs.
27. Click Create.

6.6.2 Developing the Function in Azure Portal

The Azure portal contains all the features necessary to develop and test a function.

Figure 160: Functions Editor

When we click on the function that we created in the portal, the source code for the
function is displayed. If you think back to the code generated by Visual Studio, you will
see that it looks familiar.
There are differences though. The most obvious one is that this time, there are no
attributes in the code to specify the trigger properties. So, how does the runtime know
what to do then?

To view the configuration file for the function:

1. Click View files at the right of the window.

Figure 161: View Files Pane

2. On the View files pane, click function.json.

© The Independent Institute of Education (Pty) Ltd 2023 Page 139 of 290
IIE Module Manual APPR6312

Figure 162: function.json Configuration

The values specified here are the same ones that were specified in the attributes in Visual
Studio.

Switch back to run.csx so we can look at the other difference.


The first line reads: #r "Newtonsoft.Json". What does this mean?
It is a reference to an external assembly.
The following assemblies can be referenced in this way: (Dykstra, et al., 2017)

• Newtonsoft.Json
• Microsoft.WindowsAzure.Storage
• Microsoft.ServiceBus
• Microsoft.AspNet.WebHooks.Receivers
• Microsoft.AspNet.WebHooks.Common
• Microsoft.Azure.NotificationHubs

6.6.3 Editing the Trigger and Binding Properties

There are two ways to edit the trigger and binding properties for a function.
We have already seen the config file that you can edit manually.
But there is also a graphical editor. Click Integrate under the function to open the editor.

© The Independent Institute of Education (Pty) Ltd 2023 Page 140 of 290
IIE Module Manual APPR6312

Figure 163: Integrate Page

6.6.4 Testing the Function in the Portal

When we developed a function using Visual Studio, we could run it locally to test it.
The Azure Portal provides similar functionality.

To test a function in Azure Portal:

1. Click the Test tab on the right (next to View files).


2. The test pane will be displayed in Figure 164 on p.142.
Change the name attribute in the Request body to your name.
3. On the code pane, click Run.
4. Wait for the process to complete.
5. Look at the Output area on the Test pane. You should see that the status is 200
OK,
and the output message with your name should be displayed there too.

© The Independent Institute of Education (Pty) Ltd 2023 Page 141 of 290
IIE Module Manual APPR6312

Figure 164: Test Pane with Results

Here, the default HTTP method was POST, instead of the GET we have been using.
So, we have now seen that the method really works using both methods.

6.6.5 Disabling a Function

If you are no longer using a function, it is a good idea to disable (or even delete) it so that
it won’t cost money for no reason.

To disable a function:

1. Click Manage under the function.


2. Toggle Function State to Disabled.

To delete a function:

1. Click Manage under the function.


2. Click Delete function.
3. A message will be displayed to confirm deletion. Click OK to confirm.

© The Independent Institute of Education (Pty) Ltd 2023 Page 142 of 290
IIE Module Manual APPR6312

6.7 Consuming Azure Functions


We have the AddGig function running in Azure, and we have successfully called it from a
browser window. But how could we call it from C# code?

Here is a method that calls AddGig, based on the code from (Lazar, 2018).

private static async Task<string> AddGig(string djName,


string venueName, string date, string time)
{
string friendlyVenueName = venueName.Replace(" ", "%20");
string azureBaseUrl = "https://djfunctions20191222074327." +
"azurewebsites.net/api/AddGig";
string apiKey = "?code=<your code>&";
string urlQueryStringParams = $"stagename={djName}" +
$"&venuename={friendlyVenueName}&date={date}&time={time}";

using (HttpClient client = new HttpClient())


{
using (HttpResponseMessage res = await client.GetAsync(
$"{azureBaseUrl}{apiKey}{urlQueryStringParams}"))
{
using (HttpContent content = res.Content)
{
string data = await content.ReadAsStringAsync();
if (data != null)
{
return data;
}
else
{
return "";
}
}
}
}
}

For more examples, see the Recommended Additional Reading section below.

© The Independent Institute of Education (Pty) Ltd 2023 Page 143 of 290
IIE Module Manual APPR6312

6.8 Cleaning Up

When you are done with this learning unit, disable or delete any Azure resources that
you will no
longer be using. This will ensure that it doesn’t consume your free credit for no good
reason.

© The Independent Institute of Education (Pty) Ltd 2023 Page 144 of 290
IIE Module Manual APPR6312

7 Recommended Additional Reading


7.1 Azure Web Architecture
Wasson, M. et al., 2017. Run a basic web application in Azure. [Online]. Available at:
https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/app-service-
web-app/basic-web-app [Accessed 12 July 2021].

Wasson, M. et al., 2019. Improve scalability in an Azure web application. [Online].


Available at: https://docs.microsoft.com/en-us/azure/architecture/reference-
architectures/app-service-web-app/scalable-web-app [Accessed 12 July 2021].

7.2 Azure Cloud


Free registration is required for the following e-book:

Foulds, I., 2018. Learn Azure in a Month of Lunches. [eBook]


E-book
Available at: https://azure.microsoft.com/en-us/resources/learn-
azure-in-a-month-of-lunches/ [Accessed 12 July 2021]. Shelter
Island: Manning Publications Co.

7.3 Azure SQL Database


Rabeler, C. et al., 2019b. Controlling and granting database access to SQL Database and
SQL Data Warehouse. [Online]. Available at: https://docs.microsoft.com/en-us/azure/sql-
database/sql-database-manage-logins
[Accessed 12 July 2021].

7.4 Azure Functions


Dykstra, T. et al., 2017. Azure Functions C# script (.csx) developer reference. [Online].
Available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-
csharp#referencing-external-assemblies
[Accessed 12 July 2021].

Gailey, G. et. al, 2019b. Choose the right integration and automation services in Azure.
[Online]. Available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-
compare-logic-apps-ms-flow-webjobs
[Accessed 12 July 2021].

© The Independent Institute of Education (Pty) Ltd 2023 Page 145 of 290
IIE Module Manual APPR6312

Hollan, J., 2019. Using Entity Framework with Azure Functions. [Online]. Available at:
https://dev.to/azure/using-entity-framework-with-azure-functions-50aa [Accessed 12 July
2021].

Likness, J., 2018. Serverless apps: Architecture, patterns, and


Azure implementation. [eBook] Available at: https://docs.
microsoft.com/en-us/dotnet/architecture/serverless/ E-book
[Accessed 12 July 2021]. Redmond: Microsoft Corporation.

Sbeeh, M., 2019. Create And Consume Azure Function From ASP.NET Core. [Online].
Available at: https://www.c-sharpcorner.com/article/create-and-consume-azure-function-
from-asp-net-core/ [Accessed 12 July 2021].

8 Recommended Digital Engagement and Activities


8.1 Cloud Concepts
Microsoft Learn is Microsoft’s free online training platform.
The home page is https://docs.microsoft.com/en-gb/learn/.
At the time of writing, there were 925 modules available on a variety of topics!
It is recommended that you complete the Cloud Concepts – Principles of cloud computing
module
available at https://docs.microsoft.com/en-us/learn/modules/principles-cloud-computing/.

8.2 Azure Cloud


It is recommended that you complete the Core Cloud Services - Introduction to Azure
module on
Microsoft Learn, available at https://docs.microsoft.com/en-gb/learn/modules/welcome-to-
azure/index

8.3 Azure SQL Database


It is recommended that you complete the following content from Microsoft Learn:

• Provision an Azure SQL database to store application data module at


https://docs.microsoft.com/en-gb/learn/modules/provision-azure-sql-db/
• Work with relational data in Azure learning path at
https://docs.microsoft.com/en-gb/learn/paths/work-with-relational-data-in-azure/.

8.4 Azure App Service


It is recommended that you complete the Deploy a website to Azure with Azure App
Service learning
path on Microsoft Learn, available at
https://docs.microsoft.com/en-gb/learn/paths/deploy-a-website-with-azure-app-service/

© The Independent Institute of Education (Pty) Ltd 2023 Page 146 of 290
IIE Module Manual APPR6312

8.5 Azure Functions


It is recommended that you complete the Create serverless logic with Azure Functions
module on
Microsoft Learn, available at
https://docs.microsoft.com/en-gb/learn/modules/create-serverless-logic-with-azure-
functions/

© The Independent Institute of Education (Pty) Ltd 2023 Page 147 of 290
IIE Module Manual APPR6312

Learning Unit 3: Continuous Integration


Learning Objectives: My notes
• Differentiate between centralised and distributed
version control systems.
• Create an Azure Repos Git repository.
• Use an Azure Repos Git repository to branch and
merge.
• Identify the benefits of continuous integration.
• Create an Azure Pipelines build.
• Identify the benefits of Azure Artifacts NuGet
services.
• Create an Azure Artifacts NuGet repository.
Material used for this learning unit:
• This module manual.
• Microsoft Azure Repos.
• Microsoft Azure Pipelines.
• Microsoft Azure Artifacts.
How to prepare for this learning unit:
• Read through the content of this learning unit.
• Work through the activities on Learn.

1 Introduction
In Learning Unit 1, we looked at the software development methodologies used by teams.
But we also saw that there are tools that are used by software development teams in their
processes.
We have already explored Azure Boards, used to track project tasks.

But what about the day-to-day development activities undertaken by developers? In


Learning Unit 2,
we explored Azure Cloud development using Visual Studio. But none of that was specific
to how teams
develop software. In this learning unit, we are going to focus on the Azure tools that make
it possible
for many developers to develop seamlessly on the same code base.

2 Distributed Repositories
2.1 Shared Code Repositories

2.1.1 What is Version Control?

The main artifact that a software development team produces is the source code of the
software that they develop. And so, it makes sense that there should be tools that help
teams to manage this.

© The Independent Institute of Education (Pty) Ltd 2023 Page 148 of 290
IIE Module Manual APPR6312

“Source code management (SCM) is used to track modifications to a source code


repository.
SCM tracks a running history of changes to a code base and helps resolve conflicts
when merging
updates from multiple contributors. SCM is also synonymous with Version control.”
(Atlassian, n.d.)

Imagine for a moment a team of 10 developers working on the same code base. There
are hundreds
of files that form part of the source code already. And now the team is working together to
add a new
feature to the software. This means that they are working on closely related files, and it is
likely that
more than one person will want to make changes to the same files. This is called a
conflict, and a
version control system will help to merge these changes in a sensible way.

Version control systems store the history of all the changes ever made to the source
code. When new
bugs are unintentionally introduced during development, looking at the history of changes
can be a
very useful tool in discovering what caused the bug.
Additionally, storing the history means that the software as it was at a specific time can be
reproduced.

2.1.2 Best Practices

There are several best practices that will ensure that a version control system is used as
effectively
as possible:

• Commit frequently. The more often changes are committed, the better. (Atlassian,
n.d.)
• Don’t commit work that is not complete. Split up features into smaller parts, so that
you can
commit one complete part at a time. (Wallin, 2019)
• Generated sources and binaries should not be committed. Anything that contains
computer
specific files or items that are regenerated at compile time, should not be committed.
(Wallin, 2019)
• Pull before you make changes. If you work with the latest source code, it will help to
minimise
conflicts when you merge. (Atlassian, n.d.)
• Added detailed commit messages. If somebody looks at the history, the commit
messages will
make it easier to find a specific change. (Atlassian, n.d.)
• Check changes before committing. (Atlassian, n.d.)

© The Independent Institute of Education (Pty) Ltd 2023 Page 149 of 290
IIE Module Manual APPR6312

• Branch. Decide on a branching strategy, and then use it to isolate new features.
(Atlassian, n.d.)
• Work with a common process. The whole team should agree on how the source
process should
work, when to branch, etc. (Atlassian, n.d.)
2.2 Centralised vs Distributed Version Control
There are two types of version control systems: centralised and distributed. Some of the
most frequently used version control systems are shown in Figure 165, but this is by no
means an exhaustive list.

Figure 165: Version Control Systems

© The Independent Institute of Education (Pty) Ltd 2023 Page 150 of 290
IIE Module Manual APPR6312

2.2.1 Centralised Version Control

A centralised version control system uses a client-server model. The server hosts a
single, central
copy of the source code. When a developer uses client software to check out a file for
modification,
it is locked and nobody else can check it out until that developer checks it back in.
(Cheshire, 2018)
The exact implementation of how this works vary from system to system, and that is
beyond the scope
of this module.

Figure 166: Centralised Version Control from (Ernst, 2018)

In centralised version control, each developer has a local working copy of the central
repository.
To contribute changes to the central repository, a developer needs to commit a change to
the
repository. All the other developers then need to update their source code to be in sync
with what is
now in the central repository. (Ernst, 2018)

Having local working copies means that developers can still view the source code even
while it is
locked. And in most cases, there is no technology in place to prohibit developers from
making
local changes. So, it is still possible to have local conflicts. Consider this scenario. Bob
checks out a
file and is busy modifying it. Sarah meanwhile also has a local working folder where she is
busy
making some experimental changes to the same file. Bob commits his change, and the
next time
Sarah updates to the latest from the server, she will have to resolve the conflicts between
her changes
and the incoming ones.

© The Independent Institute of Education (Pty) Ltd 2023 Page 151 of 290
IIE Module Manual APPR6312

Centralised version control systems are typically older systems, that are not used as often
anymore.
However, these systems do have some benefits (Cheshire, 2018):
• Centralised version control is easy to understand and use, since the process is
quite simple.
• It is easy to control access to source code since it is only necessary to configure
access at the
central server.
• It is possible to avoid merging different versions of the same file, by means of
processes
agreed on by the team.

2.2.2 Distributed Version Control

In a distributed version control system, there are multiple repositories. Each workstation
has both a
local repository and a working copy of the source code. (Ernst, 2018)

Figure 167: Distributed Version Control from (Ernst, 2018)

The process to share changes with other developers is a little more complex. The exact
details differ
from system to system, so this will only be a general discussion. Details about Git will
follow in the next
section.

The typical process of sharing changes with the rest of the developers on a project starts
with first
committing to your local repository. Then you push the changes from your local repository
to a server
that has the master copy of the repository. The other developers pull the changes to their
local

© The Independent Institute of Education (Pty) Ltd 2023 Page 152 of 290
IIE Module Manual APPR6312

repositories, and then update their working folders. As you can see from this description
and
Figure 167, there is a whole additional level of activities involved here.

Distributed version control systems are more modern and have more features. (Ernst,
2018)
The main benefits of distributed version control systems are (Lubański, 2019):

• Better performance.
• No need to be connected to the network all the time.
• Improved handling of branching and merging.

2.3 Azure Repos


Azure Repos support two different version control systems (Microsoft, n.d. f):
• Git; and
• Team Foundation Version Control (TFVC).

For this module, we will only use Git. However, if you are interested in learning more
about the
differences between these two version control systems, read (Danielson, et al., 2017).

When a project is created in Azure DevOps, a repository is also by default, created.


During project
creation you can choose between the two types. Git is the default for the first project that
you create,
so Some Company Project that we created in Learning Unit 1 has a Git repository.

2.3.1 Azure DevOps

To view a project’s repository:

1. Browse to Azure DevOps at https://dev.azure.com/.


2. (Optional) If you have multiple organisations, select the one that you want to work
with.
3. Click the project that you want to access.

© The Independent Institute of Education (Pty) Ltd 2023 Page 153 of 290
IIE Module Manual APPR6312

Figure 168: Repos on the Navigation Pane

4. On the navigation pane, click Repos.

The web interface provides a lot of useful information. We will look at the different aspects
in more
detail as we explore how to use the features. For now, it is useful to note that it is possible
to create
and access more repositories than just the default one that was created with the project.

To create a new Azure Repo:

Figure 169: New Repository Action

1. Browse to the project repository as described above.


2. On the breadcrumbs at the top of the page, click the repository (with the icon).
3. Click New repository.

© The Independent Institute of Education (Pty) Ltd 2023 Page 154 of 290
IIE Module Manual APPR6312

Figure 170: Create a Repository

4. Choose the Repository type Git.


5. Enter a Repository name.
6. (Optional) Choose a .gitignore to add.

.gitignore is a file that specifies which files to exclude from the repository. The templates
provided here
will add, for example, the binary file location, to ensure that those files will never
accidentally get
committed. You can edit this later.

7. Click Create.

Figure 171: Selecting Repositories

8. The existing and new repositories now both appear on the list under the
breadcrumbs.

© The Independent Institute of Education (Pty) Ltd 2023 Page 155 of 290
IIE Module Manual APPR6312

2.3.2 Local Tools

When working with Azure Repos Git repositories, there are two standard sets of tools that
can be used
to work with the repositories:

• Git Command-line tools;


• Visual Studio graphical tools.

Whether to use the command-line tools or integrated Visual Studio user interface is
largely a matter of
developer preference. In this module manual, we will present both ways of working.

Beyond these standard tools, there are also numerous other graphical user interfaces
(GUIs) such as
TortoiseGit (a Windows shell extension for Git, available from https://tortoisegit.org). See
(Git, n.d.) for
a list of these tools. The use of these tools is beyond the scope of this module.

The command-line tools require separate installation from Visual Studio. However, Visual
Studio does
make it easy to download these tools.

To install the command-line tools from Visual Studio:

Figure 172: Team Explorer – Install 3rd-Party Git Tools

1. Open the Team Explorer window.


2. Click the Home button (with the icon).
3. Click Install 3rd-party Git command prompt tools.

© The Independent Institute of Education (Pty) Ltd 2023 Page 156 of 290
IIE Module Manual APPR6312

Figure 173: 3rd-Party Tools License

4. The license terms for the third-party tools will be displayed. Read it carefully and
then click Install.

Figure 174: Git Download Page

5. The Git download page will be opened in your browser, and the download will start
automatically.
Wait for it to complete.
6. Once the download is complete, run the installer and follow the prompts. Use the
default settings
except for the default text editor, if you want to choose something else.

Once the tools are installed, the Install 3rd-party Git tools link will no longer appear in
Visual Studio.
Now we can access the command prompt for the project.

© The Independent Institute of Education (Pty) Ltd 2023 Page 157 of 290
IIE Module Manual APPR6312

To access the Git command prompt for a project in Visual Studio:

Figure 175: Manage Connections

1. In the Team Explorer, click the drop-down box where the project name appears.
2. Click Projects and then Manage Connections.

Figure 176: Open Command Prompt

3. Right-click the repository and click Open Command Prompt.

© The Independent Institute of Education (Pty) Ltd 2023 Page 158 of 290
IIE Module Manual APPR6312

4. A command prompt window will be opened in the folder where the project source
code is stored.
This is the command prompt window that you will need to use to execute all the
commands
described later in this learning unit.

2.4 Git Workflows Introduced


When we discussed distributed version control systems in Section 2.2.2, we saw some of
the concepts
that apply to Git too. Each developer has a local repository that changes are committed to.
And there is a central repository (in our case hosted at Azure DevOps), where changes
eventually end
up. But Git has a lot more features, and there are lots of ways of using Git.

“A Git Workflow is a recipe or recommendation for how to use Git to accomplish work in a
consistent and productive manner.” (Atlassian, n.d. b)

There are several different workflows that have been described. And remember that the
definition
above says that it is only a recommendation. That means that teams can and do decide to
make
changes to the basic processes.

If there are so many possible options, how do we evaluate them? There are three points
to consider
(Atlassian, n.d. b):

• If the team grows, will the workflow scale well?


• If mistakes are made, can they easily be undone using the workflow?
• Does the workflow make it harder for the team to understand the process?

2.4.1 Centralised Workflow

In the centralised workflow, all the changes are made to the development branch master.
If two developers are working on the same code, they start by both cloning the central
repository.
Both developers then make changes and commit their changes to their local
repositories.
(Atlassian, n.d. b)

So far, this will seem quite familiar. It is exactly what we described in the distributed
version control
discussion. Figure 177 shows again what that process looked like.

© The Independent Institute of Education (Pty) Ltd 2023 Page 159 of 290
IIE Module Manual APPR6312

Figure 177: Distributed Version Control from (Ernst, 2018)

When the first developer decides to share their changes, they push to the master branch
in the central
repository. No other changes have been made yet, so there are no conflicts to resolve.
(Atlassian, n.d. b)

When the second developer now decides to also push, Git will indicate that there is a
conflict.
The second developer first needs to pull the changes from the central repository.
Git has the option to also rebase, which means that the second developer’s changes will
get applied
after all the changes that were pulled. After resolving any conflicts caused by the incoming
changes,
the changes can then also be pushed to the master branch of the central repository.
(Atlassian, n.d. b)

2.4.2 Feature Branching Workflow

The feature branching workflow builds on the centralised workflow. The difference is that
feature
development is done on a branch that is dedicated to that feature. The code will only get
merged to the
master branch when it is done, which means that the master branch should never contain
broken code.
(Atlassian, n.d. c)

In this workflow, a branch with a descriptive name is created for each feature (or bug) that
is worked on
Developers can commit and push in the same way to this new branch as they would on
the master
branch.
When the development is done, a pull request is created. This invites feedback from the
team before

© The Independent Institute of Education (Pty) Ltd 2023 Page 160 of 290
IIE Module Manual APPR6312

the changes are merged to the main branch. (Atlassian, n.d. c)

This is the recommended workflow to get started with in Azure Repos. (Danielson, 2018)

2.4.3 GitFlow Workflow

The GitFlow workflow defines several specific branches and how they interact, including
hotfixes, release branches, develop and then finally the feature branches that we know
already. (Driessen, 2010)

© The Independent Institute of Education (Pty) Ltd 2023 Page 161 of 290
IIE Module Manual APPR6312

2.4.4 Forking Workflow

In the forking workflow, each developer also has their own server-side repository.
This adds an extra layer to the process. To start working, a developer first creates a fork
(which is essentially just a server-side clone) of the central repository. Then a local clone
is created,
and everything proceeds as before with the feature branching workflow. Once the feature
is complete
and pushed to the developer’s own server-side repository, a pull request is created from
the feature
branch on the server to the official central repository. (Atlassian, n.b. d)

This workflow is often seen in open-source projects, where developers can contribute to
public
repositories in this way. (Atlassian, n.b. d)

We will be focussing on the feature branching workflow in this module. But since that is
based on the
centralised workflow, the first steps are the same.

2.5 Cloning a Repository


Cloning a repository is the process for creating a local copy of the whole repository,
including the full
version history, on your local hard drive.

To find the URL of the Azure Repos Git repository:

1. Browse to Azure DevOps at https://dev.azure.com/.


2. Browse to the repository that you want to clone.

Figure 178: Clone Button

3. Go to the Files view for the repository and click Clone (top-right corner of the page).

Figure 179: Clone Repository Pane

© The Independent Institute of Education (Pty) Ltd 2023 Page 162 of 290
IIE Module Manual APPR6312

4. Click Copy clone URL to clipboard (with the icon).

To clone a repository using Visual Studio:

1. Open the Team Explorer window.


2. Click Manage Connections (with the icon).

Figure 180: Manage Connections


3. Paste the URL to the repository into the first text box.
4. Click Clone.

You will be prompted to log in with the account that you are using for Azure DevOps.

To clone a repository using the command-line tools:

1. Create the folder where you want to store the clone (the parent folder, not including
the name of
the actual repository).
2. Open a command prompt (or PowerShell) window and change to the folder.
3. Run the following command (replacing <repository URL> with the URL that you
copied earlier):

git clone <repository url>

© The Independent Institute of Education (Pty) Ltd 2023 Page 163 of 290
IIE Module Manual APPR6312

Figure 181: Cloning Command Line

• If your repository is completely empty, expect to see the warning message as shown
in
Figure 181.
• If you have trouble with authentication using this method for the first time,
read (Danielson, et al., 2018b).
• For more information about the other parameters that you can pass to the git clone
command,
read (Atlassian, n.d. e).

Note that both methods will clone the master branch.

Let’s look at the contents of the folder where we checked out Second Repository. If you
show hidden
files and folders, you will see the contents as in Figure 182, including the hidden folder
called. git.
This is the folder where the local repository with all the version history is stored. You never
need to
interact directly with the contents of that folder. But it is useful know what it is.

Figure 182: Local Repository Folder

The working copy of the files that are in the repository are located next to the. git folder.
Our newly
created repository at this point only contains the README.md file that was created as part
of the
repository creation process.

2.6 Staging, Committing and Rollback

2.6.1 Initial Project Creation

According to the feature branching workflow, the next step is to create a branch. And that
makes

© The Independent Institute of Education (Pty) Ltd 2023 Page 164 of 290
IIE Module Manual APPR6312

perfect sense unless the repository is still empty. So, lets create a project first before we
branch for
the first time.

There are two ways to get a new project into the central repository for the first time:

• Create the project, initialise a local repository, and connect that to the Azure Repos
Git
repository. See (Danielson, et al., 2018b) for more details.
• Clone the empty repository, create, and commit the project, and push it to the Azure
Repos Git
repository.

Since we have already cloned the repository, let’s do the second option here. That also
gives us the
perfect opportunity for looking at staging, committing and rollback.

If you cloned your repository using the command-line tools, you can still open it in Visual
Studio and
continue working with it there too. Both the command-line tools and Visual Studio end up
writing the
changes to the same. git folder. So, you can use them interchangeably.

To add a local Git repository to Visual Studio:

1. Open the Team Explorer window.


2. Click Manage Connections (with the icon).

Figure 183: Add Repository

3. Under Local Git Repositories, click Add.


4. Browse to the folder where you cloned the repository or copy and paste the path into
the textbox.
5. Click Add.

© The Independent Institute of Education (Pty) Ltd 2023 Page 165 of 290
IIE Module Manual APPR6312

Figure 184: Two Repositories

Now I have two repositories in Visual Studio, since I cloned Some Company Project
using the
command-line tools and Second Repository using Visual Studio.

Tip: If you have multiple repositories, especially if they are both empty (or very similar),
make sure that
you are working with the right one!

To avoid confusion, you can remove a repository:

Figure 185: Removing a Repository

1. In Team Explorer, right-click on the repository.


2. Click Remove.

This only removes it from the list of repositories in Visual Studio.

© The Independent Institute of Education (Pty) Ltd 2023 Page 166 of 290
IIE Module Manual APPR6312

2.6.2 Adding a. gitignore File

A .gitignore file is necessary to avoid committing files that should only be stored on the
local machine,
including binary files. If you didn’t add one when you created the repository using Azure
Boards, it is very easy to do in Visual Studio.

To add a .gitignore file:

Figure 186: Repository Settings

1. On the Home pane of the Team Explorer, click Settings.


2. Click Repository Settings.

Figure 187: Add Ignore File

3. Under Ignore & Attribute Files, next to Ignore File, click Add.

Figure 188: Edit Ignore File

If you want to see what is in the file, click Edit. The file will be opened in Visual Studio, in
a new editor window.

© The Independent Institute of Education (Pty) Ltd 2023 Page 167 of 290
IIE Module Manual APPR6312

2.6.3 Creating the Project

To create a new project in the repository folder:

1. In Visual Studio, open Team Explorer.


2. Click Home (with the icon).

Figure 189: New Project

3. Under Solutions, click New.


4. Choose the desired project type. For use later in this learning unit, it would be useful to
create
an ASP.NET Core Web Application. (See Learning Unit 2 of this module manual for
the steps to
create the app.)

2.6.4 Staging

In Git, there is a phase before committing of changes, called staging.

“The staging area is best described as a preview of your next commit. Meaning, when you
do a git
commit, git will take the changes that are in the staging area and make the new commit out
of those
changes.” (Spajic, 2018)

When new files are added, or changes are made to existing files, the changes are first
added as a part
of the staged changes. This means that you can choose which of the changes to the local
working
folder need to be included for the next commit.

© The Independent Institute of Education (Pty) Ltd 2023 Page 168 of 290
IIE Module Manual APPR6312

You might have some changes that are not ready to be committed or are even not
supposed to be
committed ever. Those can be excluded by not staging them.

To stage changes in Visual Studio:


Visual Studio has a
shortcut way to access
1. Open the Team Explorer and go to the Home Teams functions. In the
view. bottom-right corner of
2. Click Changes. the application window,
you can see the
number of changes and
unpushed commits.
You can also change
between repositories
and branches.

Click on the changes


icon ( ) to quickly
access the Changes
view in Team Explorer.

Figure 190: Changes

Note that Visual Studio has automatically staged the .gitignore file that we created
earlier.

3. To stage a single file, right-click the file and click Stage.


4. To stage all the files (we want to do that now for the new project), click Stage All
(with the icon next to Changes).

© The Independent Institute of Education (Pty) Ltd 2023 Page 169 of 290
IIE Module Manual APPR6312

You can also choose to unstage files, either one by one by right-clicking, or all by clicking
Unstage all
(with the icon next to Staged Changes).

There is also a stash facility (sometimes called shelving). This is useful when you are
working on
something and then must change to a different task. You can keep the changes in your
stash and get
them back again later. (Atlassian, n.d. f)

To stage changes from the command-line:

1. Run the following command to see what the status of the repository is:

git status

Figure 191: git status

Here we also see that Visual Studio has automatically staged the .gitignore file that we
created
earlier.

2. To add all the files in the MyPrettyWebApp folder, run the following command:

git add MyPrettyWebApp\*

3. Now run git status again, and you will see a long list of files that have been
staged.

In these steps, we simply added all the files for our newly created project. But remember,
usually you
want to be specific about which changes to include. It is better to check carefully what you
stage than
having to revert changes later.

© The Independent Institute of Education (Pty) Ltd 2023 Page 170 of 290
IIE Module Manual APPR6312

There is also an interactive command-line tool used for staging. Read (Git, n.d. b) for
information about
this tool.

To stash changes from the command-line, use the command git stash. Read
(Atlassian, n.d. f) for
more information.

2.6.5 Committing

Now that we have all the changes staged, we are ready to make a commit. What is a
commit?

“The git commit command captures a snapshot of the project’s currently staged changes.
Committed
snapshots can be thought of as ‘safe’ versions of a project – Git will never change them
unless you
explicitly ask it to.” (Atlassian, n.d. g)

We see that a commit contains a snapshot of the files that are being committed. This
makes it different
to other version control systems such as Subversion, which saves only the differences.
(Atlassian, n.d. g)

To commit staged changes using Visual Studio:

1. Open the Changes view of the Team Explorer.

Figure 192: Committing Changes

2. Enter a commit message with enough detail for future developers to understand
what you did.
3. Click Commit Staged.

© The Independent Institute of Education (Pty) Ltd 2023 Page 171 of 290
IIE Module Manual APPR6312

To continue working with the same folder for the command-line instructions, I modified the
Index.cshtml file and staged it.

Figure 193: Status with Index.cshtml Staged

To commit the staged changes using the command-line:

1. Run the following command (Atlassian, n.d. g):

git commit -m "Removed carousel from home page"

2. You will see a message indicating how many files and changes are included in the
commit.
3. If you now run git status again, you will see that we now have two commits.

Figure 194: git commit

2.6.6 Rollback

If you decide that a commit needs to be removed for some reason, you can revert it. What
git does in
this process is to create a new commit that undoes the changes. (Costa, 2018)

To rollback a commit using Visual Studio:

1. Open the Branches view of the Team Explorer.

© The Independent Institute of Education (Pty) Ltd 2023 Page 172 of 290
IIE Module Manual APPR6312

Figure 195: View History

2. Right-click the master branch and click View History.

Figure 196: History Window with Revert Action

3. In the History window, right-click the commit that you want to revert and click
Revert.
4. A message will ask you whether you are sure you want to revert. Click Yes.
5. Click Refresh (with the icon) to update the history.

Figure 197: History Window Showing Reverted Commit

For this discussed, I added another commit so that we can revert that using the
command-line tools.

© The Independent Institute of Education (Pty) Ltd 2023 Page 173 of 290
IIE Module Manual APPR6312

To revert a commit using the command-line tools:

1. Run the following command to find the hash of the commit that you want to revert:

git log --oneline

Figure 198: Git Log

If we want to revert the first commit, we will use hash 5456cec. Note that this will very likely
be different
for your repository – so run the log command, don’t try to use my hash.

2. Run the following command to revert the change (Costa, 2018):

git revert 5456cec

3. The default editor will be opened. Edit the commit comment if you want to and close
the editor.
(How to do this depends on your chosen editor.)
4. Run git log –oneline again to see the revert commit.

Figure 199: Git Log with Revert

2.7 Pushing, Pulling and Rebasing


2.7.1 Pushing Commits

Everything that we have done so far was only on the local clone of the repository. Now it
is time to
share our changes with the central repository hosted at Azure DevOps.

To push changes to the central repository using Visual Studio:

1. Open the Sync (Synchronization for full) view of the Team Explorer.

© The Independent Institute of Education (Pty) Ltd 2023 Page 174 of 290
IIE Module Manual APPR6312

Figure 200: Synchronisation View

2. Click Push under Outgoing Commits.

Figure 201: Push in Progress

3. During synchronisation, a progress bar will be displayed. Wait for the process to
complete.

Now we can go have a look at the Git repository in the Azure Repos web interface.
And we will see all our commits there!

© The Independent Institute of Education (Pty) Ltd 2023 Page 175 of 290
IIE Module Manual APPR6312

Figure 202: Commits in the Azure Repos Git Repository

To push changes to the central repository using command-line tools:


1. Run the following command to push the master branch changes to the repository
that we cloned
from:

git push origin master

Figure 203: Pushing Changes to the Origin


2.7.2 Pulling Commits

This is all great if nobody else is working on the source code. But in practice that is very
unlikely.
How do we get the changes made by the rest of the team? By pulling their commits from
the central
repository.

To pull commits using Visual Studio:

1. Open the Sync (Synchronization for full) view of the Team Explorer.
2. Under Incoming Commits, click Fetch.

Figure 204: Incoming Changes

3. A list of all the incoming commits will be displayed. Click Pull to pull these commits
to the local

© The Independent Institute of Education (Pty) Ltd 2023 Page 176 of 290
IIE Module Manual APPR6312

clone of the repository.

Now if we refresh the History tab, we will see that the new change that was made by
somebody else,
appears in our local history.

Figure 205: Change from Central Repository in History

And if we look at the contents of the readme file, we will see that we have the changes
made in the
changeset in our working copy.
To pull commits using the command-line tools:

1. Run the following command to fetch the remote commits and merge it into the local
working copy
(Atlassian, n.d. h):

git pull origin

Figure 206: Pulling Changes from the Origin

For more information about the git pull command, read (Atlassian, n.d. h).

It is recommended to always pull the latest before starting any new work. This will help
to avoid conflicts.

2.7.3 Rebasing

What happens when you have made commits and somebody else has already pushed
changes to the
central repository? When you try to push, you will get an error message indicating that you
must pull
first.

© The Independent Institute of Education (Pty) Ltd 2023 Page 177 of 290
IIE Module Manual APPR6312

If you just pull using Visual Studio, it will automatically merge changes, creating another
commit to
merge the changes. This results in the most complete history, as shown in Figure 207. But
it is more
complex than it could have been.

Figure 207: Merge

To avoid this, you can rebase your changes. Rebasing gets the latest commits, and then
apply your
local commits after that. It is important that the whole team agrees when to rebase, since
it can cause
loss of history. A good guideline is to only rebase commits that you haven’t pushed yet.
(Danielson, et al., 2018c)

To rebase using Visual Studio:

1. Open the Sync (Synchronization for full) view of the Team Explorer.
2. Under Incoming Commits, click Fetch. (Don’t pull!)
3. Open the Branches view of the Team Explorer.

© The Independent Institute of Education (Pty) Ltd 2023 Page 178 of 290
IIE Module Manual APPR6312

Figure 208: Rebase

4. Click Rebase.
5. Choose to base Onto branch origin/master.
6. Click Rebase.
7. Switch back to the Sync view and Push your change.

Figure 209: No Merge Needed Here Because of Rebase

To rebase using the command-line tools, you can use the command git pull --
rebase.

2.8 Branching, Merging and Pull Requests


So far, everything we have done is just the centralised workflow. We have the single
master branch
where everything has happened. Now it is time to see how we can work with branches, so
that we can
implement the feature branching workflow.

© The Independent Institute of Education (Pty) Ltd 2023 Page 179 of 290
IIE Module Manual APPR6312

2.8.1 Branching

To create a local branch using Visual Studio:

1. Open the Branches view of the Team Explorer.


2. Click New Branch.

Figure 210: Creating a Branch

3. Enter a name for the branch.


4. Make sure that Checkout branch is selected.
5. Click Create Branch.

Figure 211: New Branch Created

You will see that the new branch now appears under the repository and is bold. This
means that you
are working on this branch.
To create a new branch using the command-line tools:

1. Run the following command to create a branch with the name home-page-revamp
2. (Atlassian, n.d. i):

git branch home-page-revamp

3. This doesn’t checkout the branch. To do that, run the following command:

© The Independent Institute of Education (Pty) Ltd 2023 Page 180 of 290
IIE Module Manual APPR6312

git checkout home-page-revamp

Use the command git branch to list all the branches.

Figure 212: Checking Out a Branch

For more information about git branch read (Atlassian, n.d. i).

2.8.2 Working on the Branch

Now that we have the branch created and checked out, we can work on our local copy.
And stage and commit as usual. When we commit, we can now see in the history that the
change is on
the home-page-revamp feature branch.

Figure 213: Commit on a Branch

When we push our changes, the branch also gets created in the central repository. And
the changes
are not in the master branch at this point.

Figure 214: Branch at Azure Repos

© The Independent Institute of Education (Pty) Ltd 2023 Page 181 of 290
IIE Module Manual APPR6312

2.8.3 Merging

There are two ways to get the changes made on a branch into the master branch:
merging and
creating pull requests. Both end up with the changes getting merged to the master branch,
but the pull
requests process allows for review of the changes before they get merged.

The pull requests method is better, since it provides the team with more control over when
things get
merged. So, we will only briefly discuss the merge method here.

To merge a branch onto master using Visual Studio:

1. In the Branches view of the Team Explorer, checkout the master branch by
double-clicking on it.
2. Right-click the master branch and click Merge From.
3. Choose the branch to merge from (in our case home-page-revamp) and click
Merge.

Now the change from the branch appears in the master branch in the Azure Repos Git
repository.

The process from starting to work on a feature to merging with the command-line tools is
shown in
Figure 215.

Figure 215: Merging from (Atlassian, n.d. j)

2.8.4 Pull Requests

For this discussion, I have created a new branch called first-feature, with a single
commit.
This has been pushed to the central repository.

To create a pull request using Azure Repos:

1. Browse to Azure DevOps at https://dev.azure.com/.

© The Independent Institute of Education (Pty) Ltd 2023 Page 182 of 290
IIE Module Manual APPR6312

2. Navigate to the repository that you want to work with.


3. Click on Branches.

Figure 216: Branches in Azure Repos

4. You will see a message about updating a branch. Click Create a pull request next
to it.

Figure 217: Pull Request Details

5. Edit the Title and Description if you want to provide more information.
6. (Optional) Specify Reviewers and related Work Items.
7. Click Create.

© The Independent Institute of Education (Pty) Ltd 2023 Page 183 of 290
IIE Module Manual APPR6312

The purpose of pull requests is to allow for a review process before the code is merged to
the master
branch. This is particularly useful for open-source projects but can be used to good effect
in any
software development team.

To review a pull request:

1. Browse to the repository in Azure Repos.


2. Click Pull requests.
3. Click the request that you want to review.

There are a few options when reviewing pull requests. You can add comments, including
things that
need to be fixed before the changes will be allowed to be merged. You can choose to
approve the
request, approve it with suggestions, wait for the author or reject it outright.

Figure 218: Reviewing the Pull Request

Furthermore, you can complete the request (meaning that the merge will happen), mark it
as a draft or
abandon the request.

Let’s assume that we are happy with the changes and want to proceed with the merge.

To complete a pull request:

1. On the pull request page, click Complete.


2. The Complete pull request pane will be displayed as shown in Figure 219. Update
the commit
comment if you want to provide more information.
3. Choose the Merge type. This will influence how the merge will work and is
dependent on the
team’s workflow. Leave it Merge (no-fast-forward) for now.
4. Choose whether to complete the associated work items, and whether to delete the
branch after

© The Independent Institute of Education (Pty) Ltd 2023 Page 184 of 290
IIE Module Manual APPR6312

merging.
5. Click Complete merge.

Figure 219: Complete Pull Request

After the completion of the pull request, we now see the result of the merge in the master
branch.
We can see which pull request was involved, so there is a complete history of how and
when this
happened.

Click on the pull request number in the Pull Request column of the Commits page to
access the
information.

© The Independent Institute of Education (Pty) Ltd 2023 Page 185 of 290
IIE Module Manual APPR6312

Figure 220: Pull Request Completed

© The Independent Institute of Education (Pty) Ltd 2023 Page 186 of 290
IIE Module Manual APPR6312

3 Continuous Builds
3.1 What is Continuous Integration?
This section was adapted from Learning Unit 5 of (The Independent Institute of Education,
2018).

“DevOps is the blending of tasks performed by a company’s application development and


systems
operations teams.” (TechTarget, 2017)

Before DevOps, the development team typically developed and tested their software on
independent
environments. And once the software is done, the operations team would take over and
deploy the
software to the live servers. (TechTarget, 2017)

In DevOps, the idea is to bring development and operations closer together, so that the
same team
does the development and deployment. Typically, these deployments are automated as
much as
possible. (TechTarget, 2017)

On the DevOps continuum, there are three different levels: continuous integration,
continuous delivery.
and continuous deployment. (CollabNet, 2018b) In this learning unit, we are focussing
only on
continuous integration. We will look at the other two in Learning Unit 5. So, what is
continuous
integration?

“Continuous Integration (CI) is a development practice that requires developers to


integrate code into
a shared repository several times a day. Each check-in is then verified by an automated
build, allowing
teams to detect problems early.” (ThoughtWorks, 2018)

If you haven’t worked on a large project with many developers before, you may not
appreciate the
value of continuous integration yet. In Section 2, we have already seen how to work with a
shared
repository. But even though we know how to branch and merge, we avoided for the most
part the
issues that can arise with merge conflicts.

Imagine for a moment a team of five developers all working on the same code base. If one
developer

© The Independent Institute of Education (Pty) Ltd 2023 Page 187 of 290
IIE Module Manual APPR6312

makes a change to an Application Programming Interface (API) but doesn’t check in that
change to the
repository for a couple of days, the next time that they commit code a lot of other people’s
work is likely
to no longer compile, let alone work.
Because they were still blissfully unaware of the change in API and were coding against
the old version.

The longer a developer neglects to push code, the more likely conflicts become when the
code is
merged. And while modern source control tools do help with merging, it is not a position
that
developers should get themselves into in the first place.

The second part of the definition mentions that check-ins (commits that are pushed in Git)
are checked
using an automated build. Building the source code using an automated build tool
eliminates the type
of problems that can happen where “it works on my PC!” For example, if a developer
forgets to check
in a new file, the build will work perfectly well on the developer’s own PC. But when the
build server
tries to build it, the missing file will cause the build to fail.

© The Independent Institute of Education (Pty) Ltd 2023 Page 188 of 290
IIE Module Manual APPR6312

Figure 221: Developing, Building and Releasing Software


(Git logo from (Git, n.d. c))

Figure 221 shows the basic steps taken by a developer, the build agent (automated build
process) and
the release agent (automated deployment process) to develop, continuously integrate and
continuously deploy software.
3.2 Benefits of Continuous Integration
We have already seen some of the benefits of continuous integration in the discussion of
the definition
above. Here is a more complete list. Some of these items assume that we have
continuous automated
testing in place too. (We will look at the details of this in Learning Unit 4. For now, assume
that we
have automated tests.)

• By building and testing code on an environment that is not the developer’s


computer, risks associated with things that are specific to a local environment are
mitigated. (Taylor, 2017)
• If you have a good suite of automated tests, and all the tests pass during a build,
you have
confidence in the quality of the code. (Taylor, 2017)
• Since the build is done on the same environment with the same configuration all the
time, the
results are highly consistent. Automated builds don’t accidentally forget about
some steps or
misconfigure things. (Taylor, 2017)
• Code reviews can be made faster, since the reviewers can know what the code is
of a certain
minimum standard if the build completes successfully. (Voort, 2017)
• Continuous integration is the first step towards continuous deployment, which
means that good
quality software can be created much faster. (Ciuluvica, 2018)
• Even significant changes to the code can be made confidently, since errors in the
process will
• likely be caught by the automated build and tests. (Ciuluvica, 2018)

3.3 Creating a Pipeline


We are pros by now with the first part of continuous integration – working with a shared
repository.
It is now time to learn how to set up automated builds with Azure Pipelines.

Included in the free offering for Azure Pipelines (as of 1 January 2020), is one Microsoft-
hosted CI/CD

© The Independent Institute of Education (Pty) Ltd 2023 Page 189 of 290
IIE Module Manual APPR6312

agent, with 1 800 minutes per month with one parallel job. (See Figure 222 for a
screenshot of the
relevant pricing page.) This should be more than enough for our purposes.

Figure 222: Azure Pipelines Free Offering


Screenshot from (Microsoft, n.d. g)

To create a new pipeline:

1. Browse to Azure DevOps at https://dev.azure.com/.


2. Browse to the project that you want to work with.
3. Click Pipelines.
4. If you don’t have any pipelines yet, you will see a page that makes creating the
pipeline easy.
Click Create Pipeline.

© The Independent Institute of Education (Pty) Ltd 2023 Page 190 of 290
IIE Module Manual APPR6312

Figure 223: Choose Source Location


5. When the pipeline is created, it will build source code from a repository somewhere.
And the
configuration of the pipeline is also committed to that repository. Choose the Azure
Repos Git
repository.

Figure 224: Select the Repository

6. Select the repository with the source code that we want to build – Second
Repository.
7. Lots of predefined configuration are available, including a configuration that works
perfectly for
us – ASP.NET Core. Choose that as the configuration.
8. The pipeline configuration will be displayed. Edit the script line to include the
location of the
solution file in the repository.

Figure 225: Pipeline Configuration with Solution File

© The Independent Institute of Education (Pty) Ltd 2023 Page 191 of 290
IIE Module Manual APPR6312

9. Click Save and run.


10. The configuration will be committed to our repository. So, a Commit message can
be entered.
11. Click Save and run.

You will see the below page displaying the status of the build job as it progresses.
After a while (one minute, 23 seconds in this case), the build should complete
successfully.

Figure 226: Pipelines Job Success

Click Job to see the detailed results, including the command line output of the various
tasks.

Figure 227: Detailed Build Job Results

To edit a pipeline:

1. Click on the pipeline in the Pipelines list.


2. At the top right of the page, click Edit.

This editor (shown in Figure 228) provides the possibility of editing the configuration
manually,
or to select a task to perform during the build from a long list of tasks that have been
predefined.

© The Independent Institute of Education (Pty) Ltd 2023 Page 192 of 290
IIE Module Manual APPR6312

To add a task:

1. Put your cursor at the location where you want to insert the task.
2. Click the desired task on the Tasks list.
3. Specify any parameters required by the task.
4. Click Add.

Figure 228: Editing a Pipeline

The details of the many tasks are beyond the scope of this module. Search online if you
need more
information about any specific task.

3.4 Building a Project


So far, we have seen that a build is triggered when we first set up the pipeline. And when
we change
the configuration. But that is not the only way to trigger a build.

A build can be triggered manually, by clicking Run pipeline on the pipeline’s page in
Azure DevOps.

© The Independent Institute of Education (Pty) Ltd 2023 Page 193 of 290
IIE Module Manual APPR6312

Figure 229: Manually Triggering a Build


By default, pipelines are set up to also be triggered whenever code is pushed to the
repository.
There are also other automated triggers.

To configure the triggers for a pipeline:

1. On the pipeline page, click Edit.


2. Click the Triggers tab at the top of the page.

Figure 230: Pipeline Triggers

Here we can see that the pipeline will indeed run when code is pushed to the Second
Repository.
It is also possible to set up scheduled builds. This is often used to create a nightly build.
And it is also possible to start this build when another build completes.

© The Independent Institute of Education (Pty) Ltd 2023 Page 194 of 290
IIE Module Manual APPR6312

3.5 Using Build Agents


So far, we have made use of the one free Microsoft-hosted CI/CD agent without even
realising it.

A build agent is an installable piece of software that performs build job tasks. There are
two options for
agents: Microsoft-hosted or self-hosted. The Microsoft-hosted option makes it easy.
Every time a job is started, a new VM is automatically created for the duration, and
destroyed at the
end of the job execution. (Staheli, et al., 2019)

It is also possible to host your own build agent. The software is available for macOS,
Linux, Windows
and as a Docker image. This provides a great deal of flexibility since you control
everything on the
environment where the build agent runs. But in turn, it adds the complexity of having to
manage
everything yourself. (Staheli, et al., 2019)
Each agent has a set of capabilities that are either automatically defined by the system or
explicitly
added by the user. When you create a pipeline, it will require specific capabilities. And
Azure Pipelines
will match the agent that has the right capabilities with each pipeline. (Staheli, et al., 2019)

The agent pools can be set up in the organisation settings in Azure DevOps. For more
information
about how to do that, read (Staheli, et al., 2019).

© The Independent Institute of Education (Pty) Ltd 2023 Page 195 of 290
IIE Module Manual APPR6312

4 Package Hosting
4.1 What are Azure Artifacts?
When we were using SqlClient and Entity Framework in Learning Unit 2, we made use of
NuGet to get
these packages. But have you ever wondered what happens when you do that?

“NuGet is the package manager for .NET. The NuGet client tools provide the ability to
produce and
consume packages.” (Microsoft, n.d. h)

Microsoft has made available a central location (https://www.nuget.org/) where developers


(and even Microsoft) can publish packages containing one or more assemblies. Package
developers
are called creators. Other developers (called consumers in this context) can then use
these packages.
(Jones, et al., 2019)

Figure 231: NuGet Page for EntityFrameworkCore.SqlServer


from (Microsoft, n.d. i)
NuGet also manages multiple versions and dependencies.
For example, Microsoft.EntityFrameworkCore.SqlServer version 3.1.0 requires
Microsoft.Data.SqlClient (>= 1.0.19269.1) and Microsoft.EntityFrameworkCore.Relational
(>= 3.1.0)
as we can see in Figure 231.

It is also useful to note that each NuGet package has a license under which it is released.
Make sure
that the license is compatible with how you intend to use the package. Get legal advice if
you are unsure about a software license.

© The Independent Institute of Education (Pty) Ltd 2023 Page 196 of 290
IIE Module Manual APPR6312

The point of having a central repository of packages is to make the packages easily
accessible to
everybody. You don’t need to keep local copies of packages because they are always
available.
But there are two cases that go beyond this simple statement.

What if you are building software that is absolutely critical to the operation of your
business, and one
day one of the packages are just no longer available from the central NuGet repository?
Or the central
repository is not accessible for some reason. This scenario is unlikely, but not impossible.
Some
organisations would choose to keep their own copies of critical packages for this reason.
(Microsoft, n.d. j)

The second reason why it may be desirable to have a private repository for packages, is if
you want to
share packages between various projects internal to the company. These packages are
not suitable
for hosting publicly in most cases, so having a private repository is the way to go.
(Microsoft, n.d. j)

Figure 232: Azure Artifacts (icons from (Microsoft, n.d. j))

Azure Artifacts is a package repository that can handle both use cases. NuGet packages
can be
stored in Azure Artifacts, and then the Azure Pipelines get any packages from there
instead of from the
central NuGet repository. (Microsoft, n.d. j)

Azure Artifacts goes beyond just NuGet though. It can also store Maven, npm and Python
packages.
And you can host your own packages, which will simplify builds.

© The Independent Institute of Education (Pty) Ltd 2023 Page 197 of 290
IIE Module Manual APPR6312

Note that there is a limit on the free storage provided in Azure Artifacts – 2GB as of
January 2020.
(Wilson & chcomley, 2019) This should be more than enough for our purposes.

4.2 Benefits of Azure Artifacts


The benefits of Azure Artifacts include:

• Public packages are safely stored, so that builds don’t need to depend on third party
sources.
(Microsoft, n.d. j)
• Sharing packages between projects can simplify the build process. (Microsoft, n.d. j)
• Packages can selectively be shared with third parties. (Dixon, 2018)
• One feed can host artefacts from multiple sources. (Microsoft, n.d. j)

© The Independent Institute of Education (Pty) Ltd 2023 Page 198 of 290
IIE Module Manual APPR6312

4.3 Azure Artifacts Best Practices


We have already seen that there are two use cases for Azure Artifacts: creating packages
during a
build, and consuming packages during a build. There is a set of best practices for each
use case.

Before we jump into the best practices, there are two definitions that we need first.

“A feed is a container for packages.” (Danielson, et al., 2018d)

“Views enable you to share subsets of the NuGet, npm, Maven, and Python package-
versions in your
feed with consumers.” (Batkoski, et al., 2017)

4.3.1 Creating Packages

The best practices for creating packages are (Danielson, et al., 2018d):

• Each project should only reference a single feed.


• When the package is created during the build, immediately publish it to the feed.
• Use retention policies to ensure that very old packages are automatically cleaned
up.
• There are different views that can be created based on the maturity of a package.
Make sure it is
published to the right view.
• Check that the views that you want to share across the organisation are in fact
made visible.

4.3.2 Consuming Packages

The best practices for consuming packages are (Danielson, et al., 2018d):

• Each project should reference only a single feed.


• Use upstream sources if you need to use multiple public or even internal sources.
• Check the order in which sources are added, since that affects the resolution order.
• Specify public upstream sources first, so that these have the highest priority in the
resolution
order.

4.4 Using Azure Artifacts


We will be focusing on working with NuGet packages in Azure Artifacts. Search online for
more
information if you want to use a different type of package.

© The Independent Institute of Education (Pty) Ltd 2023 Page 199 of 290
IIE Module Manual APPR6312

4.4.1 Creating a Feed

To create a new feed in for a specific project in Azure Artifacts:

1. Browse to Azure DevOps at https://dev.azure.com/.


2. Browse to your project.
3. Click Artifacts.
4. Click Create Feed.

Figure 233: Feed Name Rules

5. Enter a valid Name for the feed.


6. Choose a Visibility setting – sharing with either the whole organisation or with only
specific
people. Choose Members of <organisation> for our purposes here.
7. Check that Includes packages from common public sources is selected.
8. Click Create.

4.4.2 Adding Upstream Sources

When we created our feed, we chose to add the common public sources, which includes
NuGet.
This means that adding upstream sources will likely only be necessary if we want to
include feeds
from elsewhere in our organisation.

To add an upstream source to a feed:

1. Browse to Azure Artifacts.

Figure 234: Feed Settings

2. Select the feed that you want to edit and click Settings (with the icon).
3. Click Feed settings.

© The Independent Institute of Education (Pty) Ltd 2023 Page 200 of 290
IIE Module Manual APPR6312

Figure 235: Upstream Sources

4. Click Upstream sources.


5. Click Add upstream source.
6. Choose to either add a public source or a feed in this organisation.
7. Fill in all the required fields and click Add.

4.4.3 Consuming Packages from a Feed in Visual Studio

The Azure Artifacts web interface provides us with a lot of information about consuming
packages from
a feed. Click Connect to feed and then choose Visual Studio.
The instructions as displayed in Figure 236 will be displayed, with the source URL for your
repository
of course.

© The Independent Institute of Education (Pty) Ltd 2023 Page 201 of 290
IIE Module Manual APPR6312

Figure 236: Visual Studio Instructions

Follow these instructions to set up the feed. Read (Wilson, et al., 2018) if you need more
details.

To use the feed in a project:

1. In Solution Explorer, right-click the project and choose Manage NuGet Packages.

Figure 237: Package Source

2. In the top-right corner of the NuGet window, change the Package source to be the
newly configured source.

Any existing packages should be handled seamlessly since we saw that NuGet was
included as one of the upstream sources.

© The Independent Institute of Education (Pty) Ltd 2023 Page 202 of 290
IIE Module Manual APPR6312

There is one gotcha with using packages from upstream sources in Visual Studio. The
first time you use a package, it gets added to the feed. And from that point, you can
browse for the package just as you would have with the central NuGet repository. The
trick is that the first usage requires installing the package using the command line.
(Wilson, et al., 2018)

To install a NuGet package using the command-line (Wilson, et al., 2018):

1. Browse to the upstream source and copy the Install-Package command. For NuGet,
it appears in the dark blue block close to the title of the page. (See Figure 231 for an
example.) For this discussion, let’s say we want to install Newtonsoft.Json. The
Install-Package command is:

Install-Package Newtonsoft.Json -Version 12.0.3

2. In Visual Studio on the main menu click Tools, then NuGet Package Manager and
then Package Manager Console.
3. Paste the command and press Enter to run it.

4.4.4 Consuming Packages from a Feed in Azure Pipelines

To set up an Azure Pipeline to use a feed:

1. Edit the configuration of the pipeline.

Figure 238: NuGet Task in Pipeline

2. Add a blank line before the script step and put the cursor on that line.
3. Under Tasks, search for NuGet.
4. Click the task that is just named NuGet.

© The Independent Institute of Education (Pty) Ltd 2023 Page 203 of 290
IIE Module Manual APPR6312

Figure 239: NuGet Restore Command Parameters

5. Choose the Command restore.


6. Feeds to use should be Feed(s) I select here.
7. Choose the Azure Artifacts feed to use from the dropdown list.
8. Uncheck Use packages from NuGet.org. It is an upstream source, so we don’t
need to specify it twice.
9. Click Add.

The NuGetCommand@2 restore will not complete within the one-hour time limit that
there is on a build. But what this has provided us is the vstsFeed variable. Continue with
the steps on the next page to change this to a DotNetCoreCLI@2 task instead.

10. Edit the newly created task to look like the below but using your vstsFeed variable
(make sure to keep that!). Configuration from (Shigihalli, 2019).

- task: DotNetCoreCLI@2
displayName: 'dotnet restore from feed'
inputs:
command: restore

© The Independent Institute of Education (Pty) Ltd 2023 Page 204 of 290
IIE Module Manual APPR6312

projects: '**/*.csproj'
vstsFeed: '<your feed here>'
includeNuGetOrg: false
versioningScheme: byBuildNumber

11. Click Save.

Tip: If you run into version incompatibility issues in your build after this change, remove
the Microsoft package.AspNetCode. Razor. Design from the project.

4.4.5 Publishing NuGet Packages from Azure Pipelines

Just like we can consume different types of packages from Azure Artifacts, it is also
possible to publish different types of artifacts. We will look at two types: NuGet packages
and Universal packages. Universal packages are the Azure Artifacts' way to store any files
regardless of type.

There are two ways to build a .NET Core project using Azure pipelines. The way that the
Azure Pipeline template uses the script step. Another way, which is more flexible, is to use
DotNetCoreCLI@2 tasks. Read (Cokely, 2019) for information about how to do that.

NuGet packages contain reusable code. So, for this purpose, the web app that we have
been working with so far is not the best thing to work with. Let’s create a new project for
this purpose.

To set up the new project:

1. Using Visual Studio, create a new Class Library (.NET Core) project called
Company Library in the same solution that we have worked with so far.
2. In the Solution Explorer, right-click the CompanyLibrary project and click
Properties.
3. Change the Target framework to .NET Core 5.0.
4. Click the Package category.
5. Click to select the Generate NuGet package on build checkbox.
6. Change any of the package properties such as Authors if you want to.
7. Save the changes and close the project properties window.
8. Commit and push the changes to the master branch.
9. Check that the existing Azure Pipeline build still passes.

When the script step is called in the pipeline, the NuGet package will automatically also be
built. But you can also see it when you build the project from Visual Studio.

Figure 240: Build Results with NuGet Package

© The Independent Institute of Education (Pty) Ltd 2023 Page 205 of 290
IIE Module Manual APPR6312

Now we need to update the pipeline to push the NuGet package to Azure Artifacts. Open
the configuration and add the following task at the end of the file. Task configuration
adapted from (Cokely, 2019).

- task: NuGetCommand@2
displayName: 'nuget push'
inputs:
command: 'push'
feedsToUse: 'select'
packagesToPush:
'$(Build.SourcesDirectory)/**/*.nupkg;!$(Build.SourcesDirectory)/**/*.symbols.n
upkg'
nuGetFeedType: 'internal'
publishVstsFeed: '<your feed here>'
versioningScheme: 'off'
allowPackageConflicts: true

Note that packagesToPush needs to be all on one line after you copy it, as shown in
Figure 241. And remember to put that long identifier of your feed in too.

Figure 241: Pipeline Configuration

Save the configuration and wait for the build job to complete. Check that the build is still
succeeding.

Browse to your Azure Artifacts feed and you will see that the new artifact is now available
as shown in Figure 242. Notice how the source is This feed, which distinguishes it from
the packages that were pulled from the NuGet Gallery – the public NuGet repository.

Figure 242: Published Package

4.4.6 Publishing Universal Packages from Azure Pipelines

As mentioned earlier, there is also the possibility of publishing anything that you want as a
Universal package. As an example, let’s publish the README.md file from the source
code.

© The Independent Institute of Education (Pty) Ltd 2023 Page 206 of 290
IIE Module Manual APPR6312

Add the following task to the pipeline configuration. Configuration based on (KathrynEE, et
al., 2019d).

- task: UniversalPackages@0
displayName: Universal Publish
inputs:
command: publish
publishDirectory: '$(Build.SourcesDirectory)/README.md'
feedsToUsePublish: internal
vstsFeedPublish: '<your feed here>'
vstsFeedPackagePublish: 'company-website-readme'
packagePublishDescription: 'Readme file'

Note that the package name must be lowercase alphanumeric and may contain dots and
dashes.

© The Independent Institute of Education (Pty) Ltd 2023 Page 207 of 290
IIE Module Manual APPR6312

And here is the published package.

Figure 243: Published Universal Package

You might have noticed that there are variables like $(Build.SourcesDirectory) that
are used in these configurations. Read (Staheli, et al., 2019b) for the full list.

We will look at ways to publish a running application in Learning Unit 5.

5 Recommended Additional Reading


Cokely, D., 2019. Creating NuGet packages in Azure DevOps with Azure Pipelines and
YAML. [Online]. Available at: https://medium.com/@dan.cokely/creating-nuget-packages-
in-azure-devops-with-azure-pipelines-and-yaml-d6fa30f0f15e [Accessed 13 July 2021].

Danielson, S. et al. 2018. Adopt a Git branching strategy. [Online]. Available at:
https://docs.microsoft.com/en-us/azure/devops/repos/git/git-branching-
guidance?view=azure-devops [Accessed 13 July 2021].

Ernst, M., 2018. Version control concepts and best practices. [Online]. Available at:
https://homes.cs.washington.edu/~mernst/advice/version-control.html [Accessed 13 July
2021].

6 Recommended Digital Engagement and Activities


It is recommended that you complete the Get started with Azure DevOps module on
Microsoft Learn, available at https://docs.microsoft.com/en-gb/learn/modules/get-started-
with-devops/

It is recommended that you complete the Build applications with Azure DevOps learning
path on Microsoft Learn, available at https://docs.microsoft.com/en-gb/learn/paths/build-
applications-with-azure-devops/

Watch the two videos about Azure Pipelines at https://docs.microsoft.com/en-


us/azure/devops/pipelines/get-started/?view=azure-devops

It is recommended that you complete the Manage build dependencies with Azure Artifacts
module on Microsoft Learn, available at https://docs.microsoft.com/en-gb/learn/modules/
manage-build-dependencies/

© The Independent Institute of Education (Pty) Ltd 2023 Page 208 of 290
IIE Module Manual APPR6312

Learning Unit 4: Continuous Testing


Learning Objectives: My notes
• Define unit tests.
• Identify the benefits of unit testing.
• Create unit tests.
• Differentiate between a unit test and an integration
test.
• Create an integration test.
• Define load testing.
• Create a load test for a web project.
• Explain the purpose of automated user interface
testing.
• Create Selenium user interface tests.
• Explain how to add tests to an Azure Pipelines
pipeline.
Material used for this learning unit:
• This module manual.
• Microsoft Visual Studio 2022.
• Selenium.
• Microsoft Azure Pipelines.
How to prepare for this learning unit:
• Read through the content of this learning unit.
• Work through the activities on Learn.

1 Introduction
In Learning Unit 3, we mentioned that quite a few of the benefits of continuous integration
depend on continuous testing being in place. In this learning unit, we will explore various
types of automated testing:

• Unit testing;
• Integration testing;
• Load and stress testing; and
• User interface testing.

© The Independent Institute of Education (Pty) Ltd 2023 Page 209 of 290
IIE Module Manual APPR6312

Figure 244: Levels of Testing


(based on (Software Testing Fundamentals, 2019))
Can you think
of any tests
You might be familiar with the test levels shown in Figure 244. The
that cannot be
figure shows where the various automated tests fit into the
automated?
levels.User interface testing and load and stress tests may also be
used in acceptance testing, depending on the requirements of the
specific client. For our purpose though, it is useful to see that for user interface testing and
load and stress tests, we need to have the system in place including all the components
from the database to the user interface.

2 Unit Testing
2.1 What is a Unit Test?
Unit tests have been around for a long time, and as Martin Fowler points out, there have
been many definitions that have been used. Here are the common elements that he lists
across all the definitions that he has come across (Fowler, 2014):

• Unit tests are designed to test only a small part of the system.
• Software developers write the unit tests using a unit testing framework inside their
normal tools.
• Unit tests should be much faster to run than higher-level tests.

The idea is to test a small, isolated part of the software to see if it works as expected. This
makes it easier to find errors, since there are as few as possible complex interactions in a
small piece of code. (Novoseltseva, 2019)

Exactly what the boundary is of such a small part of a system that is called a unit,
depends on the technology and the decisions made by a software development team.
(Fowler, 2014) The fact that the tests should be running very fast does provide some
guidelines, though. For example, calling a service or accessing a database are notoriously
slow operations. That would be more appropriate in an integration test (see the next
section of this learning unit for more information).

A good unit test should be repeatable. Multiple runs of the test should always return the
same result. (Reese, et al., 2018) This is important since the order in which tests are
executed is not guaranteed. And if you write good tests, that shouldn’t matter.

© The Independent Institute of Education (Pty) Ltd 2023 Page 210 of 290
IIE Module Manual APPR6312

2.1.1 When to Write Tests

We have already established that software developers write the unit tests. There are two
possibilities in terms of timing: writing tests before or after writing the code that it tests.

Writing the tests first might sound very strange. But in Test Driven Development (TDD)
that is precisely the approach. You write the unit test first to reflect the requirement you
want to implement. And then you execute the code until the unit test passes. (Farcic,
2013)

Badly designed code can be hard or even impossible to unit test. Read (Kolodiy, n.d.) for
an excellent discussion about how to write testable code.

Remember in Scrum, we mentioned that there is a definition of done that is agreed on?
If a team commits to doing unit testing, it is a good idea to include unit tests in the
definition of done for both new features and fixing bugs. (Riggins, 2017) Developers
should run the unit tests before they push changes to ensure that they haven’t caused
any regressions. And the unit tests should be executed during all builds.

2.1.2 Unit Testing Frameworks

The definition also mentioned that there are unit testing frameworks that are used to
create unit tests.

Unit testing frameworks “are software tools to support writing and running unit tests,
including a foundation on which to build tests and the functionality to execute the tests and
report their results.” (Hamill, 2004)

It is possible, of course, to do everything yourself, from the details of the tests to creating
a webpage with the test results. But that would be a large amount of unnecessary effort
for no good reason, since testing frameworks exist that will greatly simplify the process.

Unit test frameworks have been around for a long time, and there are different possibilities
to choose from when working with C# (Dietrich, 2017):

• MSTest was created by Microsoft.


• NUnit is an independent project based originally on the JUnit framework for Java.
• xUnit.NET is another independent project with a very specific way of thinking about
test.

All three of these are supported by Visual Studio.

Which framework to choose depends on the requirements of the project. Read (Mathurin,
2018) for an interesting discussion about what influenced their team’s decision.

For the purpose of this module, we will use MSTest since it is the Microsoft product, and it
will illustrate the concepts around unit testing that can be applied to other frameworks too.

© The Independent Institute of Education (Pty) Ltd 2023 Page 211 of 290
IIE Module Manual APPR6312

2.2 Benefits of Unit Testing


When we talk about the benefits of unit testing, some of the benefits will sound very much
like the continuous integration benefits. That is because unit testing is (ideally) part of the
ongoing integration process.

The benefits of unit testing include:

• Developers can refactor code without fear of breaking something, since the unit
tests will catch any issues. (Novoseltseva, 2019)
• Writing tests with the code will improve code quality since it will make you think
about all the use cases for the code. (Novoseltseva, 2019)
• Bugs in the code are found very early, before they impact other parts of the
system. (Novoseltseva, 2019)
• Finding bugs early in the development process means the cost of writing software is
lower. (Novoseltseva, 2019)
• Unit tests are automated tests, which means that unlike manual testing, they can
be run as often as necessary once they have been written. (Grantz, 2017)
• Unit test code can be viewed as a form of documentation describing what the
intended behaviour of a piece of code is. (Grantz, 2017)
• Code coupling will be reduced since writing tests will mean that any tight coupling
will become obvious. (Reese, et al., 2018)

2.3 MSTest Unit Tests

2.3.1 Creating Testable Code

In this section, we are focussing on how to use MSTest. So, we will create some code first
and then add unit tests to check whether the code works as expected.

Create a new .NET Core Class Library project called UnitTestExperiments. Add the
below class to the project.

public class Calculator


{
public int Add(int a, int b)
{
return a + b;
}

public int Subtract(int a, int b)


{
return a + b; // intentional mistake!
}
}

© The Independent Institute of Education (Pty) Ltd 2023 Page 212 of 290
IIE Module Manual APPR6312

2.3.2 Creating Unit Tests

When creating tests, it is best to have a test project for each code project. (Dietrich, 2017)

In the same solution, create a new project. Choose the MSTest Test Project (.NET Core)
project template. Call the project UnitTestExperiments_Tests.

Add a dependency on the UnitTestExperiments project.

You will see that a unit test file called UnitTest1.cs is created as a part of the project. It is
a C# class, but what distinguishes it is the fact that it has the [TestClass] attribute. And
the test method has the [TestMethod] attribute. This is how the MSTest framework
knows to execute the methods as unit tests.

In the test project, create a new C# class called CalculatorTests. Remember to add the
using statement to access the test tools (have a look at UnitTest1.cs):

using Microsoft.VisualStudio.TestTools.UnitTesting;

Important! Make the CalculatorTests class public, otherwise, the tests won’t be executed.
(ElGauchooo, 2014)

We are ready to create our first unit test. Let’s focus on the Add method first, and let’s
check that adding zero and one will return one.

It is best practice to name the unit tests in a specific way. The name should contain three
things (Reese, et al., 2018):
• Method that is being tested;
• Scenario that is tested; and
• The expected outcome.

If you look at the list of all the tests, you should be able to know what the purpose of each
test is without looking at the code. (Reese, et al., 2018)

Let’s create our test method inside the CalculatorTests class:

[TestMethod]
public void Add_ZeroPlusOne_ReturnsOne()
{
}

We know three things from the name: we are testing the add method, adding zero and
one and expecting the method to return one.

© The Independent Institute of Education (Pty) Ltd 2023 Page 213 of 290
IIE Module Manual APPR6312

2.3.3 Writing Test Code

Now that we have the project, class and method in place, we can write the actual test
code. When it comes to structuring a test, there is a common pattern that is considered
best practice (Reese, et al., 2018):

• Arrange – create and initialise any objects and variables that you will need.
• Act – do something with the object that you are testing.
• Assert – check that the expected behaviour happened.

Here is the body of the test method:


[TestMethod]
public void Add_ZeroPlusOne_ReturnsOne()
{
// arrange
Calculator calculator = new Calculator();
const int ZERO = 0;
const int ONE = 1;

// act
int actual = calculator. Add(ZERO, ONE);

// assert
Assert.AreEqual(ONE, actual);
}
In the arrange section, we initialise everything. We will be testing the Calculator class, so
we will create an instance of it.
We also define two constants for the values zero and one. Here it might seem silly since
the values are so obvious, but it is best practice to avoid magic values. If you are working
with the maximum allowed value, for example, create a constant with the name
MAXIMUM_VALUE. Be as descriptive as possible with the constant names since it makes
the tests easier to understand. (Reese, et al., 2018)

The act section of this test is simple since the example is so trivial. We pass the two
parameters to the method and store the return value in a variable called actual. It is useful
to call this actual, so you don’t confuse the actual and expected values.

Lastly, we assert that the answer is what we expected. MSTest provides a lot of useful
assert methods in the Assert class, for example (Microsoft, n.d. k):

• AreEqual – checks whether the parameters are equal, and throws an exception if
they are not;
• AreNotEqual – checks whether the parameters are not equal, and throws an
exception if they are not;
• AreSame – checks whether the parameters are references to the same object and
throws an exception if they are not.

© The Independent Institute of Education (Pty) Ltd 2023 Page 214 of 290
IIE Module Manual APPR6312

Read the documentation for the Assert class (Microsoft, n.d. k) for the full list.

In MSTest, the expected value should be specified first and the actual value second.
Otherwise, the error messages will not make sense.

As an exercise, write a unit test that tests the subtract method in the scenario where you
subtract a number from itself (e.g., six minus six) and expect to get an answer of zero.

2.3.4 Running Tests

To run all the unit tests in the project, right-click the test project and click Run Tests.
Tests can also be executed for a specific test class by right-clicking on the class.

The add test will pass. The subtract test will fail, since we included the intentional error
that the subtract method adds. This kind of error is typically due to code that was copied
and not fully modified.
2.4 Test Explorer
The test results are shown in the Test Explorer window, which will automatically be
opened when you run tests for the first time.

Figure 245: Test Explorer with Results

On the left we see a hierarchy of all the tests – project, class and method. The red x icon (
) indicates that a test failed. As expected, the subtract test fails right now.

Clicking on a test in the hierarchy will display details about it in the Test Detail Summary
panel on the right. Looking at the message, we see that we expected a return value of 0
but got 12 instead. Clicking on the stack trace will take you to the point in the unit test
class where the failure happened.

The test explorer window also shows us how long the tests took to run. In total, it took only
11 ms. It is worthwhile keeping an eye on this, since unit tests are intended to run quickly.

© The Independent Institute of Education (Pty) Ltd 2023 Page 215 of 290
IIE Module Manual APPR6312

Figure 246: Test Explorer Tools

At the top of the Text Explorer window, there are several useful tools. Various
combinations of tests can be run from here. For example, if you fixed something in the
code you might want to run just the failed tests to see whether your fix worked. Or you
might want to debug the code so that you can step through it line by line to see why things
are not working as expected.

The next group of buttons filter which test results are visible.

Figure 247: Add to Playlist

A playlist of tests can be created – a specific set of tests that you want to run. Right-click
on a test class or test method in the hierarchy and click Add to Playlist. A playlist can be
opened using the Open Playlist File button (with icon ).

2.5 Fakes: Mocks and Stubs


The tests that we have looked at so far were very simple. We only have a single class with
no dependencies on anything. It does happen that you get classes like this in real

© The Independent Institute of Education (Pty) Ltd 2023 Page 216 of 290
IIE Module Manual APPR6312

applications, but more often the structure is more complex, and there are dependencies
on other units. What do we do in this case? We fake it.

“Fakes are objects that have working implementations, but not same as production one.
Usually, they take some shortcut and have simplified version of production code.” (Lipski,
2017)

An example of a fake is a data access object that returns in-memory objects rather than
querying the database. (Lipski, 2017) Fakes is a term that describes either mocks or stubs,
depending on how they are used. (Reese, et al., 2018)
“Stub is an object that holds predefined data and uses it to answer calls during tests. It is
used when we cannot or don’t want to involve objects that would answer with real data or
have undesirable side effects.” (Lipski, 2017)

“Mocks are objects that register calls they receive. In test assertion we can verify on
Mocks that all expected actions were performed.” (Lipski, 2017)

Both stubs and mocks have code that is a simplified version of the actual code, but their
purposes are different. A stub just mimics the actual code while a mock is used in an
assert to check whether the test passed.

Say we have a Character class in a game, and it has a method called GetRange which
calculates the how far the character can attack based on the currently equipped weapon.

public class Character


{
public IWeapon Weapon { get; set; }

public int GetRange()


{
if (Weapon == null)
{
return 1;
}
else
{
return Weapon.GetRange();
}
}
}

If we want to test the else part, we will need to set a weapon. So, let’s create a fake
weapon in the test project.

© The Independent Institute of Education (Pty) Ltd 2023 Page 217 of 290
IIE Module Manual APPR6312

class FakeWeapon : IWeapon


{
public int Range { get; set; }

public int GetRange()


{
return Range;
}
}

We don’t know yet whether it is a mock or a stub because we haven’t seen yet what the
test code is going to look like. So, it is better to call it a fake and then you can use it as
later. (Reese, et al., 2018)

Let’s look at the unit test.

using Microsoft.VisualStudio.TestTools.UnitTesting;
using UnitTestExperiments;

namespace UnitTestExperiments_Tests
{
[TestClass]
public class CharacterTests
{
[TestMethod]
public void GetRange_WeaponWithRangeFour_ReturnRangeTwo()
{
var stubWeapon = new FakeWeapon();
const int RANGE_FOUR = 4;
stubWeapon.Range = RANGE_FOUR;
Character character = new Character();
character.Weapon = stubWeapon;

int actual = character.GetRange();

Assert.AreEqual(RANGE_FOUR, actual);
}
}
}

We create our fake weapon, set the range to what we expect and populate the character
with it. The fake weapon responds to calls in the process, but the assert value comes from
the character. So, our fake weapon here acts as a stub.

What if we wanted to check whether the fake weapon got called, and that the value of 4
was not by coincidence hardcoded in the Character class for all weapons? Mocks
register calls that they receive. So, let’s update our fake weapon to set a flag when the
GetRange method is called.

© The Independent Institute of Education (Pty) Ltd 2023 Page 218 of 290
IIE Module Manual APPR6312

class FakeWeapon : IWeapon


{
public int Range { get; set; }
public bool GetRangeCalled { get; set; }

public int GetRange()


{
GetRangeCalled = true;
return Range;
}
}

Now we can add a new test method that checks whether the flag was set. It is a best
practice to have only one assert per test method, so don’t be tempted just to add another
assert to our previous test. And there is a good reason for this. When an assert fails, the
test execution stops. Everything after that point will not get tested until that problem is
resolved. (Reese, et al., 2018)

[TestMethod]
public void GetRange_WeaponSet_WeaponGetRangeIsCalled()
{
var mockWeapon = new FakeWeapon();
const int RANGE_FOUR = 4;
mockWeapon.Range = RANGE_FOUR;
Character character = new Character();
character.Weapon = mockWeapon;

character.GetRange();
bool wasCalled = mockWeapon.GetRangeCalled;

Assert.IsTrue(wasCalled);
}

Here the assert is done based on the value from the fake, so it is used as a mock.

2.6 Using Microsoft Fakes


Microsoft Fakes is a mocking framework that can replace parts of the application with
either stubs or shims for unit testing purposes. (Warren, et al., 2016b)

Note that Microsoft Fakes is only supported in Visual Studio 2019 Enterprise Edition.
(Microsoft, n.d. m) If you don’t see the features described here, you likely have a different
edition.

Microsoft Fakes cannot be used with .NET Core projects.

© The Independent Institute of Education (Pty) Ltd 2023 Page 219 of 290
IIE Module Manual APPR6312

2.6.1 Stubs

We have seen that we can create stubs ourselves by simply writing normal C# classes.
But there is also a way to create stubs using Microsoft Fakes.

There are two steps to the process: add a fake assembly, and then use the stubs by
providing code for the methods. The instructions described here are adapted from
(Warren, et al., 2016b).
To add a fakes assembly:

1. Find the test project in the Solution Explorer.


2. Expand the Dependencies node and find the project where the interface that you
want to stub out is defined.
3. Right-click on the dependency, and then click Add Fakes Assembly.
4. Build the solution before trying to use the stubs.

Here is the example from (Warren, et al., 2016b) of how to create a stub using its
interface, specifying the return value of one of the methods.

IStockFeed stockFeed =
new StockAnalysis.Fakes.StubIStockFeed()
{
GetSharePriceString = (company) => { return 1234; }
};

2.6.2 Shims

If you look at the above example, you will notice that the fake weapon we created
implemented an interface called IWeapon. This is exactly what a mock and a stub requires
– working with an interface. (Churchman, 2017)

This is great when we have dependencies on other parts of our own code, since then we
have control over whether we have an interface or not. But what if you are dependent on a
third-party class where you don’t have an interface? Then you must use a shim.
(Churchman, 2017)

“Shims divert calls to specific methods to code that you write as part of your test.” (Warren,
et al., 2016)

Read (Warren, et al., 2016) and (Prescott, 2012) for more details.

© The Independent Institute of Education (Pty) Ltd 2023 Page 220 of 290
IIE Module Manual APPR6312

3 Integration Testing
3.1 What is an Integration Test?
Unit tests are great to test isolated parts of the system. But ultimately, the system will be
running as an integrated whole. And lots of unexpected behaviours can crop up when you
integrate all the parts of the system, so that also needs to be tested. Automated tests at
this higher level are called integration tests. (Latham, et al., 2019)

“Integration tests determine if independently developed units of software work correctly


when they are connected to each other.” (Fowler, 2018)

Components that are often included in integration tests are databases and file systems.
Since the actual components are used, integration tests require more code to create and
take much longer to run. (Latham, et al., 2019)

With unit tests you want to test as many scenarios as possible. And that is fine because
the tests run very fast. But be selective when creating integration tests. Only create tests
that will add value, and that cannot be tested using unit tests. (Latham, et al., 2019)

Create the unit tests and integration tests in separate modules, to avoid confusing the
types of tests, and to make it easier to selectively run tests during the build. (Latham, et
al., 2019)

Integration testing, while going through all the layers of the application, typically only
tests a few modules of the software. This is what distinguishes it from system testing,
where the whole system with all its modules is tested. (SoftwareTestingHelp.com, 2019)

3.2 Creating Tests


Integration tests follow the same steps as unit tests: arrange, act and assert. When testing
ASP.NET Core projects though, a web host and a test server client is also required. Both
need to be started before the actual tests can be executed.

Let’s write a test that calls the home page of our DJ Promo web app, to see how this
works. Open the solution containing the DJ Promo web app in Visual Studio before
continuing.

The steps described here are based on information from (Spasojevic, 2019) and (Latham,
et al., 2019).

To create a test project for an ASP.NET Core application:

1. In the same solution, create a new xUnit Test Project (.NET Core) project (make
sure you pick the C# one). Call the project DJPromoWebApp_IntegrationTests.
2. Choose .NET 5.0 as the Target Framework.

© The Independent Institute of Education (Pty) Ltd 2023 Page 221 of 290
IIE Module Manual APPR6312

3. Rename UnitTest1.cs (both the file and class in the file) to


HomeControllerIntegrationTests.
4. Right-click on the Dependencies node of the test project and click Add Project
Reference.
5. Click to select the DJPromoWebApp project and click OK.
6. Add the following NuGet packages:
Microsoft.AspNetCore.Mvc.Testing version 5.0.16
Microsoft.AspNetCore version 2.2.0
Microsoft.AspNetCore.Razor.Runtime version 2.2.0
Microsoft.AspNetCore.CookiePolicy version 2.2.8
Microsoft.AspNetCore.Mvc version 2.2.0
Microsoft.AspNetCore.HttpsPolicy version 2.2.0
Microsoft.AspNetCore.StaticFiles version 2.2.0

Run the tests – you should see the one test that passes.

If you see the message that you must build your solution to discover all tests but that
doesn’t help, close the solution and open it again.

Let’s have a look at the generated test class.

public class HomeControllerIntegrationTests


{
[Fact]
public void Test1()
{

}
}

You will notice that there is an unfamiliar attribute here – Fact. This is because we are
working with xUnit for this project. xUnit has two types of tests: facts are always true, while
theories only work for specific cases. (.NET Foundation, n.d.) Theories can have
parameters, that are specified using the InlineData attribute. (Lock, 2017) We will see
an example of that in the next subsection.

With xUnit there is no need for an attribute on the test class, only on the test methods.

3.3 Using WebApplicationFactory


We mentioned that we need a web host that will host the web app for the duration of the
tests. The class WebApplicationFactory<TEntryPoint> is responsible for creating a
TestServer that will be used during the tests.

3.3.1 Tests with WebApplicationFactory

Update the HomeControllerIntegrationTests class to look like the following. Code


based on (Latham, et al., 2019).

© The Independent Institute of Education (Pty) Ltd 2023 Page 222 of 290
IIE Module Manual APPR6312

public class HomeControllerIntegrationTests


: IClassFixture<WebApplicationFactory<Startup>>
{
private readonly WebApplicationFactory<Startup> _factory;

public HomeControllerIntegrationTests(
WebApplicationFactory<Startup> factory)
{
_factory = factory;
}

[Theory]
[InlineData("/")]
public async Task Get_EndpointsReturnSuccess(string url)
{
// Arrange
var client = _factory.CreateClient();

// Act
var response = await client.GetAsync(url);

// Assert
response.EnsureSuccessStatusCode(); // Status Code 200-299
Assert.Equal("text/html; charset=utf-8",
response.Content.Headers.ContentType.ToString());
}
}

Here we see an example of a theory. The test method has a parameter called URL, and it
will be called multiple times with different values – once for each of the InlineData
attributes.

Figure 248: Theory Test Results

If we look at the test results in the Test Explorer, we see the three runs of the same test
with different parameters.
While we are looking at the results, notice how long these tests take to run: in the order of
one second. That might not sound long, but if you consider that the unit tests we wrote
before look only a couple of milliseconds, then this is indeed much slower. Subsequent
calls to the same page in the same test class will be a bit faster.

© The Independent Institute of Education (Pty) Ltd 2023 Page 223 of 290
IIE Module Manual APPR6312

3.3.2 Customising the WebApplicationFactory

One of the ways to make the integration tests faster is to run against an in-memory
database. Entity framework does provide an in-memory database. By creating a custom
class that extends from WebApplicationFactory, this in-memory database can be
injected instead of the normal one.

Read (Spasojevic, 2019) and (Latham, et al., 2019) for more information on how to do
that.

3.4 Customising the Client


In our test, we created a client using the following code:

var client = _factory.CreateClient();

What if we want to configure the behaviour of the client, for example to log information or
to not handle cookies?

There are four options which can be configured: AllowAutoRedirect, BaseAddress,


HandleCookies and MaxAutomaticRedirections. This can be done by passing an
instance of WebApplicationFactoryClientOptions to the CreateClient method.
(Latham, et al., 2019)

Here is the code to disable handling of cookies:

var clientOptions = new WebApplicationFactoryClientOptions();


clientOptions.HandleCookies = false;
var client = _factory.CreateClient(clientOptions);

But what if you want to do something more complex like logging, or reinitialising an in-
memory database for a specific test? Then we can use _factory.WithWebHostBuilder.

Add the following using statement (necessary for BuildServiceProvider in the code to
follow):

using Microsoft.Extensions.DependencyInjection;

© The Independent Institute of Education (Pty) Ltd 2023 Page 224 of 290
IIE Module Manual APPR6312

Then change the client creation as follows (code from (Latham, et al., 2019) with
modifications):

var client = _factory.WithWebHostBuilder(builder =>


{
builder.ConfigureServices(services =>
{
var serviceProvider = services.BuildServiceProvider();

using (var scope = serviceProvider.CreateScope())


{
var scopedServices = scope.ServiceProvider;
var logger = scopedServices
.GetRequiredService<ILogger
<HomeControllerIntegrationTests>>();
}
});
})
.CreateClient(new WebApplicationFactoryClientOptions
{
HandleCookies = false
});

This adds logging and switches off the handling of cookies.

3.5 Mock Services


Sometimes it will be useful to call a mock service – a class that mimics the behaviour of a
service without performing the actual code.

To create a mock service (Latham, et al., 2019):

1. Create a service interface and implement it.


2. In Startup.cs of the web app, add a line to add the scoped service.
3. In the test project, create the mock service that also implements the interface.
4. Use factory.WithWebHostBuilder to register the mock service.

Read (Latham, et al., 2019) for detailed instructions.

© The Independent Institute of Education (Pty) Ltd 2023 Page 225 of 290
IIE Module Manual APPR6312

4 Load and Stress Testing


4.1 What is a Load Test?
Enterprise systems often have many users. And being able to handle a certain load may
even be a part of the requirements. But how could you possibly test what the system will
perform like when a thousand people are using it at the same time? By using load tests.

Load tests “[t]est whether the app can handle a specified load of users for a certain
scenario while still satisfying the response goal. The app is run under normal conditions.”
(Anderson, et al., 2019b)

A very closely related concept is a stress test. In stress testing, the load is above the
normal levels, and the purpose of the testing is to see whether the system can recover
from abnormally high loads. (Anderson, et al., 2019b)

Load and stress tests are collectively called performance tests. (Guru99, n.d.)

Load tests can be executed at various levels in the software – on the database, at the
application programming interface (API) level where the services are load tested, or on
the user interface.

To perform load tests, we need a tool that simulates the number of users that we want to
test for. There are many tools that provide this functionality, including Visual Studio. Other
options include Apache JMeter, Locust and Netling. (Anderson, et al., 2019b)

Although Visual Studio 2019 is the last version of Visual Studio to support load tests
(Anderson, et al., 2019b), we will still use it since it illustrates the concepts that can be
applied to other testing tools.

The Visual Studio 2019 load testing tools are only available in the enterprise edition, and
you must install the Web performance and load testing tools component.

4.2 Creating a Load Test

4.2.1 Creating a Basic Test

These instructions are adapted from (Warren, et al., 2018).

To create a basic load test:

1. In the same solution as the DJPromoWebApp, create a new project using the Web
Performance and Load Test Project [Deprecated] template for C#. Name the
project DJPromoWebApp_LoadTests.

© The Independent Institute of Education (Pty) Ltd 2023 Page 226 of 290
IIE Module Manual APPR6312

2. In the Solution Explorer, right-click the load tests project and click Add then New
Item.
3. Under the Test category, choose the Load Test template.
4. Enter the Name HomePageLoadTest.loadtest.
5. Click Add.

Figure 249: New Load Test Wizard

6. The new load test wizard will be displayed. Choose On-premises Load Test for the
type of test and click Next.
7. The next page allows you to configure the run settings (see Figure 250). Change the
Run duration to 1 minute, just to make the test faster to run for our purposes.
8. Enter a Description for the test.
9. Click Next.
10. Enter the name FridayAfternoon for the load test scenario name.

© The Independent Institute of Education (Pty) Ltd 2023 Page 227 of 290
IIE Module Manual APPR6312

Figure 250: New Load Test Wizard – Run Settings

11. Click Finish. This will leave the rest of the settings on defaults.

4.2.2 Editing Test Settings

The load test has now been created, but it doesn’t do anything yet. First, we need to
create a web test, and then specify that the load test should run the web test.

To create a web test:

1. Create another new item in the load test project, this time using the Web
Performance Test template. Name the item LoadHomePage.webtest.
2. An Internet Explorer window will be opened where you can record the actions you
want to take for the test. On the first record, you need to enable the plugin that does
the recording. Click the Settings button (with the icon ) and choose Manage Add-
ons.
3. Enable the Web Test Recorder 15.0 add-on then close the dialog.

Figure 251: Recording a Web Test – Disabled

4. If the controls of the web test recorder are disabled on the first run as shown in
Figure 251:
a. Close the Internet Explorer window.
b. In Visual Studio, on the LoadHomePage.webtest tab, click Stop Recording.

© The Independent Institute of Education (Pty) Ltd 2023 Page 228 of 290
IIE Module Manual APPR6312

c. Right-click the LoadHomePage node and click Add Recording. Internet


Explorer will open again, and this time the controls should be enabled.
5. Run the web app from Visual Studio and copy the URL from the browser window
that opens.
6. Return to the Internet Explorer window and browse to the copied URL.

Figure 252: Recording in Internet Explorer

7. Once the page has loaded, click Stop on the Web Test Recorder.

Figure 253: Recorded Test

Now we can see all the actions that we recorded in Visual Studio. There are some bing
requests that happened during the recording, that we don’t want as part of our load test.
The good news is that you can edit the web test now that it has been recorded. Right-click
on each of the bing requests and click Delete. Remember to save the web test after
editing it.

© The Independent Institute of Education (Pty) Ltd 2023 Page 229 of 290
IIE Module Manual APPR6312

To add the web test to the test mix for the load test:

1. Open the load test in Visual Studio.

Figure 254: Edit Test Mix

2. Right-click the FridayAfternoon scenario and click Edit Test Mix.


3. Click Add.
4. The Add Tests dialog will be displayed (see Figure 255). Select the
LoadHomePage test under Available tests and click the assign button (with the
icon ).
5. Click OK.
6. You will see the Edit Text Mix dialog as shown in Figure 256. Click OK.

© The Independent Institute of Education (Pty) Ltd 2023 Page 230 of 290
IIE Module Manual APPR6312

Figure 255: Adding Tests

Figure 256: Test Mix

We only have the one web test right now, so it makes up 100% of our load test. But if you
have a website that has a lot of pages that users interact with, it would be useful to specify
multiple tests making up different percentages of the load test.

You can also choose which browsers to use in the mix.

For more information about creating different test scenarios, read (Warren, et al., 2016c).

© The Independent Institute of Education (Pty) Ltd 2023 Page 231 of 290
IIE Module Manual APPR6312

4.3 Running a Load Test


To run a load test:

1. Open the load test in Visual Studio.

2. At the top of the window, click Run Load Test.

While the test is running, you will see the test status in the Test Results window. And
when completed, you will see the results.

Figure 257: Load Test Results

© The Independent Institute of Education (Pty) Ltd 2023 Page 232 of 290
IIE Module Manual APPR6312

5 User Interface Testing


5.1 What is User Interface Testing?

“User interface (UI) testing is a process used to test if the application is functioning
correctly. UI testing can be performed manually by a human tester, or it can be performed
automatically with the use of a software program.” (Urbonas, 2013)

When we think of software testing, UI testing might be the first thing that comes to mind.
Manual testers often perform tasks that users would do to test that the system works end
to end. And that is useful. But since these testing tasks are performed by humans, there is
only so much time available to do testing. In a large system, it is just not possible to test
every aspect manually for every build of software.

This is where automated UI testing comes in. Using some tool, the UI is automatically
exercised according to instructions that are usually created by automation testers. Large
numbers of tests can be executed frequently, even on multiple platforms, often since it
doesn’t involve any human effort.

5.1.1 Selenium

There are lots of tools (open source and commercial) for user interface testing, many of
which are quite specific to the types of applications that they are designed to test.
Desktop, mobile and web UI testing tools typically work in quite different ways, but it can
even come down to which programming language the application was developed in on the
desktop.

We will be using Selenium in this module. Selenium is a very popular open-source web
testing tool that forms the basis of several other testing tools that have been developed
over the years. (ATC Team, 2019)

There are several tools that are included in the Selenium suite (Software Freedom
Conservancy, n.d.):

• Selenium WebDriver (preferred) – tests are written using language specific binds.
• Selenium IDE – an integrated development environment that makes it easy to create
scripts and allows for recording of interactions in Chrome and Firefox.
• Selenium Grid – used to scale testing by distributing the tests across multiple
computers.

We will specifically be using Selenium WebDriver since that can be integrated quite easily
into Visual Studio.

For information about other tools, read (ATC Team, 2019).

© The Independent Institute of Education (Pty) Ltd 2023 Page 233 of 290
IIE Module Manual APPR6312

5.1.2 Best Practices

Best practices for UI automation testing include:

• Choose descriptive names for tests. (Bushnev, 2019) Just like with unit tests, the
names of the UI tests should be descriptive so that you can easily identify where a
problem is just by looking at the name of a test.
• Keep tests simple. If the tests are getting so complicated that you must add
comments to explain what is going on, consider simplifying the test instead.
(Bushnev, 2019)

• Make sure all tests should be able to pass. Don’t leave tests for features that were
never implemented or will never be able to pass for some reason in the build. If a
test fails, it must mean that something is wrong that needs to be addressed.
(Bushnev, 2019)
• Keep all tests independent of one another. If the testing process is ever run in
parallel, dependencies will cause issues. (Bushnev, 2019)
• Create detailed reports. When choosing a tool, have a look at the reports generated
– choose one that will give a lot of detail in the reports. (Felder, 2019)

5.2 Creating a Test Project


The instructions below are adapted from (Homer, et al., 2019).

To create a test project in Visual Studio:

1. In the same solution as the DJPromoWebApp, create a new project using the
template MSTest Test Project (.NET Core) for C#. Call the project
DJPromoWebApp_UITests.
2. In project properties, change the project's Target framework to be .NET Core 2.1.
3. Add the following NuGet packages to the project:
Selenium.WebDriver
Selenium.WebDriver.ChromeDriver
4. Rename UnitTest1 to HomePageTest.
5. Copy the code on the next page into HomePageTest. (Code adapted from (Homer,
et al., 2019) and (Davood, 2018)).

© The Independent Institute of Education (Pty) Ltd 2023 Page 234 of 290
IIE Module Manual APPR6312

using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.IO;
using System.Reflection;

namespace DJPromoWebApp_UITests
{
[TestClass]
public class HomePageTest
{
private IWebDriver driver;
private string appURL;

public HomePageTest()
{
}

[TestMethod]
[TestCategory("Chrome")]
public void CheckHomePageTitleTest()
{
driver.Navigate().GoToUrl(appURL + "/");
Assert.IsTrue(driver.Title.Contains("Gig List"),
"Verified title of the page");
}

[TestInitialize()]
public void SetupTest()
{
appURL = "http://localhost:60257";

driver = new ChromeDriver(Path.GetDirectoryName(


Assembly.GetExecutingAssembly().Location));
}

[TestCleanup()]
public void MyTestCleanup()
{
driver.Quit();
}
}
}

6. Run the tests just like you would for unit tests. You should see one test passing.

5.3 Creating Selenium Tests


From the above simple test example, we have already learned a few things. Firstly, the
tests can be writing in C# which means that there is not much of a learning curve to get
started. Secondly, the unit test infrastructure that we are already used to is able to cope
with the UI tests now that we have included the necessary NuGet packages.

The example loads a page and just checks the page title. This can be useful, but
obviously we want to do much more.

© The Independent Institute of Education (Pty) Ltd 2023 Page 235 of 290
IIE Module Manual APPR6312

There are two types of things that you can do using Selenium: find an element on the
page and perform an action on the element that you have found.

5.3.1 Finding Elements

To find an element, call the WebDriver.FindElement method. There are multiple things
that you can find an element by (Selenium.dev, 2020):

• Class name;
• Class selector;
• Id;
• Name;
• Link text;
• Partial link text;
• Tag name; and
• XPath expression.

Add a new link with the text About Us to the home page. To find that link, we could do the
following:

IWebElement aboutLink = driver.FindElement(By.LinkText("About Us"));

5.3.2 Performing Actions

Once you have an element, you can do actions like:

• SendKeys(“keys to type”)
• Click()

If we wanted to click on the About Us link, and then check that it went to the right page,
we can do this:

[TestMethod]
[TestCategory("Chrome")]
public void NavigateFromHomeToAbout()
{
driver.Navigate().GoToUrl(appURL + "/");
IWebElement aboutLink = driver.FindElement(By.LinkText("About Us"));
aboutLink.Click();
Assert.IsTrue(driver.Title.Contains("About"),
"Verified title of the page");
}

Have a look at (AutomateThePlanet.com, 2018) for a very useful list of Selenium


WebDriver commands.

Read (Spasojevic, 2019) for more test examples.

© The Independent Institute of Education (Pty) Ltd 2023 Page 236 of 290
IIE Module Manual APPR6312

6 Integrating Tests into Azure Pipelines


We are going to be running the tests that we have created for the DJPromoWeb app in a
pipeline on Azure DevOps. Before continuing, do the following steps:

• Remove the load tests project from the solution. You don’t need to delete the
files, just remove it from the solution. It is a .NET Framework project, which will add
unnecessary complications to the pipeline.
• Make sure that all the projects target .NET Core 5.0.
• Commit and push all the changes.

6.1 Running Tests in a Pipeline

6.1.1 Running Integration Tests

Start by creating a new pipeline for the DJPromoWebApp:

1. In Azure DevOps Pipelines, create a new pipeline using the ASP.NET Core
template.
2. Choose the repository for the DJPromoWebApp.

To run the integration tests, add the following task to the end of the configuration (from
(thomps23, et al., 2019)):

- task: DotNetCoreCLI@2
inputs:
command: test
projects: '**/*IntegrationTests/*.csproj'
arguments: '--configuration $(buildConfiguration)'

If you look at the results of the build job, you will see that there is now also a link to the
test results.

We currently have four tests, all of which passed. The tests took almost 12 seconds to
execute.

Figure 258: Test Results

© The Independent Institute of Education (Pty) Ltd 2023 Page 237 of 290
IIE Module Manual APPR6312

6.1.2 Running UI Tests

Running UI tests in Azure DevOps Pipelines is possible, but it requires a different type of
configuration since it requires browsers and user interfaces.

To do this, you need to publish artifacts and set up a release pipeline that releases to a
test environment. Read (Homer, et al., 2019b) for more information.

6.2 Collecting Code Coverage

“Code coverage is the percentage of code which is covered by automated tests. Code
coverage measurement simply determines which statements in a body of code have been
executed through a test run, and which statements have not.” (Atlassian, n.d. k)

The percentage of code that should be covered by tests is a decision that is made by
each team. Certain parts of the code may be critical and will require 100% code coverage,
while other parts may not.

To collect the coverage results for our Linux-based build, replace the test task with the
following (from (thomps23, et al., 2019) and (issacnitin, 2019)):

- task: DotNetCoreCLI@2
inputs:
command: test
projects: '**/*IntegrationTests/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect:"XPlat Code Coverage"'
displayName: Run Tests

- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . dotnet-reportgenerator-globaltool
displayName: Install ReportGenerator tool

- script: ./reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -


targetdir:$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"Cobertura"
displayName: Create reports

- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml

Note that the arguments and script elements should all be on one line as shown in Figure
259.

© The Independent Institute of Education (Pty) Ltd 2023 Page 238 of 290
IIE Module Manual APPR6312

Figure 259: Pipeline Configuration

If you look at the artifacts for the build, you will notice that there is now a coverage report
too. It is made up of several files, but you can download the whole thing by clicking the
download button next to the artifact name.

Figure 260: Download Zipped Report

Extract the .zip file and open index.html in your browser to view the report. An example is
shown in Figure 261.

Figure 261: Coverage Report

© The Independent Institute of Education (Pty) Ltd 2023 Page 239 of 290
IIE Module Manual APPR6312

The same report can also be seen on the build results page.

Figure 262: Build Results with Coverage Report

© The Independent Institute of Education (Pty) Ltd 2023 Page 240 of 290
IIE Module Manual APPR6312

7 Recommended Additional Reading


Free registration is required for the following e-book:

TestCraft, n.d. Selenium Testing. [ebook] Available at:


E-book
https://www.testcraft.io/selenium-testing-ebook/
[Accessed 14 July 2021].

AutomateThePlanet.com, 2018. Most Complete Selenium WebDriver C# Cheat Sheet.


[Online]. Available at: https://www.automatetheplanet.com/selenium-webdriver-csharp-
cheat-sheet/ [Accessed 14 July 2021].

Kolodiy, S., n.d.. Unit Tests, How to Write Testable Code and Why it Matters. [Online].
Available at: https://www.toptal.com/qa/how-to-write-testable-code-and-why-it-matters
[Accessed 14 July 2021].

Latham, L., Nelson, J. C., Smith, S. & van der Til, J., 2019. Integration tests in ASP.NET
Core. [Online]. Available at: https://docs.microsoft.com/en-us/aspnet/core/test/integration-
tests?view=aspnetcore-2.1 [Accessed 14 July 2021].

Mathurin, C., 2018. NET Core 2: Why xUnit and not NUnit or MSTest. [Online]. Available
at: https://dev.to/hatsrumandcode/net-core-2-why-xunit-and-not-nunit-or-mstest--aei
[Accessed 14 July 2021].

Prescott, A., 2012. A "Shim-ple" Tutorial with Microsoft Fakes. [Online]. Available at:
https://adamprescott.net/2012/08/21/a-shim-ple-tutorial-with-microsoft-fakes/ [Accessed
14 July 2021].

Ranorex, n.d. GUI Testing. [Online]. Available at:


https://www.ranorex.com/resources/testing-wiki/gui-testing/ [Accessed 14 July 2021].

Reese, J. et al., 2018. Unit testing best practices with .NET Core and .NET Standard.
[Online]. Available at: https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-
best-practices [Accessed 14 July 2021].

Spasojevic, M., 2019. Automated UI tests with Selenium and ASP.NET Core MVC.
[Online]. Available at: https://code-maze.com/automatic-ui-testing-selenium-asp-net-core-
mvc/ [Accessed 14 July 2021].

Warren, G. et al., 2016. Use shims to isolate your app for unit testing. [Online]. Available
at: https://docs.microsoft.com/en-us/visualstudio/test/using-shims-to-isolate-your-
application-from-other-assemblies-for-unit-testing?view=vs-2019 [Accessed 14 July 2021].

Warren, G. et al., 2016b. Isolate code under test with Microsoft Fakes. [Online]. Available
at: https://docs.microsoft.com/en-us/visualstudio/test/isolating-code-under-test-with-
microsoft-fakes?view=vs-2019 [Accessed 14 July 2021].

© The Independent Institute of Education (Pty) Ltd 2023 Page 241 of 290
IIE Module Manual APPR6312

Warren, G., Casey, C., Hogenson, G. & Jacobs, M., 2016c. Edit load test scenarios.
[Online]. Available at: https://docs.microsoft.com/en-us/visualstudio/test/edit-load-test-
scenarios?view=vs-2019 [Accessed 14 July 2021].

8 Recommended Digital Engagement and Activities


It is recommended that you complete the Run quality tests in your build pipeline by using
Azure Pipelines module on Microsoft Learn, available at https://docs.microsoft.com/en-
gb/learn/modules/run-quality-tests-build-pipeline/

If you want to learn more about Selenium, work through the Selenium C# tutorials at
https://www.toolsqa.com/selenium-c-sharp/

© The Independent Institute of Education (Pty) Ltd 2023 Page 242 of 290
IIE Module Manual APPR6312

Learning Unit 5: Continuous Deployment


Learning Objectives: My notes
• Differentiate between continuous delivery and
continuous deployment.
• Identify the benefits of continuous deployment.
• Configure continuous deployment of Azure App
Services.
• Configure continuous deployment of Azure Functions.
• Configure continuous deployment of Azure SQL
Database.
Material used for this learning unit:
• This module manual.
• Microsoft Azure Cloud.
• Microsoft Azure DevOps.
How to prepare for this learning unit:
• Read through the content of this learning unit.
• Work through the activities on Learn.

1 Introduction
So far in this module, we have seen how to do continuous integration and automated
testing. But in DevOps, the aim is to automate everything all the way to deployment. The
tools that make continuous deployment possible are the topic of this learning unit.

2 Continuous Deployment
2.1 What is Continuous Deployment?

“Continuous Deployment (CD) is a software release process that uses automated


testing to validate if changes to a codebase are correct and stable for immediate
autonomous deployment to a production environment.” (Pittet, n.d.)

This concise definition captures the essence of continuous deployment very well. The first
thing to note is that everything is automated. Once changes have been pushed by the
developers, no more manual steps are necessary to get the changes into production.

If you haven’t worked in a company on a large software project yet, this may sound
obvious. But often implementing continuous deployment means a big change in culture
for a company. Traditionally, software releases were tightly controlled through manual
approval processes.
That made perfect sense when the tools for continuous deployment were not yet
available. And there is still a case to be made for manual approvals in safety critical
systems. However, for most business systems the tools that are available are perfectly
suited for automating everything.

© The Independent Institute of Education (Pty) Ltd 2023 Page 243 of 290
IIE Module Manual APPR6312

Culture is just as important as the tools used for continuous delivery. (CA Southern Africa,
2014)

The second point to note is that automated testing is very important for continuous
deployment to work well. There is no sign-off by manual testers before the software is
deployed to production, but that does not mean that the software is untested. Automated
tests are used to make sure that the changes that were made are correct and that there
are no regressions.

Another way to ensure that there are no issues in production, is to roll out changes only
to a small group of customers first. That is then automatically monitored for a period
before it is deployed to the full user base. (CollabNet VersionOne, 2019b) If you use
Gmail or Outlook.com email, you might have seen preview versions of features that you
can try out early. This doesn’t mean that the changes were automatically deployed, but it
is a similar concept in terms of partial deployment.

Are there any companies that do fully automated deployments? Yes, although it is still
rare, there are some big companies that do this successfully. Companies that do
continuous deployments include Netflix, Amazon, Pinterest, Flickr and Google. (CollabNet
VersionOne, 2019b)

2.2 Continuous Delivery vs Continuous Deployment


We have mentioned in Learning Unit 3 that DevOps is along a continuum, from
continuous integration to continuous delivery to continuous deployment. The question
remains, then – what is continuous delivery?

Continuous delivery is the process of getting the software ready to deploy in an automated
way. (CollabNet VersionOne, 2019b) The code is built and automatically tested and is
ready to be deployed at any moment. But the deployment needs to be automated.

Continuous delivery is an intermediate step. When a company decides to implement


DevOps, it is unlikely that completely automated deployments will happen right away. But
continuous delivery with manual sign-off before deployment is a good steppingstone along
the way.

Another interesting perspective on the DevOps continuum is that the different stages
benefit different stakeholders. Continuous integration benefits the developers of the
software most since it improves feedback and productivity. Continuous delivery benefits
the business users since it helps to get features to them quicker. Continuous deployment
benefits all the stakeholders since features become immediately available. (Snodgrass,
2017)

© The Independent Institute of Education (Pty) Ltd 2023 Page 244 of 290
IIE Module Manual APPR6312

2.3 Benefits of Continuous Deployment


The benefits of continuous deployment include:

• The company can respond very fast to market changes since new features can be
deployed rapidly. (Pittet, n.d.)
• When a customer provides feedback, the company can react very quickly. (Pittet,
n.d.)
• New features become available as soon as they are developed. (Pittet, n.d.)
• Repetitive tasks are automated, allowing everybody, including testers, to focus on
more interesting work. (Belagatti, 2016)
• Automating a large part of the process means that the company can scale their
development efforts to multiple projects without adding much overhead. (Belagatti,
2016)
• Smaller releases that have fewer changes also have lower associated risks when
they are deployed. (Lucidchart Content Team, 2018)
• Deployment issues due to human error can be eliminated by automating the
process. (Shash, 2019)

2.4 Best Practices


There is much to be said about best practices when it comes to continuous deployment,
since you must have continuous integration and continuous delivery in place before you
even get to continuous deployment.

• Keep source code in a central repository, to make sure that the code is clean and
available when needed to create a build. (Lucidchart Content Team, 2018)
• Changes need to be pushed regularly to avoid as many conflicts as possible.
(Lucidchart Content Team, 2018)
• Automate the process of building the code, executing tests, and deploying to a
production environment. (Lucidchart Content Team, 2018)
• Choose which tests to run for which builds. Tests are essential, but there are some
automated tests (for example integration tests) that take a long time to run.
(Mekhanikov, 2018) So, for example, a possible compromise would be to run unit
tests for every push, and integration tests during a nightly build.
• Shorten the build time as much as possible. If you make a small change, you don’t
want to wait an hour for the build to complete. Build times can be improved by
running parts of a build in parallel or even by installing faster hard drives in the build
server. (Mekhanikov, 2018)
• Automate the installation of software as much as possible. If you need to set up
virtual machines and install and configure software on them before you can make a
build, that takes too much time. Automate this process as much as possible.
(Mekhanikov, 2018)
• Always have a backup plan if things do go wrong during a deployment. (Gordon,
n.d.)

© The Independent Institute of Education (Pty) Ltd 2023 Page 245 of 290
IIE Module Manual APPR6312

3 Deploying to Azure App Services


3.1 Two Options
There are two ways to automate deploying of our web app to Azure App Services: using
the Kudu App Service build server that is part of App Services or using Azure Pipelines.

If you have a very straightforward deployment, just deploying code straight to production
without anything else happening, you can use Kudu. It is simple and quick to configure. If
you want to run tests, build Docker images and other more advanced features, you need
the power of Azure Pipelines (Brown & Tardif, n.d.)

Both the build providers allow for source code to be pulled from Azure Repos, GitHub,
Bitbucket or a local Git repo. We will use an Azure Repos Git repository. There are also
manual push/sync options that could be useful for non-technical users. These include
OneDrive, Dropbox, a public Git or Mercurial repo or an FTP site. We won’t be going into
the details for any of those options.

It is recommended that you continue using the repository and build from Learning Unit 4 to
following along with the steps below.

3.2 Using Kudu App Service


Kudu is the name of the open-source engine that is used to deploy websites to Azure App
Services using Git. It was originally developed as a standalone product, and it can still be
used standalone to deploy websites to Internet Information Services (IIS) servers. Kudu
has been in use in Azure for a long time – since 2012. (Ebbo, 2012)

For each Azure App Service, there is a Kudu dashboard that you can access that provides
a lot of interesting information.

To access the Kudu dashboard:

1. Browse to the Azure Portal at https://portal.azure.com/.


2. Browse to your app service.

Figure 263: Accessing the Kudu Dashboard

© The Independent Institute of Education (Pty) Ltd 2023 Page 246 of 290
IIE Module Manual APPR6312

3. Scroll down on the list of options on the left until you get to the Development Tools
category.
4. Click Advanced Tools.
5. Click Go.

Figure 264: Kudu Dashboard


For more information about the dashboard, read (Joshi, 2018).
In the Azure App Service context, Kudu can be used to set up continuous deployments.
Remember, this is only for very simple deployments where there are no automated tests
or anything special that needs to be done during the build.

To set up continuous deployment using Kudu (based on instructions from (Petersen, et


al., 2019)):

1. Browse to the Azure App Service that you want to deploy to in the Azure Portal.
2. Under the Deployment category, click Deployment Centre.

© The Independent Institute of Education (Pty) Ltd 2023 Page 247 of 290
IIE Module Manual APPR6312

Figure 265: Select Source Control

3. The first step is to select the source control to use. Under the Continuous
Deployment (CI/CD) category, click Azure Repos and then click Continue.
4. The second step is to select the build provider. Choose App Service build service
and click Continue.
5. The third step is to configure the source control details, as shown in Figure 266. Pick
the Azure DevOps Organisation that you created, followed by the Project,
Repository and Branch.
6. Click Continue.
7. A summary page will be displayed. Click Finish.

Figure 266: Source Control Details

© The Independent Institute of Education (Pty) Ltd 2023 Page 248 of 290
IIE Module Manual APPR6312

8. Wait for the process to complete. You will see a page showing the status of the
deployment as successful.

Figure 267: Deployment Status – Success

To see the continuous deployment of the site in action, make a change to the website.
Commit and push the change, and then return to the deployment centre. You will see a
second deployment. (You may have to click Refresh to see this result.)

Figure 268: Deployment Status – A Second Deployment

If you browse to the site now, you will see that the change has been made to the live
website.

© The Independent Institute of Education (Pty) Ltd 2023 Page 249 of 290
IIE Module Manual APPR6312

To revert to an earlier deployed version of the site:

1. Click the Logs icon ( ) next to the deployment.


2. A window that displays the logs will appear. Click Redeploy.

If you look at the website now, you will see that it has reverted to the previous version.

Only one continuous deployment can be set up per app service, but multiple app
services can use the same repo. This is useful if you have, for example, a development
branch that you want to deploy to a test environment, in the same repository as a master
branch that is the one deployed to production. (Brown & Tardif, n.d.)

To stop continuously deploying using Kudu, click the Disconnect button on this page.
You will be prompted whether you really want to do that – click OK.

Disconnect the Kudu deployment now, so that we can use the same app service in the
next section.

3.3 Using Azure Pipelines


As mentioned, the Kudu deployment process only works if you don’t need to do anything
except just build and deploy. The moment you have tests or anything else, Azure
Pipelines are the way to go.

The Deployment Centre does have an option to set up an Azure Pipelines build. However,
since we haven’t connected the DevOps organisation to the App Service yet, that process
won’t work.

It is best practice to split the build and release processes into two separate pipelines.
This provides flexibility in choosing when to deploy. For example, only once a build
succeeds can it be used to deploy. And if a manual approval step is required before
deployment to production, the split is essential to make it possible to manually trigger the
automated deployment.

When looking at Azure Pipelines, we also see that there are two different categories – one
for Pipelines and another for releases.

© The Independent Institute of Education (Pty) Ltd 2023 Page 250 of 290
IIE Module Manual APPR6312

In the build pipeline, we will do everything to the point where we create the deployable
artifacts. And in the release pipeline, we deploy those artefacts. Have a look again at
Figure 221 on p.189 to see the whole process.

We already have a pipeline for the DJPromoWebApp, that we created in Learning Unit 4.
You will recall that it includes the tasks for performing automated tests.

3.3.1 Publishing Artifacts in the Build Pipeline

To publish the artifacts that we need to deploy the web app:

1. Edit the build settings of the DJPromoWebApp.


2. Add the following tasks at the end of the file. Based on code from (thomps23, et al.,
2019).

# this code publishes the zipped artifacts to $(Build.ArtifactStagingDirectory)


- task: DotNetCoreCLI@2
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --output
$(Build.ArtifactStagingDirectory)'
zipAfterPublish: True

# this code takes all the files in $(Build.ArtifactStagingDirectory) and uploads


# them as an artifact of your build.
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'djPromoWebApp'

Note that the arguments in the publish task should all be on one line after you copy the
code, as shown in Figure 269.

Figure 269: Publish Task

If you look at the results of the build job, you will see that there is one artifact called
DJPromoWebApp.zip.

3.3.2 Deploying Artifacts in the Release Pipeline

Before continuing, make a change to the website and push it, so that we can check that
the process works.

© The Independent Institute of Education (Pty) Ltd 2023 Page 251 of 290
IIE Module Manual APPR6312

The below instructions for setting up release pipelines and creating releases were
adapted from (Homer, et al., 2018).
To set up a release pipeline:

1. In Azure DevOps, browse to the project and click Pipelines.


2. Click Releases.
3. If you have no pipelines yet, click the New Pipeline button.

Figure 270: Select a Template

4. You will be prompted to select a template. This is the easiest way to get started with
releases. Select the Azure App Service deployment template and click Apply.
5. For stage 1, you can specify a Stage name and Stage owner. The defaults will be
good enough for this case. Click the cross in the top-right corner to close the
properties.

Figure 271: New Pipeline

6. Under Artifacts, click Add an artifact.

© The Independent Institute of Education (Pty) Ltd 2023 Page 252 of 290
IIE Module Manual APPR6312

Figure 272: Add an Artifact

7. Set the Source type to Build.


8. Choose your Project and Source (build pipeline).
9. Click Add.

Figure 273: Setting Up the Task

10. On Stage 1, click the 1 job, 1 task link.

© The Independent Institute of Education (Pty) Ltd 2023 Page 253 of 290
IIE Module Manual APPR6312

Figure 274: Choose Azure Subscription

11. Under Azure subscription, choose your subscription.

If you want to double check that it is the right subscription, you can see your subscriptions
on the Azure Portal, under Subscriptions.

12. Click Authorize.


13. You will be prompted to log into your Azure account, even if you are already logged
in. Follow the prompts to do so.

Figure 275: App Service Settings

14. Choose the Web App on Windows App Type.


15. Enter the App service name of your App Service.
16. Click Run on agent (left) and then back to Deploy Azure App Service.
17. Click Save (all the way at the top).
18. Enter a comment and click OK.

© The Independent Institute of Education (Pty) Ltd 2023 Page 254 of 290
IIE Module Manual APPR6312

Now we have set up the release, but the release doesn’t get triggered automatically. We
need to instruct pipelines to do the release now.

To create a release to deploy the web app:

1. In DevOps, under pipelines, click Releases.


2. Select the release pipeline that we just created and click Create a release.
3. (Optional) Choose an artifact Version if you don’t want to deploy the latest.
4. Enter a Release description.
5. Click Create.
6. Wait for the release to complete. You can click on the release in the list to see more
details as the release progresses.

Figure 276: Release Details

Browse to your website to see the change that was deployed!

This is a very simple release. The website is deployed to the App Service, and that is the
end of it.
But releases can be much more complex than this. You can have multiple artifacts. You
can have
multiple stages with different tasks. And you can set up scheduled releases.

If you now have a look at the Deployment Centre for the App Service, you will see that the
Azure
Pipelines deployment is now linked up. And because the deployment is linked to a build
pipeline, you
can also access the build job’s status right from the Deployment Centre.

© The Independent Institute of Education (Pty) Ltd 2023 Page 255 of 290
IIE Module Manual APPR6312

Figure 277: Deployment Center with Azure Pipelines Deployment

3.4 Deployment Slots

The free Azure plan does not have access to this feature, so we won’t go into too much
detail. If you want to try it out, have a look at the Microsoft Learn module Stage a web app
deployment for testing and rollback by using App Service deployment slots listed in
Section 8.

There is a very useful feature in Azure App Services that allows you to have multiple
deployment slots (only in standard, premium or isolated app service plans). A
deployment slot is a way for you to deploy your changes to a live environment without
affecting the current production software. (Freeberg, et al., 2019)

It is a running app with its own URL that you can use to deploy and test your changes.
And when you are ready, you can swap the app in the deployment slot into production.
The benefit of this is that there is no downtime. And rolling back a swap is as easy as just
swapping back the slots again. (Freeberg, et al., 2019)

When deploying actual enterprise-grade applications, it is highly recommended to use


deployment slots when deploying to production environments. There is no additional cost
to use a deployment slot if your app service tier supports them. (Freeberg, et al., 2019)

4 Deploying to Azure Functions


4.1 Setting Up Continuous Deployment

Before continuing, create a new Azure Repos Git repository and push the Azure Functions
project that we created in Learning Unit 2.

If you created Azure Functions in the Azure Portal, you can download the source code so
that you can commit it to a repository. To do so, go to the Overview of the Functions App,
and click Download app content. (Gailey, et al., 2019e)

© The Independent Institute of Education (Pty) Ltd 2023 Page 256 of 290
IIE Module Manual APPR6312

The structure that is required for continuous deployment of Azure Functions is quite
specific. (Gailey, et al., 2019e) Luckily, the Visual Studio project takes care of that during
the build. (Dykstra, et al., 2018)

Just as with Azure App Services, there are two possibilities for setting up continuous
deployments for Azure Functions – the App Service build service (Kudu) and Azure
Pipelines.

To set up continuous deployment using App Service build service (adapted from (Gailey,
et al., 2019e)):

1. Browse to the Functions app in the Azure Portal.

Figure 278: Platform Features

2. Click the Platform features tab.


3. Under the Code Deployment category, click Container settings.
4. The Deployment Centre will be opened as a new tab. Select Azure Repos as the
source control.
5. Click Continue.
6. Select App Service build service as the build provider.
7. Click Continue.
8. Select the Azure DevOps Organisation, Project and Repository where the
functions code is stored.
9. Select the master branch.
10. Click Continue.
11. On the summary page, click Finish.

© The Independent Institute of Education (Pty) Ltd 2023 Page 257 of 290
IIE Module Manual APPR6312

Figure 279: Successful Deployment

When the deployment is complete, you will see that the Deployment Centre now shows
the full history for the deployments, including the push deployment that we did from Visual
Studio in Learning Unit 2.

Just like with App Services, you can redeploy any version by clicking on the Logs button
next to the deployment, and then clicking Redeploy.

To disconnect the continuous deployment, click Disconnect and click OK when


prompted. Do so now before continuing to the next subsection where we will set up a
deployment with Azure Pipelines.

4.2 Deploy Using Azure Pipelines


To set up a build and deploy pipeline for Azure Functions:

1. Using Azure DevOps Pipelines, create a New Pipeline.


2. Choose the Repository to use.
3. Choose the .NET Core Function App to Windows on Azure template.
4. Select the Azure subscription that you are using and click Continue.
5. Log into your Azure account when you are prompted to do so.
6. Select the Function App name of the functions app that we created in Learning
Unit 2.
7. Click Validate and Configure.
8. Review the generated configuration and click Save and run.
9. Enter a commit message and click Save and run.

© The Independent Institute of Education (Pty) Ltd 2023 Page 258 of 290
IIE Module Manual APPR6312

Figure 280: Build in Progress

If you looked carefully at the generated configuration (or at the build progress as shown in
Figure 280), you would have noticed that these builds and deploys the functions app. You
could split the two parts by deleting the deployment parts of the pipeline, and then setting
up a release just like we did for the App Services.

If you look at the Deployment Centre now, you will see the first successful Azure
Pipelines deployment.

© The Independent Institute of Education (Pty) Ltd 2023 Page 259 of 290
IIE Module Manual APPR6312

5 Deploying to Azure SQL Database


5.1 Data-tier Applications
To manage schema changes (or even initial creation of a database) to a SQL Server or
Azure SQL database, you can either write SQL scripts yourself or use a data-tier
application.

“A data-tier application (DAC) is a logical database management entity that defines all of
the SQL Server objects – like tables, views, and instance objects, including logins –
associated with a user's database.” (Guyer, et al., 2016)

DAC was first introduced in SQL Server 2008 R2. (Ozar, 2009)

In a DAC, all the changes required to a database can easily be described, and a target
database selected. Out of that is created an artifact called a DAC package (DACPAC)
which can then be used to deploy changes to a database. (Guyer, et al., 2016) The terms
data-tier application and DACPAC can be used interchangeably.

A DAC can be used by developers to specify the required changes, and by database
administrators (DBAs) to deploy changes. (Guyer, et al., 2016) And the same DAC can
also be used for automated deployment.

It is also possible to extract a DACPAC from an existing database. And a BACPAC (a


DACPAC that also includes data) can be used to migrate a database from one server to
another, for example from a local server to the cloud. (Guyer, et al., 2016) Read
(dbtut.com, 2019) for more information on how to do the export.

A DACPAC can be created using either SQL Server Management Studio (SSMS) or Visual
Studio. We will focus on using Visual Studio. For more information about using SSMS, read
(Nowinski, 2018).

5.2 Creating a DACPAC using Visual Studio


We will make use of a DACPAC to make changes to the DJ promo database that we
worked with in Learning Unit 2. We will add a new lookup table called VenueType, where
we will store entries for Indoor and Outdoor venues. And we will add a relationship with
Venue.

To create a DACPAC project in Visual Studio:

1. Create a new SQL Server Database Project.


2. Specify the Project name DJDatabase.

Copy the CREATE TABLE script on p.91 into a new text file and save it somewhere
accessible. We will use this to import the existing structure.

© The Independent Institute of Education (Pty) Ltd 2023 Page 260 of 290
IIE Module Manual APPR6312

To import the existing table structure:

1. In the Solution Explorer, right-click the project.


2. Click Import and then Script (*.sql).
3. Click Next.
4. Browse to the SQL script that you saved.
5. Click Next.
6. Click Finish.

Figure 281: Imported Database Structure

You will see the structure as shown in Figure 281. This is a good structure to use – a
folder for the schema, then one for the type of objects (Tables in this case) and then the
actual tables.

Open one of the files to see what the design view looks like.

© The Independent Institute of Education (Pty) Ltd 2023 Page 261 of 290
IIE Module Manual APPR6312

Figure 282: DJ Table in the Design View

5.2.1 Adding a Table

To create a new table:

Figure 283: Creating a Table

1. In the Solution Explorer, right-click the Tables folder.


2. Click Add and then Table.
3. Enter the table Name VenueType.
4. Click Add.

© The Independent Institute of Education (Pty) Ltd 2023 Page 262 of 290
IIE Module Manual APPR6312

Use the Design view to specify the columns VenueTypeID and Type as shown in Figure
284. Remember to save.

Figure 284: VenueType Table

5.2.2 Configuring the Publish Settings

At this point, we have a change that we can publish – creating the VenueType table. But
there are still a few things we need to set up before we can publish the change.

A DACPAC is configured to work with a specific SQL database version. If you forget to
specify the correct version, you will get an error message when you try to deploy.

To set the database version:

1. In the Solution Explorer, right-click the project and choose Properties.

Figure 285: Changing the Target Platform

2. Change the Target platform to Microsoft Azure SQL Database.


3. Save the settings and close the project properties window.

© The Independent Institute of Education (Pty) Ltd 2023 Page 263 of 290
IIE Module Manual APPR6312

To configure the database to deploy to:

1. In the Solution Explorer, right-click the project and choose Publish.


2. Click the Edit button next to Target database connection.

Figure 286: Database Settings

3. Click the Browse tab.


4. Expand the Azure node and select the DJPromoDatabase.
5. Enter your Password and choose whether to remember the password.

The password will never get saved in the config file that is created in the project during this
process, regardless of what you choose here.

6. Click Test Connection. If the connection fails, check whether your IP address is
allowed by the firewall.
7. Click OK.

© The Independent Institute of Education (Pty) Ltd 2023 Page 264 of 290
IIE Module Manual APPR6312

Figure 287: Publish Database Settings

8. The Database name will automatically be populated with the name that you
selected.
9. (Optional) Change the Publish script name to reflect the name of the database.
10. Click Save Profile As.
11. Enter the file name DJPromoDatabase.publish.xml.
12. Click Save.
13. Click Generate Script so that we can look at what the changes will do when we
publish them.

Figure 288: Generated SQL Script

If we look at the script, we will see that there are some prints and some logging that is
happening. But the main part of the change is the CREATE TABLE command, just like we
would expect.

The generated script reflects the changes that the DACPAC will make. And in fact, you
could give this generated script to a DBA to run on the database.

5.2.3 Publishing from Visual Studio

Remember we saved the profile before? You will see the file in the root of the project.
Let’s publish the change using the saved settings.

© The Independent Institute of Education (Pty) Ltd 2023 Page 265 of 290
IIE Module Manual APPR6312

To publish a database change directly from Visual Studio:

1. Double-click DJPromoDatabase.publish.xml to open it.


2. The settings will be loaded from the file. Click Publish.

Now if we look at the database in the Azure Portal Query Editor, we will see the new
table in our database.

Figure 289: New Table in the Azure Portal Query Editor

5.2.4 Adding a SQL Script

What if we wanted to do something like create a schema first and then add tables to it?
Well, you can add SQL scripts that will end up being part of the process.

Add a Script to the project, and when you are prompted for which type of item to create,
choose Script (build). If you do that, it will be included as part of what will be executed on
the database if it is required.

5.2.5 Adding Lookup Data

To add a script that maintains the lookup data in our VenueType table:

© The Independent Institute of Education (Pty) Ltd 2023 Page 266 of 290
IIE Module Manual APPR6312

1. Create a new folder under dbo called Lookups.


2. In that folder, create a new Script (Not in build) and call it VenueType.sql. (Do pick
Not in build here – you will see why soon.)
3. Add the following SQL to the script (based on information from (Babu, 2019) and
(Winand, n.d.)):

MERGE VenueType AS TARGET


USING (SELECT *
FROM (VALUES (1, 'Indoor'),
(2, 'Outdoor')
) temp (VenueTypeID, Type)) AS SOURCE
ON TARGET.VenueTypeID = SOURCE.VenueTypeID
WHEN MATCHED THEN
UPDATE SET TARGET.Type = SOURCE.Type
WHEN NOT MATCHED THEN
INSERT (VenueTypeID, Type)
VALUES (SOURCE.VenueTypeID, SOURCE.Type);

4. In the root of the project, add a new Post-Deployment script called


PostDeployment1.sql.
5. Add the following line to the post deployment script, to reference the lookups script
we created earlier:

:r .\dbo\Lookups\VenueType.sql

Generate the script again, and you will see that the MERGE statement will appear at the
end of the script – that is where the post deploy will be.

5.2.6 Configuring the DACPAC Behaviour

There are some things that the DACPAC will do that may be unexpected if you haven’t
encountered these things before. That is why it is always a good idea to have a quick look
at the script to make sure that it won’t do something unexpected.
For example, if the collation of the database is changed, it will by default drop and
recreate the database … which is likely not the desired outcome.

Also, by default when you add a column to a table somewhere in between the existing
columns, it will create a new table with the new field in the exact location that you
specified, insert all the rows from the existing table to the new table, drop the old table and
then rename the new table. While this is a perfectly safe operation that will not lose data,
this can be a very slow process if you have lots of records in that table.

It is possible to configure to very fine detail what the DACPAC will and will not do.

To configure the DACPAC behaviour:

1. Double-click DJPromoDatabase.publish.xml to open it.


2. Click Advanced.

© The Independent Institute of Education (Pty) Ltd 2023 Page 267 of 290
IIE Module Manual APPR6312

Figure 290: Advanced DACPAC Settings

The details of what everything here does is beyond the scope of this module. But be
aware that you can have different configurations for different deployments. For example,
you can have settings that always drops and recreates the database for the test
environment, in parallel with production database settings that are non-destructive.

For more information about these settings, read (Zhou, 2018) and (AppVeyor.com, n.d.).

5.3 Deploy Using Azure Pipelines


Before we continue, create an Azure Repos Git repository, and push the database project.
Note that you could have the database project in the same solution as your functions
project too. But for the purpose of this discussion, we will assume that it is in its own
solution and repository.

Make sure that the file DJPromoDatabase.publish.xml is committed to the repository. It


might be excluded if you created a .gitignore file from Visual Studio. Right-click the file and
choose Add Ignored File to Source Control to override the ignore behaviour if
necessary.

© The Independent Institute of Education (Pty) Ltd 2023 Page 268 of 290
IIE Module Manual APPR6312

To build the DACPAC using Azure Pipelines, create a new Pipeline and choose the .NET
Desktop template. (Danielson, et al., 2017b) You can delete the test task.

To deploy the compiled DACPAC to the database:

1. Edit the pipeline.


2. Position your cursor at the end of the file.
3. From the list of Tasks, select Azure SQL Database deployment.

Figure 291:Select Subscription

4. Select your Azure Subscription and click Authorize.

Figure 292: SQL Database Properties

5. Enter the SQL Database properties, including the password.


6. Specify the following value for the DACPAC file. This assumes that the project
name is DJDatabase. Check the path carefully if your structure differs.

DJDatabase\bin\Release\DJDatabase.dacpac

© The Independent Institute of Education (Pty) Ltd 2023 Page 269 of 290
IIE Module Manual APPR6312

7. Specify the following value for the Publish Profile. Again, check the path carefully.

DJDatabase\DJPromoDatabase.publish.xml

8. Click Add.
9. You will notice that the password is now stored in clear text in the file. Let’s move
that to a variable. Click Variables.
10. Click New Variable.

Figure 293: Creating a Variable

11. Enter the Name database Password.


12. Enter the password into the Value field.
13. Click to select Keep this value secret.
14. Click OK.
15. Click Save.
16. Change the SqlPassword property to be as follows:

SqlPassword: '$(databasePassword)'

17. Click Save.

Figure 294: Resource Authorisation Issue

If you encounter an issue with resource authorisation (see Figure 294), then try to remove
the Free Trial part, build, then add it back in with a space before the opening bracket and

© The Independent Institute of Education (Pty) Ltd 2023 Page 270 of 290
IIE Module Manual APPR6312

build again. At least, that is what worked for me. It might also just take time for the
authorisation to happen.

© The Independent Institute of Education (Pty) Ltd 2023 Page 271 of 290
IIE Module Manual APPR6312

6 Concluding Remarks
We have now looked at deploying the various parts of our application independently. But
depending on project requirements, it might be more sensible to create multiple build pipelines
that all feed into the same deployment pipeline.

7 Recommended Additional Reading


AppVeyor.com, n.d.. Publishing SQL Server databases from SSDT packages. [Online].
Available at: https://www.appveyor.com/docs/deployment/sql-database-ssdt/
[Accessed 14 July 2021].

dbtut.com, 2019. What is Data-Tier Application. [Online]. Available at:


https://dbtut.com/index.php/2019/07/28/what-is-data-tier-application/ [Accessed 14 July
2021].

Nowinski, K., 2018. How to create DACPAC file?. [Online]. Available at:
https://sqlplayer.net/2018/10/how-to-create-dacpac-file/ [Accessed 14 July 2021].

TestingNews, 2019. Continuous Delivery vs. Continuous Deployment: Where to draw the
line? [Online]. Available at: https://dev.to/katalon/continuous-delivery-vs-continuous-
deployment-where-to-draw-the-line-18ld
[Accessed 14 July 2021].

Zhou, N. B., 2018. Using Advanced Publish Settings for Visual Studio Database Project.
[Online]. Available at: https://www.mssqltips.com/sqlservertip/5456/using-advanced-publish-
settings-for-visual-studio-database-project/
[Accessed 14 July 2021].

8 Recommended Digital Engagement and Activities


Watch the video about the Azure App Service Deployment Centre at
https://azure.microsoft.com/en-gb/resources/videos/azure-friday-an-overview-of-azure-app-
service-deployment-center/
It is recommended that you complete the Stage a web app deployment for testing and
rollback by using App Service deployment slots module on Microsoft Learn, available at
https://docs.microsoft.com/en-gb/learn/modules/stage-deploy-app-service-deployment-slots/
It is recommended that you complete the Deploy applications with Azure DevOps learning
path on Microsoft Learn, available at https://docs.microsoft.com/en-gb/learn/paths/deploy-
applications-with-azure-devops/
It is recommended that you complete the Manage database changes in Azure Pipelines
learning path on Microsoft Learn, available at https://docs.microsoft.com/en-
gb/learn/modules/manage-database-changes-in-azure-pipelines/

© The Independent Institute of Education (Pty) Ltd 2023 Page 272 of 290
IIE Module Manual APPR6312

Bibliography
.NET Foundation, n.d.. Getting Started with xUnit.net. [Online] Available at:
https://xunit.net/docs/getting-started/netcore/cmdline [Accessed 11 January 2020].

Agile Alliance, 2018b. Extreme Programming. [Online] Available at:


https://www.agilealliance.org/glossary/xp/ [Accessed 18 October 2018].

Amazon, 2022. Regions and Availability Zones. [Online] Available at:


https://aws.amazon.com/about-aws/global-infrastructure/regions_az/?p=ngi&loc=2
[Accessed 28 April 2022].

Ambler, S. W., 2005. A Manager’s Introduction to The Rational Unified Process


(RUP). [Online] Available at:
http://www.ambysoft.com/downloads/managersIntroToRUP.pdf [Accessed 18
October 2018].

Anderson, R. et al., 2019. Add a model to an ASP.NET Core MVC app. [Online]
Available at: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-
app/adding-model?view=aspnetcore-3.1&tabs=visual-studio [Accessed 18
December 2019].

Anderson, R. et al., 2019b. ASP.NET Core load/stress testing. [Online] Available at:
https://docs.microsoft.com/en-us/aspnet/core/test/load-tests?view=aspnetcore-3.1
[Accessed 11 January 2020].

AppVeyor.com, n.d.. Publishing SQL Server databases from SSDT packages.


[Online] Available at: https://www.appveyor.com/docs/deployment/sql-database-ssdt/
[Accessed 8 January 2020].

Association of Modern Technologies Professionals, 2018. Software Development


Methodologies. [Online] Available at: http://www.itinfo.am/eng/software-
development-methodologies/ [Accessed 10 October 2018].

ATC Team, 2019. 14 of the Best Automation Testing Tools Available Today. [Online]
Available at: https://dzone.com/articles/14-of-the-best-automation-testing-tools-
available [Accessed 13 January 2020].

Atlassian, n.b. d. Forking Workflow. [Online] Available at:


https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow
[Accessed 31 December 2019].

Atlassian, n.d. b. Comparing Workflows. [Online] Available at:


https://www.atlassian.com/git/tutorials/comparing-workflows [Accessed 31 December
2019].

Atlassian, n.d. c. Git Feature Branch Workflow. [Online] Available at:


https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow
[Accessed 31 December 2019].

© The Independent Institute of Education (Pty) Ltd 2023 Page 273 of 290
IIE Module Manual APPR6312

Atlassian, n.d. e. git clone. [Online] Available at:


https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-clone [Accessed 31
December 2019].

Atlassian, n.d. f. Git stash. [Online] Available at:


https://www.atlassian.com/git/tutorials/saving-changes/git-stash [Accessed 1 January
2020].

Atlassian, n.d. g. Git commit. [Online] Available at:


https://www.atlassian.com/git/tutorials/saving-changes/git-commit [Accessed 1
January 2020].

Atlassian, n.d. h. git pull. [Online] Available at:


https://www.atlassian.com/git/tutorials/syncing/git-pull [Accessed 1 January 2020].

Atlassian, n.d. i. Git Branch. [Online] Available at:


https://www.atlassian.com/git/tutorials/using-branches [Accessed 1 January 2020].

Atlassian, n.d. j. Git Merge. [Online] Available at:


https://www.atlassian.com/git/tutorials/using-branches/git-merge [Accessed 1
January 2020].

Atlassian, n.d. k. About Code Coverage. [Online] Available at:


https://confluence.atlassian.com/clover/about-code-coverage-71599496.html
[Accessed 13 January 2020].

Atlassian, n.d.. Source code management (SCM) is used to track modifications to a


source code repository. SCM tracks a running history of changes to a code base and
helps resolve conflicts when merging updates from multiple contributors. SCM is also
synonymous with Versio. [Online] Available at:
https://www.atlassian.com/git/tutorials/source-code-management [Accessed 23
December 2019].

AutomateThePlanet.com, 2018. Most Complete Selenium WebDriver C# Cheat


Sheet. [Online] Available at: https://www.automatetheplanet.com/selenium-
webdriver-csharp-cheat-sheet/ [Accessed 13 January 2020].

Automation Consultants, 2019. Azure DevOps vs Jira. [Online] Available at:


https://www.automation-consultants.com/azure-devops-vs-jira/ [Accessed 4
December 2019].

Babu, R., 2019. SQL Server MERGE Statement overview and examples. [Online]
Available at: https://www.sqlshack.com/sql-server-merge-statement-overview-and-
examples/ [Accessed 8 January 2020].

Batkoski, E. et al., 2017. Views on Azure DevOps Services feeds. [Online] Available
at: https://docs.microsoft.com/en-
gb/azure/devops/artifacts/concepts/views?view=azure-devops [Accessed 2 January
2020].

© The Independent Institute of Education (Pty) Ltd 2023 Page 274 of 290
IIE Module Manual APPR6312

Belagatti, P., 2016. Benefits of Continuous Deployment. [Online] Available at:


https://dzone.com/articles/benefits-of-continuous-deployment [Accessed 6 January
2020].

Bisson, S., 2017. .Net Framework or .Net Core? When to use which. [Online]
Available at: https://www.infoworld.com/article/3180478/development-tools/net-
framework-or-net-core-when-to-use-which.html [Accessed 21 September 2018].

Brown, D. & Tardif, B., n.d.. An overview of Azure App Service Deployment Center.
[Online] Available at: https://azure.microsoft.com/en-gb/resources/videos/azure-
friday-an-overview-of-azure-app-service-deployment-center/ [Accessed 6 January
2020].

Bushnev, Y., 2019. Top 15 UI Test Automation Best Practices You Should Follow.
[Online] Available at: https://www.blazemeter.com/blog/top-15-ui-test-automation-
best-practices-you-should-follow/ [Accessed 13 January 2020].

CA Southern Africa, 2014. South African companies wake up to DevOps. [Online]


Available at: https://www.itweb.co.za/content/XGxwQDq1XB4MlPVo [Accessed 6
January 2020].

Carter, P., A, A., Addie, S. & Wenzel, M., 2018. Choosing between .NET Core and
.NET Framework for server apps. [Online] Available at:
https://docs.microsoft.com/en-us/dotnet/standard/choosing-core-framework-server
[Accessed 21 September 2018].

Cheshire, N., 2018. Centralized vs Distributed Version Control Systems - What's


Best for Notes Development?. [Online] Available at:
https://www.teamstudio.com/blog/distributed-vs-centralized-version-control-systems-
for-lotus-notes [Accessed 23 December 2019].

Churchman, M., 2017. Mock Frameworks vs. Microsoft Fakes. [Online] Available at:
https://saucelabs.com/blog/mock-frameworks-vs-microsoft-fakes [Accessed 10
January 2020].

Ciuluvica, A., 2018. 7 benefits of continuous integration. [Online] Available at:


https://www.computaris.com/7-benefits-of-continuous-integration/ [Accessed 1
January 2020].

Clark, A. et al., 2019. Install the Azure CLI. [Online] Available at:
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
[Accessed 17 December 2019].

Cokely, D., 2019. Creating NuGet packages in Azure DevOps with Azure Pipelines
and YAML. [Online] Available at: https://medium.com/@dan.cokely/creating-nuget-
packages-in-azure-devops-with-azure-pipelines-and-yaml-d6fa30f0f15e [Accessed 3
January 2020].

© The Independent Institute of Education (Pty) Ltd 2023 Page 275 of 290
IIE Module Manual APPR6312

CollabNet VersionOne, 2019b. What is DevOps? The Ultimate Guide to DevOps.


[Online] Available at: https://resources.collab.net/devops-101/what-is-devops
[Accessed 6 January 2020].

CollabNet, 2018b. What is DevOps? The Ultimate Guide to DevOps. [Online]


Available at: https://resources.collab.net/devops-101/what-is-devops [Accessed 19
October 2018].

Cool, J., 2018. Introducing Azure DevOps. [Online] Available at:


https://azure.microsoft.com/en-us/blog/introducing-azure-devops/ [Accessed 4
December 2019].

Costa, I., 2018. How to Undo the Last Commit. [Online] Available at:
https://code.likeagirl.io/how-to-undo-the-last-commit-393e7db2840b [Accessed 1
January 2020].

Danielson, S., 2018. Azure Repos Git tutorial. [Online] Available at:
https://docs.microsoft.com/en-us/azure/devops/repos/git/gitworkflow?view=azure-
devops [Accessed 31 December 2019].

Danielson, S. et al., 2018d. Best practices for using Azure Artifacts. [Online]
Available at: https://docs.microsoft.com/en-gb/azure/devops/artifacts/concepts/best-
practices?view=azure-devops [Accessed 2 January 2020].

Danielson, S. et al., 2019. Plan your organizational structure. [Online] Available at:
https://docs.microsoft.com/en-us/azure/devops/user-guide/plan-your-azure-devops-
org-
structure?toc=%2Fazure%2Fdevops%2Forganizations%2Ftoc.json&bc=%2Fazure%
2Fdevops%2Forganizations%2Fbreadcrumb%2Ftoc.json&view=azure-devops
[Accessed 4 December 2019].

Danielson, S. et al., 2017. Choosing the right version control for your project. [Online]
Available at: https://docs.microsoft.com/en-us/azure/devops/repos/tfvc/comparison-
git-tfvc?view=azure-devops [Accessed 24 December 2019].

Danielson, S., KathrynEE & chcomley, 2018c. Apply changes with rebase. [Online]
Available at: https://docs.microsoft.com/en-
us/azure/devops/repos/git/rebase?view=azure-devops&tabs=visual-studio [Accessed
1 January 2020].

Danielson, S., KathrynEE, Jacobs, M. & chcomley, 2018b. Get started with Git from
the command line. [Online].

Danielson, S. et al., 2017b. Build your SQL server database. [Online] Available at:
https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/aspnet/build-aspnet-
dacpac?view=azure-devops [Accessed 8 January 2020].

Davood, H., 2018. ChromeDriver does not exist in Selenium WebDriver C# test
script. [Online] Available at:

© The Independent Institute of Education (Pty) Ltd 2023 Page 276 of 290
IIE Module Manual APPR6312

https://stackoverflow.com/questions/9088367/chromedriver-does-not-exist-in-
selenium-webdriver-c-sharp-test-script [Accessed 13 January 2020].

dbtut.com, 2019. What is Data-Tier Application. [Online] Available at:


https://dbtut.com/index.php/2019/07/28/what-is-data-tier-application/ [Accessed 8
January 2020].

Dietrich, E., 2017. Unit Test Frameworks for C#: The Pros and Cons of the Top 3.
[Online] Available at: https://stackify.com/unit-test-frameworks-csharp/ [Accessed 10
January 2020].

Digital.ai, 2021. 15th Annual State of Agile Report. [Online] Available at:
https://digital.ai/resource-center/analyst-reports/state-of-agile-report [Accessed 28
April 2022].

Dixon, H., 2018. Deep dive into Azure Artifacts. [Online] Available at:
https://azure.microsoft.com/en-gb/blog/deep-dive-into-azure-artifacts/ [Accessed 2
January 2020].

Driessen, V., 2010. A successful Git branching model. [Online] Available at:
https://nvie.com/posts/a-successful-git-branching-model/ [Accessed 31 December
2019].

Dykstra, T. et al., 2019. Azure Functions triggers and bindings concepts. [Online]
Available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-
triggers-bindings [Accessed 20 December 2019].

Dykstra, T. et al., 2017. Azure Functions C# script (.csx) developer reference.


[Online] Available at: https://docs.microsoft.com/en-us/azure/azure-
functions/functions-reference-csharp#referencing-external-assemblies [Accessed 22
December 2019].

Dykstra, T. et al., 2018. Azure Functions C# developer reference. [Online] Available


at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-class-
library#functions-class-library-project [Accessed 7 January 2020].

Ebbo, D., 2012. Introducing Kudu: the Open Source engine behind 'git push azure
master'. [Online] Available at: http://blog.davidebbo.com/2012/06/introducing-open-
source-engine-behind.html [Accessed 6 January 2020].

ElGauchooo, 2014. Tests not running in Test Explorer. [Online] Available at:
https://stackoverflow.com/questions/23363073/tests-not-running-in-test-explorer
[Accessed 10 January 2020].

Ellis, S., 2008. Frameworks, Methodologies and Processes. [Online] Available at:
http://vsellis.com/frameworks-methodologies-and-processes/ [Accessed 3 December
2019].

© The Independent Institute of Education (Pty) Ltd 2023 Page 277 of 290
IIE Module Manual APPR6312

EntityFrameworkTutorial.net, 2019. Configure One-to-Many Relationships in EF 6.


[Online] Available at: https://www.entityframeworktutorial.net/code-first/configure-
one-to-many-relationship-in-code-first.aspx [Accessed 18 December 2019].

Ernst, M., 2018. Version control concepts and best practices. [Online] Available at:
https://homes.cs.washington.edu/~mernst/advice/version-control.html [Accessed 23
December 2019].

Farcic, V., 2013. Test Driven Development (TDD): Example Walkthrough. [Online]
Available at: https://technologyconversations.com/2013/12/20/test-driven-
development-tdd-example-walkthrough/ [Accessed 9 January 2020].

Felder, D., 2019. UI Test Automation Best Practices. [Online] Available at:
https://www.testcraft.io/ui-test-automation-best-practices-infographic/ [Accessed 13
January 2020].

Fowler, M., 2014. UnitTest. [Online] Available at:


https://martinfowler.com/bliki/UnitTest.html [Accessed 9 January 2020].

Fowler, M., 2018. IntegrationTest. [Online] Available at:


https://martinfowler.com/bliki/IntegrationTest.html [Accessed 10 January 2020].

Freeberg, J. et al., 2019. Set up staging environments in Azure App Service. [Online]
Available at: https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots
[Accessed 6 January 2020].

Gailey, G., Alberts, M., Dunn, J. & Tresness, C., 2019d. Develop Azure Functions by
using Visual Studio Code. [Online] Available at: https://docs.microsoft.com/en-
us/azure/azure-functions/functions-develop-vs-code?tabs=nodejs [Accessed 22
December 2019].

Gailey, G. et al., 2019b. Create your first function using Visual Studio. [Online]
Available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-
create-your-first-function-visual-studio [Accessed 20 December 2019].

Gailey, G. et al., 2017. An introduction to Azure Functions. [Online] Available at:


https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview
[Accessed 16 December 2019].

Gailey, G. et al., 2019. Develop Azure Functions using Visual Studio. [Online]
Available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-
develop-vs [Accessed 20 December 2019].

Gailey, G. et al., 2019c. Use Azure Functions to connect to an Azure SQL Database.
[Online] Available at: https://docs.microsoft.com/en-us/azure/azure-
functions/functions-scenario-database-table-cleanup [Accessed 20 December 2019].

Gailey, G. et al., 2017b. Azure Functions HTTP triggers and bindings. [Online]
Available at: https://docs.microsoft.com/en-gb/azure/azure-functions/functions-

© The Independent Institute of Education (Pty) Ltd 2023 Page 278 of 290
IIE Module Manual APPR6312

bindings-http-webhook?tabs=csharp#authorization-keys [Accessed 20 December


2019].

Gailey, G. et al., 2019e. Continuous deployment for Azure Functions. [Online]


Available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-
continuous-deployment [Accessed 7 January 2020].

Gentz, M. et al., 2019. Welcome to Azure Cosmos DB. [Online] Available at:
https://docs.microsoft.com/en-us/azure/cosmos-db/introduction [Accessed 16
December 2019].

Git, n.d. b. 7.2 Git Tools - Interactive Staging. [Online] Available at: https://git-
scm.com/book/en/v2/Git-Tools-Interactive-Staging [Accessed 1 January 2020].

Git, n.d. c. Logos. [Online] Available at: https://git-scm.com/downloads/logos


[Accessed 2 January 2020].

Git, n.d.. GUI Clients. [Online] Available at: https://git-


scm.com/download/gui/windows [Accessed 31 December 2019].

Gordon, L., n.d.. Continuous Integration & Continuous Deployments Best Practices.
[Online] Available at: https://by.dialexa.com/continuous-integration-continuous-
deployments-best-practices [Accessed 6 January 2020].

Grammatikos, G. C., 2018. About Team Foundations Server (TFS) And Visual
Studio Team Services (VSTS). [Online] Available at:
https://cloudopszone.com/about-team-foundation-server-and-visual-studio-team-
services/ [Accessed 4 December 2019].

Grantz, L., 2017. 7 Benefits of Unit Testing. [Online] Available at:


https://www.typemock.com/7-benefits-of-unit-testing/ [Accessed 10 January 2020].

Gratis, B., 2018. 5 Reasons Agile isn’t working for your team. [Online] Available at:
https://backlog.com/blog/5-reasons-agile-isnt-working-your-team/ [Accessed 18
October 2018].

Green, S., 2016. Choose Your Project Management Methodology: Pros and Cons of
Agile, Waterfall, PRiSM and more. [Online] Available at:
https://www.workflowmax.com/blog/choose-your-project-management-methodology-
pros-and-cons-of-agile-waterfall-prism-and-more [Accessed 18 October 2018].

Guru99, n.d.. Load Testing vs Stress Testing vs Performance Testing: Difference


Discussed. [Online] Available at: https://www.guru99.com/performance-vs-load-vs-
stress-testing.html [Accessed 11 January 2020].

Guyer, C. et al., 2016. Data-tier Applications. [Online] Available at:


https://docs.microsoft.com/en-us/sql/relational-databases/data-tier-applications/data-
tier-applications?view=sql-server-ver15 [Accessed 1 January 2020].

© The Independent Institute of Education (Pty) Ltd 2023 Page 279 of 290
IIE Module Manual APPR6312

Hamill, P., 2004. Unit Test Frameworks - Chapter 1. Unit Test Frameworks: An
Overview. [Online] Available at: https://www.oreilly.com/library/view/unit-test-
frameworks/0596006896/ch01.html [Accessed 10 January 2020].

Hollan, J., 2019. Using Entity Framework with Azure Functions. [Online] Available at:
https://dev.to/azure/using-entity-framework-with-azure-functions-50aa [Accessed 20
December 2019].

Homer, A. et al., 2019b. UI test with Selenium. [Online] Available at:


https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-
selenium?view=azure-devops [Accessed 13 January 2020].

Homer, A. et al., 2019. UI test with Selenium. [Online] Available at:


https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-
selenium?view=azure-devops [Accessed 13 January 2020].

Homer, A. et al., 2018. Deploy a web app to Azure App Services. [Online] Available
at: https://docs.microsoft.com/en-gb/azure/devops/pipelines/apps/cd/deploy-
webdeploy-webapps?view=azure-devops [Accessed 7 January 2020].

Horne, V. et al., 2019. What is Azure DNS?. [Online] Available at:


https://docs.microsoft.com/en-us/azure/dns/dns-overview [Accessed 16 December
2019].

Humble, J., 2017. What is Continuous Delivery?. [Online] Available at:


https://continuousdelivery.com/ [Accessed 19 Obtober 2018].

huypub, 2019. Install the Azure PowerShell module. [Online] Available at:
https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.1.0
[Accessed 17 December 2019].

IBM, n.d.. Cloud computing: A complete guide. [Online] Available at:


https://www.ibm.com/za-en/cloud/learn/cloud-computing [Accessed 16 December
2019].

issacnitin, 2019. dotnet cli Reportgenerator custom command fails #9472. [Online]
Available at: https://github.com/microsoft/azure-pipelines-tasks/issues/9472
[Accessed 13 January 2020].

IT Central Station, 2019. Compare JIRA vs. Microsoft Azure DevOps. [Online]
Available at:
https://www.itcentralstation.com/products/comparisons/jira_vs_microsoft-azure-
devops [Accessed 4 December 2019].

Jones, M. et al., 2019. An introduction to NuGet. [Online] Available at:


https://docs.microsoft.com/en-us/nuget/what-is-nuget [Accessed 2 January 2020].

Joshi, K., 2018. Using “Kudu” to Manage Azure Web Apps. [Online] Available at:
https://www.gslab.com/blogs/kudu-azure-web-app [Accessed 6 January 2020].

© The Independent Institute of Education (Pty) Ltd 2023 Page 280 of 290
IIE Module Manual APPR6312

Kanbanize, 2019. Kanban Explained for Beginners. [Online] Available at:


https://kanbanize.com/kanban-resources/getting-started/what-is-kanban/ [Accessed
3 December 2019].

KathrynEE, et al., 2019b. Sign up for free and invite others to collaborate on your
project. [Online] Available at: https://docs.microsoft.com/en-
us/azure/devops/boards/get-started/sign-up-invite-teammates?view=azure-devops
[Accessed 4 December 2019].

KathrynEE, et al., 2019. About dashboards, charts, reports, & widgets. [Online]
Available at: https://docs.microsoft.com/en-
us/azure/devops/report/dashboards/overview?view=azure-devops [Accessed 5
December 2019].

KathrynEE, et al., 2019c. Choose a process. [Online] Available at:


https://docs.microsoft.com/en-us/azure/devops/boards/work-items/guidance/choose-
process?view=azure-devops&tabs=basic-process [Accessed 11 December 2019].

KathrynEE, et al., 2019d. Publish and download Universal Packages in Azure


Pipelines. [Online] Available at: https://docs.microsoft.com/en-
us/azure/devops/pipelines/artifacts/universal-
packages?toc=%2Fazure%2Fdevops%2Fartifacts%2Ftoc.json&bc=%2Fazure%2Fd
evops%2Fartifacts%2Fbreadcrumb%2Ftoc.json&view=azure-devops&tabs=yaml
[Accessed 3 January 2020].

Kolodiy, S., n.d.. Unit Tests, How to Write Testable Code and Why it Matters.
[Online] Available at: https://www.toptal.com/qa/how-to-write-testable-code-and-why-
it-matters [Accessed 9 January 2020].

Korkishko, I., 2017. Top 6 software development methodologies. [Online] Available


at: https://dev.to/iriskatastic/top-6-software-development-methodologies-9b
[Accessed 18 October 2018].

Kruchten, P., 2004. An Introduction to the Rational Unified Process. [Online]


Available at: http://www.informit.com/articles/article.aspx?p=169549&seqNum=5
[Accessed 18 October 2018].

Kuprenko, V., 2017. Top 5 Software Development Methodologies. [Online] Available


at: https://project-management.com/top-5-software-development-methodologies/
[Accessed 18 October 2018].

Latham, L., Nelson, J. C., Smith, S. & van der Til, J., 2019. Integration tests in
ASP.NET Core. [Online] Available at: https://docs.microsoft.com/en-
us/aspnet/core/test/integration-tests?view=aspnetcore-2.1 [Accessed 10 January
2020].

Lazar, A., 2018. How to call an Azure function from an ASP.NET Core MVC
application. [Online] Available at: https://hub.packtpub.com/azure-function-asp-net-
core-mvc-application/ [Accessed 23 December 2019].

© The Independent Institute of Education (Pty) Ltd 2023 Page 281 of 290
IIE Module Manual APPR6312

Likness, J., 2018. Serverless apps: Architecture, patterns, and Azure


implementation. [Online] Available at: https://docs.microsoft.com/en-
us/dotnet/architecture/serverless/ [Accessed 20 December 2019].

Lin, C., Petersen, T. & Potapenko, N., 2017. Azure App Service plan overview.
[Online] Available at: https://docs.microsoft.com/en-gb/azure/app-service/overview-
hosting-plans [Accessed 16 December 2019].

Lin, C., Petersen, T. & Uribe, C., 2019c. Scale up an app in Azure App Service.
[Online] Available at: https://docs.microsoft.com/en-us/azure/app-service/manage-
scale-up [Accessed 20 December 2019].

Lin, C., Sherer, T., Petersen, T. & Caserio, C., 2019. Create an ASP.NET
Framework web app in Azure. [Online] Available at: https://docs.microsoft.com/en-
gb/azure/app-service/app-service-web-get-started-dotnet-framework [Accessed 18
December 2019].

Lin, C. et al., 2019b. Create an ASP.NET Core web app in Azure. [Online] Available
at: https://docs.microsoft.com/en-gb/azure/app-service/app-service-web-get-started-
dotnet [Accessed 19 December 2019].

Lipski, M., 2017. Test Doubles — Fakes, Mocks and Stubs. [Online] Available at:
https://blog.pragmatists.com/test-doubles-fakes-mocks-and-stubs-1a7491dfa3da
[Accessed 10 January 2020].

Lock, A., 2017. Creating parameterised tests in xUnit with [InlineData], [ClassData],
and [MemberData]. [Online] Available at: https://andrewlock.net/creating-
parameterised-tests-in-xunit-with-inlinedata-classdata-and-memberdata/ [Accessed
11 January 2020].

L, R., 2021. Announcing .NET 6 — The Fastest .NET Yet. [Online] Available at:
https://devblogs.microsoft.com/dotnet/announcing-net-6/ [Accessed 28 April 2022].

Lubański, M., 2019. Centralized vs Distributed Version Control Systems. [Online]


Available at: https://medium.com/faun/centralized-vs-distributed-version-control-
systems-a135091299f0 [Accessed 23 December 2019].

Lucidchart Content Team, 2018. Continuous Deployment 101: Best Practices for the
Popular Engineering Approach. [Online] Available at:
https://www.lucidchart.com/blog/continuous-deployment-best-practices [Accessed 6
January 2020].

Luijbregts, B., 2018. Demystify the .NET Ecosystem. [Online] Available at:
https://dzone.com/articles/demystify-the-net-ecosystem-understand-its-runtime
[Accessed 21 September 2018].

Luk, J. et al., 2019. Overview of Azure Cloud Shell. [Online] Available at:
https://docs.microsoft.com/en-us/azure/cloud-shell/overview [Accessed 17
December 2019].

© The Independent Institute of Education (Pty) Ltd 2023 Page 282 of 290
IIE Module Manual APPR6312

Lvivity, 2018. Waterfall Methodology: Advantages, Disadvantages And When to Use


It?. [Online] Available at: https://lvivity.com/waterfall-model [Accessed 18 October
2018].

Mantini, N., 2018. Design Thinking, Lean Startup and Agile: What is the difference?.
[Online] Available at: https://medium.com/xplor8/design-thinking-lean-startup-and-
agile-what-is-the-difference-1eed3594b121 [Accessed 3 December 2019].

Mashkowski, N., 2016. Introducing Azure Functions. [Online] Available at:


https://azure.microsoft.com/en-us/blog/introducing-azure-functions/ [Accessed 16
December 2019].

Mathurin, C., 2018. NET Core 2: Why xUnit and not NUnit or MSTest. [Online]
Available at: https://dev.to/hatsrumandcode/net-core-2-why-xunit-and-not-nunit-or-
mstest--aei [Accessed 10 January 2020].

McKane, J., 2019. Huawei Cloud launches in South Africa. [Online] Available at:
https://mybroadband.co.za/news/cloud-hosting/298252-huawei-cloud-launches-in-
south-africa.html [Accessed 16 December 2019].

McLeod, D., 2019. Oracle to build cloud infrastructure region in South Africa. [Online]
Available at: https://techcentral.co.za/oracle-to-build-cloud-infrastructure-region-in-
south-africa/92658/ [Accessed 16 December 2019].

Meiling, J., 2019. Kanban in Organizations Part II. [Online] Available at:
https://www.projectwizards.net/en/blog/2019/01/kanban-corepractices [Accessed 3
December 2019].

Mekhanikov, E., 2018. 5 CI/CD Best Practices for Better Code Quality. [Online]
Available at: https://www.blazemeter.com/blog/5-ci-cd-best-practices-for-better-code-
quality/ [Accessed 6 January 2020].

Michaelis, M., 2019. .NET Reunified: Microsoft’s Plans for .NET 5. [Online] Available
at: https://docs.microsoft.com/en-us/archive/msdn-magazine/2019/july/csharp-net-
reunified-microsoft%e2%80%99s-plans-for-net-5 [Accessed 28 April 2022].

Microsoft Corporation, 2018. .NET Downloads for Linux, macOS, and Windows.
[Online] Available at: https://www.microsoft.com/net/download [Accessed 21
September 2018].

Microsoft, 2019. Azure DevOps Server. [Online] Available at:


https://azure.microsoft.com/en-gb/services/devops/server/ [Accessed 4 December
2019].

Microsoft, 2019b. What is cloud computing?. [Online] Available at:


https://azure.microsoft.com/en-us/overview/what-is-cloud-computing/ [Accessed 16
December 2019].

© The Independent Institute of Education (Pty) Ltd 2023 Page 283 of 290
IIE Module Manual APPR6312

Microsoft, 2019c. What is PaaS?. [Online] Available at:


https://azure.microsoft.com/en-gb/overview/what-is-paas/ [Accessed 16 December
2019].

Microsoft, 2019d. Azure products. [Online] Available at:


https://azure.microsoft.com/en-us/services/ [Accessed 16 December 2019].

Microsoft, 2019e. Serverless computing. [Online] Available at:


https://azure.microsoft.com/en-us/overview/serverless-computing/ [Accessed 20
December 2019].

Microsoft, 2022. Download .NET Framework. [Online] Available at:


https://dotnet.microsoft.com/en-us/download/dotnet-framework [Accessed 28 April
2022].

Microsoft, n.d. b. Azure SQL Database - Platform as a Service. [Online] Available at:
https://docs.microsoft.com/en-us/azure/sql-database/sql-database-paas-index
[Accessed 16 December 2019].

Microsoft, n.d. c. App Service Documentation. [Online] Available at:


https://docs.microsoft.com/en-gb/azure/app-service/ [Accessed 16 December 2019].

Microsoft, n.d. d. Determine the best trigger for your Azure function. [Online]
Available at: https://docs.microsoft.com/en-us/learn/modules/execute-azure-function-
with-triggers/2-determine-best-trigger [Accessed 20 December 2019].

Microsoft, n.d. e. HttpTrigger.authLevel Method. [Online] Available at:


https://docs.microsoft.com/en-
us/java/api/com.microsoft.azure.functions.annotation.httptrigger.authlevel?view=azur
e-java-stable [Accessed 20 December 2019].

Microsoft, n.d. f. What is Azure Repos?. [Online] Available at:


https://docs.microsoft.com/en-us/azure/devops/repos/get-started/what-is-
repos?view=azure-devops [Accessed 24 December 2019].

Microsoft, n.d. g. Pricing for Azure DevOps. [Online] Available at:


https://azure.microsoft.com/en-us/pricing/details/devops/azure-devops-services/
[Accessed 1 January 2020].

Microsoft, n.d. h. What is NuGet?. [Online] Available at: https://www.nuget.org/


[Accessed 2 January 2020].

Microsoft, n.d. i. Microsoft.EntityFrameworkCore.SqlServer 3.1.0. [Online] Available


at: https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer/
[Accessed 2 January 2020].

Microsoft, n.d. j. Azure Artifacts. [Online] Available at: https://azure.microsoft.com/en-


us/services/devops/artifacts/ [Accessed 2 January 2020].

© The Independent Institute of Education (Pty) Ltd 2023 Page 284 of 290
IIE Module Manual APPR6312

Microsoft, n.d. k. Assert Class. [Online] Available at: https://docs.microsoft.com/en-


us/dotnet/api/microsoft.visualstudio.testtools.unittesting.assert?view=mstest-net-
1.3.2 [Accessed 10 January 2020].

Microsoft, n.d. m. Compare Visual Studio 2019 Editions. [Online] Available at:
https://visualstudio.microsoft.com/vs/compare/ [Accessed 10 January 2020].

Microsoft, n.d.. Exercise - Restrict network access. [Online] Available at:


https://docs.microsoft.com/en-gb/learn/modules/secure-your-azure-sql-database/2-
restrict-network-access [Accessed 16 December 2019].

Moyo, A., 2019. South African companies make Microsoft Azure shift. [Online]
Available at: https://www.itweb.co.za/content/dgp45MaGbJlvX9l8 [Accessed 16
December 2019].

Myers, T. et al., 2019. Introduction to Azure Storage. [Online] Available at:


https://docs.microsoft.com/en-us/azure/storage/common/storage-introduction
[Accessed 16 December 2019].

Novoseltseva, E., 2019. 8 Benefits of Unit Testing. [Online] Available at:


https://dzone.com/articles/top-8-benefits-of-unit-testing [Accessed 10 January 2020].

Nowinski, K., 2018. How to create DACPAC file?. [Online] Available at:
https://sqlplayer.net/2018/10/how-to-create-dacpac-file/ [Accessed 8 January 2020].

Oracle, 2022. Oracle Opens First Cloud Region in Africa. [Online] Available at:
https://www.oracle.com/za/news/announcement/oracle-cloud-johannesburg-region-
2022-01-19/ [Accessed 28 April 2022].

Oslake, M., 2019. Choose between the vCore and the DTU purchasing models.
[Online] Available at: https://docs.microsoft.com/en-us/azure/sql-database/sql-
database-purchase-models [Accessed 17 December 2019].

Owen, 2019. How To Use Azure Resource Groups: A Simple Explanation. [Online]
Available at: https://www.otava.com/reference/how-to-use-azure-resource-groups-a-
simple-explanation/ [Accessed 16 December 2019].

Ozar, B., 2009. SQL Server 2008 R2: The DAC Pack. [Online] Available at:
https://www.brentozar.com/archive/2009/08/sql-server-2008-r2-the-dac-pack/
[Accessed 8 January 2020].

Pahuja, S., n.d.. What is Scrumban?. [Online] Available at:


https://www.agilealliance.org/what-is-scrumban/ [Accessed 3 December 2019].

Petersen, T., Lin, C., Freeberg, J. & Bradley, M., 2019. Continuous deployment to
Azure App Service. [Online] Available at: https://docs.microsoft.com/en-
us/azure/app-service/deploy-continuous-deployment [Accessed 6 January 2020].

© The Independent Institute of Education (Pty) Ltd 2023 Page 285 of 290
IIE Module Manual APPR6312

Pittet, S., n.d.. Continuous Deployment. [Online] Available at:


https://www.atlassian.com/continuous-delivery/continuous-deployment [Accessed 6
January 2020].

Powell-Morse, A., 2017b. Rational Unified Process: What Is It And How Do You Use
It?. [Online] Available at: https://airbrake.io/blog/sdlc/rational-unified-process
[Accessed 18 October 2018].

Prescott, A., 2012. A "Shim-ple" Tutorial with Microsoft Fakes. [Online] Available at:
https://adamprescott.net/2012/08/21/a-shim-ple-tutorial-with-microsoft-fakes/
[Accessed 10 January 2020].

Rabeler, C. et al., 2019b. Controlling and granting database access to SQL


Database and SQL Data Warehouse. [Online] Available at:
https://docs.microsoft.com/en-us/azure/sql-database/sql-database-manage-logins
[Accessed 17 December 2019].

Rabeler, C. et al., 2019c. Quickstart: Use .NET and C# in Visual Studio to connect to
and query an Azure SQL database. [Online] Available at:
https://docs.microsoft.com/en-us/azure/sql-database/sql-database-connect-query-
dotnet-visual-studio [Accessed 17 December 2019].

Rabeler, C. et al., 2019. Choose the right deployment option in Azure SQL. [Online]
Available at: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-
paas-vs-sql-server-iaas [Accessed 17 December 2019].

Radigan, D., 2018. What is kanban?. [Online] Available at:


https://www.atlassian.com/agile/kanban [Accessed 18 October 2018].

Reese, J. et al., 2018. Unit testing best practices with .NET Core and .NET
Standard. [Online] Available at: https://docs.microsoft.com/en-
us/dotnet/core/testing/unit-testing-best-practices [Accessed 10 January 2020].

Rehkopf, M., 2019. Kanban vs. Scrum. [Online] Available at:


https://www.atlassian.com/agile/kanban/kanban-vs-scrum [Accessed 3 December
2019].

Rehkopf, M., n.d.. Epics, Stories, Themes, and Initiatives. [Online] Available at:
https://www.atlassian.com/agile/project-management/epics-stories-themes
[Accessed 3 December 2019].

Ries, E., n.d.. The Lean Startup Methodology. [Online] Available at:
http://theleanstartup.com/principles [Accessed 3 December 2019].

Riggins, J., 2017. Unit Testing: Time Consuming but Product Saving. [Online]
Available at: https://thenewstack.io/unit-testing-time-consuming-product-saving/
[Accessed 10 January 2020].

© The Independent Institute of Education (Pty) Ltd 2023 Page 286 of 290
IIE Module Manual APPR6312

Roseke, B., 2012. The Life Cycle of an Engineering Project. [Online] Available at:
http://www.projectengineer.net/the-life-cycle-of-an-engineering-project/ [Accessed 18
October 2018].

Ross, E. et al., 2019. What is Azure Active Directory?. [Online] Available at:
https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-
directory-whatis [Accessed 16 December 2019].

Sacolick, I., 2018. What is agile methodology? Modern software development


explained. [Online] Available at: https://www.infoworld.com/article/3237508/agile-
development/what-is-agile-methodology-modern-software-development-
explained.html [Accessed 18 October 2018].

Schwaber, K. & Sutherland, J., 2017. The Scrum Guide. The Definitive Guide to
Scrum: The Rules of the Game. [Online] Available at:
https://www.scrumguides.org/docs/scrumguide/v2017/2017-Scrum-Guide-
US.pdf#zoom=100 [Accessed 3 December 2019].

SCRUMstudy, 2017. A Guide to the Scrum Body of Knowledge (SBOK™ Guide) –


Third edition. [ebook]. [Online] Available at: ttps://www.scrumstudy.com/sbokguide/
[Accessed 9 June 2017].

Selenium.dev, 2020. Locating elements. [Online] Available at:


https://selenium.dev/documentation/en/getting_started_with_webdriver/locating_ele
ments/ [Accessed 13 January 2020].

Shash, M., 2019. Deployment Automation Best Practices: When Should You Start to
Automate?. [Online] Available at: https://levelup.gitconnected.com/deployment-
automation-best-practices-when-should-you-start-to-automate-28b682cdd4e2
[Accessed 6 January 2020].

Sherer, T. et al., 2019. What is Azure DevOps?. [Online] Available at:


https://docs.microsoft.com/en-us/azure/devops/user-guide/what-is-azure-
devops?toc=%2Fazure%2Fdevops%2Fget-
started%2Ftoc.json&bc=%2Fazure%2Fdevops%2Fget-
started%2Fbreadcrumb%2Ftoc.json&view=azure-devops [Accessed 4 December
2019].

Shigihalli, U., 2019. Perfecting Continuous Delivery of NuGet packages for Azure
Artifacts. [Online] Available at: https://cloudblogs.microsoft.com/industry-blog/en-
gb/technetuk/2019/06/18/perfecting-continuous-delivery-of-nuget-packages-for-
azure-artifacts/ [Accessed 2 January 2020].

Singh, M., 2018. How do you “do” Scrumban?. [Online] Available at:
https://www.digite.com/blog/how-do-you-do-scrumban/ [Accessed 4 Decemeber
2019].

Snodgrass, M., 2017. Dev Leaders Compare Continuous Delivery vs. Continuous
Deployment vs. Continuous Integration. [Online] Available at:

© The Independent Institute of Education (Pty) Ltd 2023 Page 287 of 290
IIE Module Manual APPR6312

https://stackify.com/continuous-delivery-vs-continuous-deployment-vs-continuous-
integration/ [Accessed 6 January 2020].

Software Freedom Conservancy, n.d.. SelecniumHQ Browser Automation. [Online]


Available at: https://selenium.dev/ [Accessed 13 January 2020].

Software Testing Fundamentals, 2019. Integration Testing. [Online] Available at:


http://softwaretestingfundamentals.com/integration-testing/ [Accessed 9 January
2020].

SoftwareTestingHelp.com, 2019. What Is Integration Testing (Tutorial With


Integration Testing Example). [Online] Available at:
https://www.softwaretestinghelp.com/what-is-integration-testing/ [Accessed 10
January 2020].

Spajic, Z., 2018. Understanding Git — Index. [Online] Available at:


https://hackernoon.com/understanding-git-index-4821a0765cf [Accessed 1 January
2020].

Spasojevic, M., 2019. Automated UI tests with Selenium and ASP.NET Core MVC.
[Online] Available at: https://code-maze.com/automatic-ui-testing-selenium-asp-net-
core-mvc/ [Accessed 13 January 2020].

Spasojevic, M., 2019. Integration Testing in ASP.NET Core MVC. [Online] Available
at: https://code-maze.com/integration-testing-asp-net-core-mvc/ [Accessed 11
January 2020].

Staheli, D. et al., 2019b. Predefined variables. [Online] Available at:


https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-
devops&tabs=yaml [Accessed 3 January 2020].

Staheli, D. et al., 2019. Azure Pipelines agents. [Online] Available at:


https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-
devops&tabs=browser [Accessed 2 January 2020].

Synopsis, 2017. Top 4 software development methodologies. [Online] Available at:


https://www.synopsys.com/blogs/software-security/top-4-software-development-
methodologies/ [Accessed 18 October 2018].

TatvaSoft, 2015. Top 12 Software Development Methodologies & its Advantages /


Disadvantages. [Online] Available at: https://www.tatvasoft.com/blog/top-12-
software-development-methodologies-and-its-advantages-disadvantages/ [Accessed
18 October 2018].

Taylor, A., 2017. 5 Advantages of Continuous Integration. [Online] Available at:


https://pantheon.io/blog/5-advantages-continuous-integration [Accessed 1 January
2020].

© The Independent Institute of Education (Pty) Ltd 2023 Page 288 of 290
IIE Module Manual APPR6312

TechTarget, 2017. DevOps. [Online] Available at:


https://searchitoperations.techtarget.com/definition/DevOps [Accessed 19 October
2018].

The Independent Institute of Education, 2018. Programming 3A Module Manual,


Sandton: The Independent Institute of Education.

thomps23, et al., 2019. Build, test, and deploy .NET Core apps. [Online] Available at:
https://docs.microsoft.com/en-gb/azure/devops/pipelines/ecosystems/dotnet-
core?view=azure-devops [Accessed 6 January 2020].

ThoughtWorks, 2018. Continuous Integration. [Online] Available at:


https://www.thoughtworks.com/continuous-integration [Accessed 19 October 2018].

Tutorials Point, n.d.. SDLC - Overview. [Online] Available at:


https://www.tutorialspoint.com/sdlc/sdlc_overview.htm [Accessed 3 December 2019].

Urbonas, R., 2013. Automated User Interface Testing. [Online] Available at:
https://www.devbridge.com/articles/automated-user-interface-testing/ [Accessed 13
January 2020].

Verheyen, G., 2013b. There’s value in the Scrum Values. [Online] Available at:
https://guntherverheyen.com/2013/05/03/theres-value-in-the-scrum-values/
[Accessed 3 December 2019].

Verheyen, G., 2013. Scrum: Framework, not methodology. [Online] Available at:
https://guntherverheyen.com/2013/03/21/scrum-framework-not-methodology/
[Accessed 3 December 2019].

Vermeulen, J., 2019. AWS data centres for South Africa coming soon. [Online]
Available at: https://mybroadband.co.za/news/cloud-hosting/326139-aws-data-
centres-for-south-africa-coming-soon.html [Accessed 16 December 2019].

Visual Paradigm, n.d.. What is a Self-Organizing Team in Scrum?. [Online] Available


at: https://www.visual-paradigm.com/scrum/what-is-self-organizing-team-in-scrum/
[Accessed 3 December 2019].

Voort, J. v. d., 2017. 9 Benefits of Continuous Integration. [Online] Available at:


https://dzone.com/articles/9-bene-ts-of-continuous-integration [Accessed 1 January
2020].

Wallin, M., 2019. Best Practices for Version Control in 8 steps. [Online] Available at:
https://ruleoftech.com/2019/best-practices-for-version-control-in-8-steps [Accessed
23 December 2019].

Warren, G., Casey, C., Hogenson, G. & Jacobs, M., 2016c. Edit load test scenarios.
[Online] Available at: https://docs.microsoft.com/en-us/visualstudio/test/edit-load-
test-scenarios?view=vs-2019 [Accessed 12 January 2020].

© The Independent Institute of Education (Pty) Ltd 2023 Page 289 of 290
IIE Module Manual APPR6312

Warren, G. et al., 2016b. Isolate code under test with Microsoft Fakes. [Online]
Available at: https://docs.microsoft.com/en-us/visualstudio/test/isolating-code-under-
test-with-microsoft-fakes?view=vs-2019 [Accessed 10 January 2020].

Warren, G. et al., 2016. Use shims to isolate your app for unit testing. [Online]
Available at: https://docs.microsoft.com/en-us/visualstudio/test/using-shims-to-
isolate-your-application-from-other-assemblies-for-unit-testing?view=vs-2019
[Accessed 10 January 2020].

Warren, G. et al., 2018. Quickstart: Create a load test project. [Online] Available at:
https://docs.microsoft.com/en-us/visualstudio/test/quickstart-create-a-load-test-
project?view=vs-2019 [Accessed 12 January 2020].

Wasson, M. et al., 2019. Improve scalability in an Azure web application. [Online]


Available at: https://docs.microsoft.com/en-us/azure/architecture/reference-
architectures/app-service-web-app/scalable-web-app [Accessed 16 December
2019].

Wasson, M. et al., 2017. Run a basic web application in Azure. [Online] Available at:
https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/app-
service-web-app/basic-web-app [Accessed 16 December 2019].

Wilson, C. et al., 2018. Get started with NuGet packages in Azure DevOps Services
and TFS. [Online] Available at: https://docs.microsoft.com/en-
gb/azure/devops/artifacts/get-started-nuget?view=azure-devops [Accessed 2
January 2020].

Wilson, C. & chcomley, 2019. Sign up for Azure Artifacts. [Online] Available at:
https://docs.microsoft.com/en-us/azure/devops/artifacts/start-using-azure-
artifacts?view=azure-devops [Accessed 2 January 2020].

Winand, M., n.d.. select without from. [Online] Available at: https://modern-
sql.com/use-case/select-without-from [Accessed 8 January 2020].

Yodis, 2016. Kanban Vs Scrum Benefits, Similarities, Pros and cons. [Online]
Available at: https://www.yodiz.com/blog/kanban-vs-scrum-benefits-similarities-pros-
and-cons/ [Accessed 19 October 2018].

Zhou, N. B., 2018. Using Advanced Publish Settings for Visual Studio Database
Project. [Online] Available at: https://www.mssqltips.com/sqlservertip/5456/using-
advanced-publish-settings-for-visual-studio-database-project/ [Accessed 8 January
2020].

© The Independent Institute of Education (Pty) Ltd 2023 Page 290 of 290

You might also like