Deployment in Microsoft Azure

Zachary Gomez
4 min readFeb 13, 2023

--

What Is Microsoft Azure

Microsoft Azure is Micosoft’s public platform for cloud computing. It offers more than 600 services to the consumer on a pay-what-you-use basis. There is also the scalability factor, whether you have one or one million users it is possible for Azure to keep up with demand instantly. It has data centers world wide and is used by the majority of Fortune 500 companies.

Azure offers variety of services for management and data store such as Azure SQL Database and Azure Storage. These services allow you to store, manage and process you data in a secure manner. Because the information is distributed to many data centers in different locations it is also protected against unreliable conditions.

The Azure portal offers an intuitive and user friend interface to manage deployments. This includes real time metrics, diagnostic logs and will alert your if there are any issues.

Deployment in Azure

The Setup

To deploy in Azure you must have your deployment source, build a pipeline, and choose a deployment mechanism. Simple! But what does that actually entail?

The deployment source is the location that your application code is stored. Typically this will be hosted by version control software such as GitHub or Azure Reops. It could also be a project on your local machine or in an app service such as Dropbox or OneDrive.

https://www.xenonstack.com/hubfs/microsoft-azure-devops-pipeline.png

When building a pipeline includes a serious of steps including compiling code, minifying HTLM and JavaScript, and running tests, all to make sure the application is in a state that can run. You may either choose to test locally or use a service such as Azure Pipelines.

The deployment mechanisms supported by App services include Kudu endpoints(an open-source developer too that handles continuous deployments and provides HTTP endpoints for deployment) and FTP or Webdeploy.

Deployment

When testing a new production build it is standard to use deployment slots. These use containers that hold all the repos that are needed to make the app run. This allows you to test your code and application in staging and dev slots while not pushing the code to production. Your stage and dev repository branches may be continuously deployed so that your devs know what is the current state of the code and so that your shareholders may see the progress without pushing it to master.

https://learn.microsoft.com/en-us/azure/app-service/media/app-service-deploy-best-practices/slot_flow_container_diagram.png

Azure DevOps offers continuous delivery of containers through the deployment center. Follow the instructions to select your repo and branch and this will configure the build to release a pipeline to automatically deploy your container.

In your GitHub repository you can automate your container deployment using GitHub Actions. Adding this workflow file will build and tag your current container and push it to the specified registry.

name: Build and deploy a container image to Azure Web Apps

on:
push:
branches:
- <your-branch-name>

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@main

-name: Authenticate using a Service Principal
uses: azure/actions/login@v1
with:
creds: ${{ secrets.AZURE_SP }}

- uses: azure/container-actions/docker-login@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push the image tagged with the git commit hash
run: |
docker build . -t contoso/demo:${{ github.sha }}
docker push contoso/demo:${{ github.sha }}

- name: Update image tag on the Azure Web App
uses: azure/webapps-container-deploy@v1
with:
app-name: '<your-webapp-name>'
slot-name: '<your-slot-name>'
images: 'contoso/demo:${{ github.sha }}'

Using these steps your code can be safely and reliably deployed from all over the world. Azure offers great security and dependability. Integrated with the variety of other services offered by Azure allows you to have a whole collection of tools ready to build your enterprise. The flexibility of being able to choose multiple methods of deployment allows you to choose the best practices for your unique team.

In conclusion, Microsoft Azure provides a comprehensive and flexible platform for cloud deployment. With its variety of services, monitoring tools, and scalability features, it is an ideal platform for businesses of all sizes.

--

--