Authenticate To Azure : Implementation Guide

For this you need to have Azure CLI installed already.

Step 1: Open terminal on your computer, any terminal will work as we have use azure cli.

Step 2: Run the below command and follow the instructions if you haven’t did the login yet.

Syntax

az login

Step 3: To confirm the login run az account show.

Syntax

az account show

Output: The output will be similar to this.

Step 4: Save the id (below homeTenantId ) from the output as it is subscription id and you will need that while creating service principal later.

How to Create Windows VM in Azure Using Terraform

In this article, we will cover the whole process of creating Windows VM in Azure using Terraform. When you have to create multiple VMs, perhaps even identical ones, or machines with nearly identical configurations, it can be repetitive and time-consuming to go through the manual setup process each time. That’s where Terraform comes in. Think of it as a blueprint for building VMs without the need for manual work, reducing errors and saving you valuable time. Let’s first see what virtual machines, azure, and Terraform are.

Similar Reads

What Is Azure?

Azure is a cloud computing platform provided by Microsoft and is fully known as Microsoft Azure. Azure provides a lot of computing services through the cloud which are easily available and are cost effective. This platform provides a wide variety of services like storage, Virtual Machines, databases, AI, Machine Learning, Virtual Networks, functions, and the list goes on and on. If you want to learn more about Azure you can visit its official website or visit our GFG Microsoft Azure Tutorial Page....

What Is Terraform?

Terraform is an Infrastructure as Code(IaC) software tool which is open source and is provided by HashiCorp. You need to write code i.e. a configuration file ( written in HashiCorp Configuration Language – HCL ) for what you want to build and Terraform builds that exactly as told....

How To Create Windows VM In Azure Using Terraform? A Step-By-Step Guide

This Whole tutorial is divided into parts so if you have any part already configured then you can skip that part....

Authenticate To Azure : Implementation Guide

For this you need to have Azure CLI installed already....

Create Service Principal : Implementation Guide

We create service principals to use it instead of doing Sign In every time while using automation tools like terraform....

Saving Credentials In Environment

Save the credential in environment variables so that when we’ll write the configuration file then we don’t need to put the credentials explicitly and this will be secure way....

Method 1: Save credentials in Linux

Step 1: Open your terminal....

Method 2: Save Credentials In Windows

Step 1: Open PowerShell....

Create Terraform Configuration Files

All the code provided for the configuration files is provided by Microsoft Azure. So copy and paste code as it is and don’t change it you don’t know what you are doing....

Creating Virtual Machine

Step 1: Open a terminal either Linux Terminal or PowerShell in windows operating system and remember to be in the folder where you created the terraform configuration files....

Delete Resources In Azure Using Terraform

When you don’t need the resources which you created using the terraform you can clear them....

Conclusion

So now you know how to create windows Virtual machine using Azure terraform. The steps can be used to create as many virtual machines as you want, and not only for windows but whatever available operating system, you need to specify that in the terraform configuration files. Terraform is a great way for doing stuffs like this and is great tool for DevOps. While there are other options also to create a virtual machine in Azure like manually creating it using Azure Portal....

Creating VM In Azure Using Terraform – FAQ’s

Why Use Terraform To Create Virtual Machine When It Can Created Manually Using Azure Portal?...