Demo for terraform on Azure
Connect-AzAccount
Get-AzSubscription
Set-AzContext -Subscription "Visual Studio Professional-abonnement"
$sp = New-AzADServicePrincipal -DisplayName sp_terraform New-AzADServicePrincipal: Insufficient privileges to complete the operation.
$sp.ApplicationId
Storage account for Terraform az group create -n dev-terraform-backend-rg -l westeurope
az storage account create --resource-group dev-terraform-backend-rg --name devterraformbackendsa --sku Standard_LRS --encryption-services blob
ACCOUNT_KEY=$(az storage account keys list --resource-group dev-terraform-backend-rg --account-name devterraformbackendsa --query [0].value -o tsv)
az storage container create --name terraform-backend-files --account-name devterraformbackendsa --account-key $ACCOUNT_KEY
terraform init -backend-config="terraform-backend.secrets"
terraform validate
terraform plan -out test-create.plan
terraform apply test-create.plan
terraform plan -destroy -out test-destroy.plan
terraform apply test-destroy.plan