Azure Virtual Machines provide a flexible and scalable solution for running your applications in the cloud. By leveraging Terraform, we can automate the creation and configuration of VMs, ensuring consistency and reproducibility in our deployments. We will specifically focus on Linux VMs, as they are widely used for various purposes, such as web hosting, application deployment, and data analysis.

azurevmter.png

In this article, we will go through the steps to create an Azure Virtual machine with the following resources: Azure Resource Group, Azure Virtual Network, Network Subnet, Public IP address, Network Security Group, Network Interface, Linux Virtual Machine.

Prerequisites

Install and Configure Azure CLI

Install and Configure Terraform

Provision the Infrastructure on Azure

Destroy the infrastructure

Conclusion

Prerequisites

Terraform is a declarative open-source “Infrastructure as Code” tool, created by HashiCorp, that enables the definition of on-premises and cloud resources in human-readable configuration files that can be versioned, reused, and shared as code.

Install and Configure Azure CLI

Open a command line from any device that has access to the Azure CLI. For steps on how to configure azure CLI locally, refer to this Microsoft Documentation.

sudo apt update
curl -sL <https://aka.ms/InstallAzureCLIDeb> | sudo bash

Run the command az --version to confirm this has been installed successfully.

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l60gg805gs2w91x93ym0.png

AZ-Login

Powered by Fruition