In the same directory as your .tf files are located, run
ssh-keygen -f id_rsa
Skip the passphrase.
Conduct the initialization with the following command:
terraform init
Make sure your Terraform configuration files are in the desired format, by using:
terraform fmt
Validate your Terraform configuration
terraform validate
Create a Terraform plan by running:
terraform plan -out tfplan
Deploy the Ubuntu VM on Azure executing:
terraform apply tfplan
Ensure the proper permission for the private key:
chmod 600 id_rsa
Establish a connection to the virtual machine using:
ssh -i id_rsa adminuser@<public ip address>
Destroy the Ubuntu VM on Azure executing:
terraform destroy