Road To AZ-204 - Implementing IaaS solutions


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 doing 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 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;

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 on 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 informationas 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 in 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;

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 templates 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. 
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.

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.

What is an Azure Container Instance?
Azure Container Instance is an Azure resource that provides us 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.
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. 
Provisioning through Azure CLI and C#
Both topics are approached in depth in my previous article, please check below: 

Configuring VMs for remote access

Access your Virtual Machine through the Azure Portal and click on Connect and then RDP.
Road To AZ-204 - Implementing IaaS solutions
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 time. It may be updated only while the VM is down. 
Road To AZ-204 - Implementing IaaS solutions 
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. 
Road To AZ-204 - Implementing IaaS solutions
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, adjusting your internet speed configuration;
  • Set Advanced features like server authentication and settings to connect from anywhere.
Road To AZ-204 - Implementing IaaS solutions
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.
  • 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 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. 
Road To AZ-204 - Implementing IaaS solutions

Creating ARM Template from scratch

Base ARM Template 
  1. {  
  2.   "$schema""",  
  3.   "contentVersion""",  
  4.   "resources": []  
  5. }  
  • $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
Road To AZ-204 - Implementing IaaS solutions
Using Azure CLI
  1. az deployment group create --name azureCliTemplate --resource-group $resourceGroup --template-file $templateFile  
Validating in the Azure Portal
Virtual Machine Created
Road To AZ-204 - Implementing IaaS solutions
Used Resource Group Deployments 
Road To AZ-204 - Implementing IaaS solutions

Publishing an image to the Azure Container Registry

Create the Container Registry
Through Azure Portal
Road To AZ-204 - Implementing IaaS solutions
Through Azure CLI 
  1. $resourceGroup = "sampleRG"  
  2. az acr create --resource-group $resourceGroup  --name sampleRegistryContainer --sku Basic  
As a result with we have Container Registry with 0 containers on it
Road To AZ-204 - Implementing IaaS solutions

Publish the Docker Image

First, we need the Docker Image 
Clone a repository to your machine, I used the repository below 
  1. git clone  
Create the Docker file at the project root
  1. FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base  
  2. WORKDIR /app  
  3. EXPOSE 80  
  5. FROM microsoft/dotnet:2.1-sdk AS build  
  6. WORKDIR /src  
  7. COPY ["SampleWeb/SampleWeb.csproj""SampleWeb/"]  
  8. RUN dotnet restore "SampleWeb/SampleWeb.csproj"  
  9. COPY . .  
  10. WORKDIR "/src/SampleWeb"  
  11. RUN dotnet build "SampleWeb.csproj" -c Release -o /app  
  13. FROM build AS publish  
  14. RUN dotnet publish "SampleWeb.csproj" -c Release -o /app  
  16. FROM base AS final  
  17. WORKDIR /app  
  18. COPY --from=publish /app .  
  19. ENTRYPOINT ["dotnet""SampleWeb.dll"]  
Build your image 
  1. az acr build --registry sampleRegistryContainer --image sampleimage .   
Road To AZ-204 - Implementing IaaS solutions
Road To AZ-204 - Implementing IaaS solutions
Check the result in the Azure Portal
Road To AZ-204 - Implementing IaaS solutions
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
  1. az container create --resource-group <yourResourceGroup> --name mysamplecontainer --image  --registry-login-server --registry-username <username> --registry-password <password>  
Creating container images for solutions by using Docker
Build your image using Docker Command. You must be in the project root directory.
  1. docker build --tag sampleimage:1.0 .  
 Road To AZ-204 - Implementing IaaS solutions
Validate the image creation 
  1. docker image ls  
 Road To AZ-204 - Implementing IaaS solutions
Create the docker container based on the previous Docker Image
  1. docker run --publish 8000:8080 --detach --name samplecontainer sampleimage:1.0  
Check running containers on your Docker
  1. docker ps  
Road To AZ-204 - Implementing IaaS solutions 
External References