Azure Authetication
To use Terraform commands against your Azure subscription, you must first authenticate Terraform to that subscription. This article covers common DevOps scenarios for authenticating to Azure securely
Bash (Azure CLI): Create a Service Principal for Terraform
az loginexport MSYS_NO_PATHCONV=1az ad sp create-for-rbac --name <service_principal_name> --role Contributor --scopes /subscriptions/<subscription_id>export ARM_CLIENT_ID="<appId>" export ARM_CLIENT_SECRET="<password>" export ARM_SUBSCRIPTION_ID="<subscription_id>" export ARM_TENANT_ID="<tenant>"provider "azurerm" { features {} client_id = var.client_id client_secret = var.client_secret subscription_id = var.subscription_id tenant_id = var.tenant_id }
PowerShell: Create a Service Principal for Terraform
Real-Life DevOps Example: GitHub Actions with Azure
Best Practices
References
Last updated