Configuring Azure SPN for Terraform
Log in https://portal.azure.com/ with your account.
On the left menu select:
- Azure Active Directory
- App Registrations
- + New Registration
- Name: terraform
- Who Can use this application: Accounts in this organizational directory only (Default Directory only - Single tenant)
- Register
Now on terraform:
- Certificates & Secrets
- New client secret
- Description: terraform
- Add
- Copy the value of the secret that would be on the right side ex: 8Z:s.?3pa@2zjuM4Y-JEoUdlj@w9SXfb
Now on subscriptions select your subscription.
- Access control (IAM)
- Add a role assignment
- Role: Contributor
- Assign access to: Azure AD user, group, service principal
- Select: terraform
- Save
Now we need the following. client id, client secret, tenant and subscription
- Client ID we can get on app registrations/terraform: xxxxxxxx-xxxx-xxxx-xxxx-e684b975d113
- Client secret that we generate in Certificates & Secrets: 8Z:s.?3pa@2zjuM4Y-JEoUdlj@w9SXfb
- Tenant ID we can get on app registrations/terraform: xxxxxxxx-xxxx-xxxx-xxxx-9c8a75bbff3e
- Subscription id we can get on subscriptions: xxxxxxxx-xxxx-xxxx-xxxx-62f9d45b6957