Road To AZ-204 - Implementing IaaS solutions

Introduction

This article's intention is to group, in a summarized way, the main skills measured in this sub-topic of the AZ-204 Certification. Docker, Azure Containers, Virtual Machines, and ARM Templates are the main components that will have their fundamentals explained here alongside a practical example.

This certification is very extensive and this article approaches only the main topics, make sure you know those components inside and out before taking the exam. Another great tip is to do exam simulators before the official exam in order to validate your knowledge.

What is the Certification AZ-204 - Developing Solutions for Microsoft Azure?

The AZ-204 - Developing Solutions for Microsoft Azure certification measures designing, building, testing, and maintaining skills of an application and/or service in a Microsoft Azure Cloud environment. It approaches, among others, those components.

  • Azure Virtual Machines
  • Azure Service Web App
  • Azure Functions
  • Azure Containers
  • Azure Storage
  • Azure AD
  • Azure Key Vault
  • Azure Managed Identities
  • Azure Redis Cache
  • Azure Logic App
  • Azure Event Grid
  • Azure Event Hub
  • Azure Notification Hub
  • Azure Service Bus
  • Azure Queue Storage
  • Cosmos DB
  • Docker

Check more information on the AZ - 204 Developing Solutions for Microsoft Azure Official Website.

Target Audience

Any IT professional willing to improve his knowledge in Microsoft Azure is encouraged to take this certification, it is a great way to measure your skills within trending technologies. But, some groups of professionals are more keen to take maximum advantage of it:

  • Azure Developers, with at least 1 year of experience in Microsoft Azure;
  • Experienced Software Developers, looking for an Architect position in a hybrid environment;
  • Software Developers, working to move applications to the cloud environment.

Skills Measured

According to the latest information as of this writing, the skills that are measured in the exam are split up as follows.

  • Develop Azure compute solutions (25-30%)
    • Implement IaaS solutions
    • Create Azure App Service Web Apps
    • Implement Azure functions
  • Develop for Azure storage (10-15%)
    • Develop solutions that use Cosmos DB storage
    • Develop solutions that use blob storage
  • Implement Azure security (15-20%)
    • Implement user authentication and authorization
    • Implement secure cloud solutions
  • Monitor, troubleshoot, and optimize Azure solutions (10-15%)
    • Integrate caching and content delivery within solutions
    • Instrument solutions to support monitoring and logging
  • Connect to and consume Azure services and third-party services (25- 30%)
    • Develop an App Service Logic App
    • Implement API Management
    • Develop event-based solutions
    • Develop message-based solutions

Updated skills can be found on the AZ - 204 Official Measured Skills Website.

Benefits of Getting Certified

The main benefit here is having a worldwide recognized certification that proves that you have knowledge of this topic. Among intrinsic and extrinsic benefits, we have:

  • Higher growth potential, as certifications, are a big plus.
  • Discounts and deals in Microsoft products and partners, like PluralSight and UpWork.
  • MCP Newsletters, with trending technologies.
  • Higher exposure on LinkedIn, as recruiters usually search for specific certifications.
  • Higher salary, you will be more valuable to your company.
  • Unique happiness when getting the result and you were approved, knowing that all your efforts were worth it.

Official Microsoft Certification Program Benefits Website.

Main Skills Measured by this Topic

What are Virtual Machines?

This topic is explained in detail in my previous articles, please check below.

What are ARM Templates?

Azure Resource Manager (ARM) Templates are templates used to manage resources inside the Azure environment, you may use those templates to create/update/delete resources in a faster way.

But how are those templates faster than going straight into Azure Portal and doing the changes from there? The main benefit from ARM templates is that you may automatize, alongside with Powershell, your template execution. With ARM Templates and Powershell, you have a very strong combination to automatize your process, as follows.

  • ARM Templates have variables that may be set from your Powershell code.
  • Use the output from one ARM template to use as input to create another.
  • Run loops or conditional statements.
  • Extend your ARM Templates with Powershell or Bash Scripts.
  • Have the same results as if you were using the Azure portal to manage your resources.

Read more about ARM Templates.

What is Docker?

Docker works as a small Virtual Machine instance and it is very powerful when we are talking about shipping, testing, running, and deploying software applications.

With Docker you abstract your infrastructure and environment variables, creating a controlled environment inside your Docker Container. Into those Docker Containers, we install the Docker Images, in which each Docker Image represents one, or a group of common, software.

Read more about Docker.

What is an Azure Container Registry?

Azure Container Registry works as a private collection of Docker Images and artifacts. It is based on the open-source Docker Registry 2.0 and it is where you manage your Images and artifacts inside Azure.

Read more about Azure Container Registry.

What is an Azure Container Instance?

Azure Container Instance is an Azure resource that provides us with a fast and quick way to deploy Docker Images into Docker Containers. It is ideal when you need to deploy single independent applications.

It is not recommended for advanced scenarios where we want to scale or orchestrate the containers. For those scenarios, it is recommended to use Azure Kubernetes Services.

