Cloud Developer Days 2019 - An Autoation Tool for Azure - Blog CSHARK Cloud Developer Days 2019 - An Automation Tool for Azure - Blog CSHARK

IT Ocean blog

Blog subscription

02/07/19

Cloud Developer Days 2019 - An Automation Tool for Azure

Cloud Developer Days 2019 - An Automation Tool for Azure

What kind of tools and technologies you can use to provision and manage Azure resources? It turned out that the decision could not be so easy as it could be seemed, because you can choose between imperative and declarative programming using Azure PowerShell, Azure CLI, ARM templates or even full complex tool like Terraform. Which one is best for you? Decide for yourself, reading this article.

During the conference in Krakow, I had the possibility to attend many valuable presentations covering topics like Docker, Kubernetes, and automation. Speakers included: Ricardo Castro (DevOps Engineer at Uphold Inc), Marco De Sanctis (Microsoft MVP (Dev Technologies)), Wojciech Gawroński (CEO of Pattern Match), Kamil Mrzygłód (Microsoft Azure MVP), Aleksandar Nikolic (Microsoft Azure MVP).

Automation Tools for Azure Infrastructure – interesting topic run by Aleksandar Nikolic

Azure PowerShell – is a set of cmdlets used to manage resources in Azure. The cross-platform tool is available for Windows (PowerShell 5.1), macOS (PowerShell Core 6.x and later) and Linux (PowerShell Core 6.x and later) thanks to using .Net Standard. Azure PowerShell could be used in your browser with Azure Cloud Shell. It is worth to know that AZ module is a replacement for AzureRM and AzureRM will no longer receive new features, only bugs fixing will continue. Using Azure PowerShell, you can, among others, write scripts/create automation scripts to deploy resources.

Azure CLI – is a cross-platform command-line tool/environment for managing Azure resources, or for writing scripts/to create scripts responsible for the deployment of Azure resources. Azure CLI is available both in Azure Cloud Shell and for Windows (PowerShell 5.1), macOS (PowerShell Core 6.x and later) and Linux (PowerShell Core 6.x and later). In case of using Azure Cloud Shell, the installation process is not needed, only your favorite browser is needed. In other cases, you have to install a module by using either MSI installer, PowerShell Gallery for Windows or Homebrew package manager for MacOS, Advanced Packaging Tool for Linux distribution like Ubuntu or Debian. At the end, I would like to say that it is possible to run Azure CLI in Docker container. In the next part of this article, I will show you how to do it.

Azure Resource Manager (ARM) template – is used to provision and manage resources like WebApp, VM, Storage account in Azure using a declarative template. One template can deploy multiple services simultaneously or separately (one by one) in case when services depend on each other. ARM template is very flexible and can be used multiple times not only during initial deployment, but also during updating of existing infrastructure deployment.

Writing an ARM template could be a little bit tricky, but using proper tools like Azure Portal, Microsoft Visual Studio or Microsoft Visual Studio Code could make our work easier. I strongly recommend Microsoft Visual Studio Code with a dedicated extension to write an ARM template.

  • Azure Resource Manager Tools – an easy way to manage your template.

  • Azure Resource Manager Snippets – an easy way to create very quickly resource in ARM template (typing ARM phase (Figure 1), then choose what kind of resource you want to deploy and accept it. Finally the extension fills template about all needed data to create a resource (Figure 2)).

Figure 1

Figure 2

Terraform Hashicorp - is an open source tool used to provision and manage infrastructure. The configuration is kept in a configuration file as a code. This approach allows for the versioning of the configuration file, code review or even easier cooperation between teams. The created templates are flexible, could be reused and are based on HCL language (HashiCorp configuration language). It’s worth to know that Terraform has lots of plugins (called providers), which makes Terraform a very popular tool, used not only in Azure but also in AWS, Google Cloud, Docker and so on.

Running Azure CLI in Docker Container

As I mentioned before, at the end of this article I would like to present you how to run Docker container with Azure CLI. To use Azure CLI in Docker Container you should type in only the command below for instance in PowerShell (Remember: To run the command, docker has to be installed on your computer):

docker run -it mcr.microsoft.com/azure-cli

When Azure CLI image is already downloaded (Figure 3), Docker Container starts automatically, and you will be able to sign in to Azure by using “AZ login” command. Please note: to log in to Azure you need to authenticate yourself by typing the code on this website.

Figure 3

Summary

Participation at Cloud Developer Days gave me a lot of valuable and useful knowledge and I am looking forward to the next edition. CSHARK will continue to present you useful tips on how to deal with technical challenges.

Related articles