Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 1.32 KB

README.md

File metadata and controls

50 lines (38 loc) · 1.32 KB

azure-examples-2024

How to Use

Write out your IDs and information in the .env file

If you have an old .env file, you are able to reset it by removing it.

rm -f .env

ℹ️ If you are using Linux, write out UID, GID, and GID for the docker group, into the .env file to let that as exported on Docker Compose as environment variables.

test $(uname -s) = 'Linux' && {
  echo -e "DOCKER_GID=$(getent group docker | cut -d : -f 3)"
  echo -e "GID=$(id -g)"
  echo -e "UID=$(id -u)"
} >> .env || :
echo "ARM_SUBSCRIPTION_ID=YOUR_SUBSCRIPTION" >> .env
echo "ARM_CLIENT_ID=$(jq -r .appId examples/iac/config/credentials/azure-service-principal.provisioning-owner)" >> .env
echo "ARM_CLIENT_SECRET=$(jq -r .password examples/iac/config/credentials/azure-service-principal.provisioning-owner)" >> .env
echo "ARM_TENANT_ID=$(jq -r .tenant examples/iac/config/credentials/azure-service-principal.provisioning-owner)" >> .env
echo "AZURE_DEFAULT_LOCATION=YOUR_REGION" >> .env
echo "ENV_UNIQUE_ID=YOUR_ID_STRING" >> .env

Start the container

docker compose up
docker compose exec iac zsh -l
az login --service-principal\
 --username "${ARM_CLIENT_ID}"\
 --password "${ARM_CLIENT_SECRET}"\
 --tenant "${ARM_TENANT_ID}"