Save credentials in Linux
Step 1: Open your terminal.
Step 2: Then go to home directory by using cd command.
Syntax
cd ~
Step 3: Then type ls -a to find the .bashrc file. .bashrc file is a hidden file and is the home directory.
Syntax
ls -a
Step 4: Then type vim .bashrc and press enter to open the file.
Syntax
vim .bashrc
Step 5: Enter the below code in the file and replace all the fields with your data which you got after creating service principal and then save the file.
Syntax:
export ARM_SUBSCRIPTION_ID="<azure_subscription_id>"
export ARM_TENANT_ID="<azure_subscription_tenant_id>"
export ARM_CLIENT_ID="<service_principal_appid>"
export ARM_CLIENT_SECRET="<service_principal_password>"
Example
export ARM_SUBSCRIPTION_ID="12345678-1234-1234-1234-123456789abc"
export ARM_TENANT_ID="abcdefgh-abcd-abcd-abcd-abcdefghijkl"
export ARM_CLIENT_ID="ab12cd34-5678-9012-3456-7890abcdef12"
export ARM_CLIENT_SECRET="my_secret_password123"
Step 6: Now execute the commands that you just saved in the .bashrc file by using following command.
Syntax
. ~/.bashrc
( or )
source ~/.bashrc
Step 6: Verify if your credentials are saved by using below command and you will see the credentials which you just saved will be printed as output.
Syntax
printenv | grep ^ARM*
Output
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.