set environment variables for Terraform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Requires jq .. to install see: https://stedolan.github.io/jq/download/ | |
# set some environment variables to use to create the service principal | |
export SUBSCRIPTION_ID=3464892e-e827-4752-bad5-b4f93c00dbbe | |
export PROJECT_NAME="wus2-azure-aks-terraform-demo" | |
az account set --subscription="${SUBSCRIPTION_ID}" | |
# create the service principal to the subscription scope and save it to an auth file | |
TF_SERVICE_PRINCIPAL=$(az ad sp create-for-rbac --skip-assignment --role 'Contributor' --name rbac-tf-$PROJECT_NAME --output json --scopes="/subscriptions/${SUBSCRIPTION_ID}") | |
export ARM_SUBSCRIPTION_ID=$SUBSCRIPTION_ID | |
export ARM_CLIENT_ID=$(echo $TF_SERVICE_PRINCIPAL | jq '.appId') | |
export ARM_CLIENT_SECRET=$(echo $TF_SERVICE_PRINCIPAL | jq '.password') | |
export ARM_TENANT_ID=$(echo $TF_SERVICE_PRINCIPAL | jq '.tenant') | |
# Not needed for public, required for usgovernment, german, china | |
export ARM_ENVIRONMENT=public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-keygen -t rsa -b 4096 -m PEM | |
# display the public key | |
cat $HOME/.ssh/id_rsa.pub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment