Introduction
Our previous article taught us how to set up Terraform on our computers to start the coding. In this article, we will learn how to Define Provider and Integrate Azure AD to Terraform.
Step 1. Go to the Terraform website, select the provider, and then select use provider. To visit the Azure provider, click here.
![Azure AD to Terraform]()
Step 2. Click the Use Provider button and copy the How to use this Provider script.
![Azure AD to Terraform]()
Step 3. Open the Visual Studio Code and click the main.tf file and Past it.
![Azure AD to Terraform]()
Step 4. Now we must provide our subscription id, client id, client secret, and tenant id under the provider.
![Azure AD to Terraform]()
Step 5. Open the Azure portal and go to the Azure Active Directory, click App registration under Manage, then click + New registration.
![Azure AD to Terraform]()
Step 6. Enter the name of the application and click Register.
![Azure AD to Terraform]()
Step 7. We must provide permission to the subscriptions, click Access Control (IAM), and click + Add.
![Azure AD to Terraform]()
Step 8. Select the privileged administrator role, click Owner access, and click Next.
![Azure AD to Terraform]()
Step 9. Click + Select members, then Select the Article-Terraform, then Select and Assign it.
![Azure AD to Terraform]()
Step 10. To obtain the subscription id, go to the Subscription and copy the Subscription ID, and paste it into the subscription_id part.
![Azure AD to Terraform]()
Step 11. To obtain the Client ID and the Tenant ID, go to the Azure Active Directory, click App Registration under Manage, and select the application.
![Azure AD to Terraform]()
Step 12. Copy and paste the Application (Client) ID and Directory (tenant) ID to the Terraform code.
![Azure AD to Terraform]()
Step 13. To obtain the Client Secret, go to the certificates & secrets on the Article-Terraform and click + New Client Secret.
![Azure AD to Terraform]()
Step 14. Enter the secret's name in the Description box and click Add.
![Azure AD to Terraform]()
Step 15. Copy the Value for your reference and paste it into the client_secret.
![Azure AD to Terraform]()
Step 16. We have successfully added the provider for Azure integration to our Terraform script.
![Azure AD to Terraform]()
Summary
In this article, we learned how to configure the provider details to our Terraform script; in our next article, we will start to deploy the Azure Infrastructures step by step.