July 2nd, 2019 | by Arkadiusz Matecki

Automation Tool for Azure | Cloud Developer Days 2019

Table of contents

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

During the Cloud Developer Days 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).

Read also: Cloud Developer Days 2018: A New Place to Be

Automation Tools for Azure Infrastructure by Aleksandar Nikolic

Azure PowerShell – 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 knowing that the AZ module is a replacement for AzureRM and AzureRM will no longer receive new features, only bug 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 the 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, or Advanced Packaging Tool for Linux distributions like Ubuntu or Debian. In the end, I would like to say that it is possible to run Azure CLI in a 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, and Storage accounts in Azure using a declarative template. One template can deploy multiple services simultaneously or separately (one by one) in case 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.
cshark_blog_Cloud-Developer-Days-in-text-1
  • Azure Resource Manager Snippets – an easy way to create a very quickly resource in an ARM template (typing ARM phase (Figure 1), then choose what kind of resource you want to deploy and accept it. Finally the extension fills the template about all needed data to create a resource (Figure 2)).
cshark_blog_Cloud-Developer-Days-in-text-2

Figure 1

cshark_blog_Cloud-Developer-Days-in-text-3

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, can be reused, and are based on the HCL language (HashiCorp configuration language). It’s worth knowing 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 to you how to run a 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 the Azure CLI image is already downloaded (Figure 3), Docker Container starts automatically, and you will be able to sign in to Azure by using the “AZ login” command. Please note: to log in to Azure you need to authenticate yourself by typing the code on this website.

cshark_blog_CDD-in-text-4

Figure 3

Conclusion

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 with useful tips on how to deal with technical challenges.

Arkadiusz Matecki

A DevOps Engineer at CSHARK. Enthusiast of Azure Cloud, process automation and scripting. Always opened and eager on getting to know new technologies.