Serverless Website Deployment 100% Automated in Multiple Environments (Test, QA, and Production) Using Azure DevOps Repos and Pipelines (CI/CD)

Lionell Jenious
5 min readAug 11, 2024

--

Serverless Website Deployment 100% Automated in Multiple Environments (Test, QA, and Production) Using Azure DevOps Repos and Pipelines (CI/CD)

In this project, inspired by real-world scenarios, I took on the role of a Cloud Engineer utilizing DevOps practices to deploy a serverless website in a fully automated manner, leveraging Azure DevOps Repos for source control and Azure DevOps Pipelines for CI/CD.

Successfully deploying this website across three separate environments — Test, QA, and Production — simulated real enterprise scenarios and provided invaluable hands-on experience.

Serverless Website Deployment 100% Automated in Multiple Environments (Test, QA, and Production) Using Azure DevOps Repos and Pipelines (CI/CD)

Part One: Initial Setup and Configuration

Step 1: Creating Storage Accounts for Each Environment:

Storage Accounts for Each Environment:tcbjrtst (Test);tcbjrhom (QA);tcbjrprd (Production)
Storage Account:tcbjrtst (Test) https://tcbjrtst.z13.web.core.windows.net/
Storage Account:tcbjrhom (QA) https://tcbjrhom.z13.web.core.windows.net/
Storage Account:tcbjrprd (Production) https://tcbjrprd.z13.web.core.windows.net/

Step 2: Enabling Static Website & Setting Up Home Page:

  • Configuration:
  • Enabled Static Website feature on each storage account.
  • Set index.html as the home page for all environments.
Enabled Static Website feature on each storage account
Enabled Static Website feature on each storage account

Step 3: Creating Azure DevOps Organization & Project:

  • Organization: Created a new Azure DevOps Organization.
  • Project: Created a new project named website01 to manage the repository and pipelines.
Organization: Created a new Azure DevOps Organization
Project: Created a new project named website01 to manage the repository and pipelines.

Step 4: Setting Up Azure Repos:

  • Generated Git credentials for Azure Repos.
  • Cloned the source code from GitHub to my local machine using:
  • Pushed the code to Azure Repos with the following commands:
Generated Git credentials for Azure Repos: ner3k…..k2hbw………..yd427upry…n5q
Cloned the source code from GitHub to my local machine using:
cd azuredevops
# error: remote origin already exists — then add
git remote remove origin
git remote add origin https://tcb-updates-mod7-lbjenious@dev.azure.com/tcb-updates-mod7-lbjenious/website01/_git/website01

Part Two: Configuring CI/CD Pipelines

Step 1: Creating the CI Pipeline:

  • Pipeline Name: website01-CI
  • Configuration:
  • Used Classic Editor to create an empty job.
  • Added a task to archive website files (Zip files).
  • Added a task to publish build artifacts (Artifacts Publish).

Enabled continuous integration by setting up triggers

Project Settings > Pipelines >Settings > Disable to Turn [ON] Classic Release Pipelines
Classic Editor to create an empty job.
Azure Repos Git Configuration: Team Project [website01] | Repository [website01]
Pipeline Name: website01-CI
Added a task to archive website files (Zip files).
Added a task to publish build artifacts (Artifacts Publish)
Comments and Save

Step 2: Creating the CD Pipeline:

  • Pipeline Configuration:
  • Created a new release pipeline.
  • Added artifacts from the CI pipeline and enabled continuous deployment.
  • Stages:
  • Test Stage:
  • Task to extract files from the build artifacts.
  • Task to upload files to the Test environment storage account (tcbjrtst) using Azure CLI.
  • Production Stage:
  • Cloned the Test stage to create a Production stage.
  • Modified the Azure CLI task to upload files to the Production environment storage account (tcbjrprd).
  • Pre-deployment Approvals:
  • Set up pre-deployment approvals for the Production stage, requiring manual approval via email before deployment.
Created a new release pipeline / Added artifacts from the CI pipeline / enabled continuous deployment.
Created a new release pipeline > Test
Task to extract files from the build artifacts.
Task to upload files to the Test environment storage account (tcbjrtst) using Azure CLI.
Configured: Script Type: Shell; Script location: Inline script: Inline scripts: az storage blob upload-batch — account-name tcblj1tst — destination “\$web” — source ./files — overwrite
Working Directory: $(Build.DefaultWorkingDirectory)/$(Build.BuildId)
Renamed pipeline to website01-CD / saved
  • Cloned the Test stage to create a Production stage and Modified the Azure CLI task to upload files to the Production environment storage account (tcbjrprd).
Cloned Test to create QA; Cloned QA to create Production
  • From the Production stage, Enable Pre-deployment conditions to get approval before deploying to production.
  • Pre-deployment approvals: put your Azure access email
Pre-deployment approvals: put your Azure access email

Part Three: Testing and Validation

Step 1: Running the CI Pipeline:

  • Triggered the website01-CI pipeline and monitored the build process.

Step 2: Monitoring the CD Pipeline:

  • Monitored the release pipeline to ensure files were correctly deployed to the Test and Production environments.

Step 3: Approval and Production Deployment:

  • Approved the deployment to Production after validating the Test environment.
Testing: click on Pipelines > Pipelines > Select pipeline website01-CI > Click on run Pipeline > Run
Initialized and Finished Job
Post Job Checkout for Wensite01
Approved each continuous deployment via Stages for [Test] —> [QA] —> [ Production ]
Approved Job for Production

Additional Git Bash CLI Logs

  • Serverless website deployment 100% automated using Azure DevOps Repos & Pipelines (CI/CD) in multiple environments

Additional Git Bash CLI Logs

  • Executed git add, git config, git commit, and git push commands to update the /files/index.html file with the message 'Very Good Job'!!! , successfully deploying the changes to the production environment for the production website:
Executed git add, git config, git commit, and git push commands
The final update was pushed to the Production website

--

--

Lionell Jenious
Lionell Jenious

Written by Lionell Jenious

Cloud Software Network Engineer | AWS | AI/ML | Blockchain | Azure | Google Cloud | VMware | Cloud Computing | DevOps | Software Defined Networks SD-WAN

No responses yet