Read more about Azure Containers Instances.

Provisioning VMs

There are several ways to provision Azure Virtual Machines and here we are going through the most common scenarios where we use the Azure Portal, Azure CLI, and C# with Visual Studio to provision an Azure Virtual Machine.

Provisioning through Azure Portal

The official article, below, from Microsoft, guides you through the steps to create your Virtual Machine through Azure Portal. It explains deeply each part of the Virtual Machine creation process alongside with a huge level of details about each possible option.

Ps.: you should follow the article until step 4. If you go further, the article goes in another direction.

Creating Virtual Machines through the Azure Portal.

Provisioning through Azure CLI and C#

Both topics are approached in depth in my previous article, please check below.

Provisioning Virtual Machines through Azure CLI and C#.

Configuring VMs for remote access

Access your Virtual Machine through the Azure Portal and click on Connect and then RDP.

 VMs

Enabling Just-in-Time Access

Just-in-time access allows you to configure your VM to be open for connections for a range of pre-defined times. It may be updated only while the VM is down.

Time Access

Download the RDP File

Select the IP Address that you are going to connect and the port number and then click in the button to download the RDP File.

RDP File

Edit the downloaded RDP file

Check the options given while using the RDP.

  • Set your Display configurations and colors.
  • Set your Local Resources like audio, keyboard, and devices.
  • Set your Experience, by adjusting your internet speed configuration.
  • Set Advanced features like server authentication and settings to connect from anywhere.
     Advanced features

Open the downloaded RDP file

You may see some security dialogs but it is normal, do not worry. Later, you will also be prompted to provide your username and password.

Observations

  • For Static IP Address, you may save the file and use it again for later connections;
  • For Dynamic IP Address, you need to download a new file each time you restart your VM.

Creating ARM templates

There are several ways to get your ARM templates to create resources. The most common way to start with your template is to download it from an existing resource or to start from scratch.

Downloading ARM Template from existing resource

Go to an existing resource.

Inside the Automation section, you will find the download button. Here you may select if you want to include parameters or not.

ARM Template

Creating ARM Template from scratch

Base ARM Template

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "resources": []
}
  • $schema: $schema is the schema used for the document.
  • contentVersion: is the version of your document.
  • resources: Azure Resources to be updated/created containing in this template.

Deploying ARM Templates

Make sure you have connected and selected the right subscription before executing the following steps.

Using Powershell

Deploying ARM

Using Azure CLI

az deployment group create --name azureCliTemplate --resource-group $resourceGroup --template-file $templateFile

Validating in the Azure Portal

Virtual Machine Created

Virtual Machine

Used Resource Group Deployments.

Resource Group

Publishing an image to the Azure Container Registry
 

Create the Container Registry

Through Azure Portal

Azure Container

Through Azure CLI

$resourceGroup = "sampleRG"
az acr create --resource-group $resourceGroup --name sampleRegistryContainer --sku Basic

As a result, we have a Container Registry with 0 containers on it.

Container Registry

Publish the Docker Image

First, we need the Docker Image.

Clone a repository to your machine, I used the repository below.

https://github.com/thiago-vivas/HackerNews

git clone https://github.com/thiago-vivas/HackerNews.git

Create the Docker file at the project root.

FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base 
WORKDIR /app 
EXPOSE 80 

FROM microsoft/dotnet:2.1-sdk AS build 
WORKDIR /src 
COPY ["SampleWeb/SampleWeb.csproj", "SampleWeb/"] 
RUN dotnet restore "SampleWeb/SampleWeb.csproj" 
COPY . . 
WORKDIR "/src/SampleWeb" 
RUN dotnet build "SampleWeb.csproj" -c Release -o /app 

FROM build AS publish 
RUN dotnet publish "SampleWeb.csproj" -c Release -o /app 

FROM base AS final 
WORKDIR /app 
COPY --from=publish /app . 
ENTRYPOINT ["dotnet", "SampleWeb.dll"]

Build your image

(DO NOT FORGET THE DOT AT THE END).

az acr build --registry sampleRegistryContainer --image sampleimage .

 DOT

Window

Check the result in the Azure Portal.

 Result

Running containers by using Azure Container Instance

After having the image in the container registry, it is very easy to create the container as follows.

az container create --resource-group <yourResourceGroup> --name mysamplecontainer --image sampleregistrycontainer.azurecr.io/sampleimage:latest  --registry-login-server sampleregistrycontainer.azurecr.io --registry-username <username> --registry-password <password>

Azure CLI available options to create your container.

Creating container images for solutions by using Docker

Build your image using Docker Command. You must be in the project root directory.

docker build --tag sampleimage:1.0 .

 Docker Command

Validate the image creation.

docker image ls

Validate the image

Create the docker container based on the previous Docker Image.

docker run --publish 8000:8080 --detach --name samplecontainer sampleimage:1.0

Check running containers on your Docker.

docker ps

Docker

Docker available options to manage your container.

External References