Always use modern identity-based authentication methods instead of static credentials when accessing external systems. This reduces security risks associated with credential management, rotation, and potential exposure.
Always use modern identity-based authentication methods instead of static credentials when accessing external systems. This reduces security risks associated with credential management, rotation, and potential exposure.
For Azure resources, prefer authentication methods in this order:
# Example - Using OpenID Connect for Azure authentication
terraform {
backend "azurerm" {
use_oidc = true # Enable OIDC authentication
use_azuread_auth = true # Use Azure AD authentication
tenant_id = "00000000-0000-0000-0000-000000000000" # Can be set via ARM_TENANT_ID
client_id = "00000000-0000-0000-0000-000000000000" # Can be set via ARM_CLIENT_ID
storage_account_name = "abcd1234"
container_name = "tfstate"
key = "prod.terraform.tfstate"
}
}
When executing commands or generating credentials:
environment
parameter for variable substitution# Generate a secure password with compatible special characters
ephemeral "random_password" "db_password" {
length = 16
special = true
override_special = "!#$%&*()-_=+[]{}<>:?"
}
Enter the URL of a public GitHub repository