Skip to content

Commit 83d3b7d

Browse files
Use Azure STORAGE_ACCOUNT_NAME env if set during init-vhd
Update docs
1 parent c64f5ff commit 83d3b7d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/book/src/capi/providers/azure.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ These images are designed for use with [Cluster API Provider Azure]([Cluster API
77
- An Azure account
88
- The Azure CLI installed and configured
99
- Set environment variables for `AZURE_SUBSCRIPTION_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`
10+
- Set optional environment variables `RESOURCE_GROUP_NAME`, `STORAGE_ACCOUNT_NAME` & `AZURE_LOCATION` to override the default values
1011

1112
## Building Images
1213

images/capi/packer/azure/scripts/init-vhd.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
echo "Sign into Azure"
66
tracestate="$(shopt -po xtrace)"
77
set +o xtrace
8-
az login --service-principal -u ${AZURE_CLIENT_ID} -p ${AZURE_CLIENT_SECRET} --tenant ${AZURE_TENANT_ID} >/dev/null 2>&1
9-
az account set -s ${AZURE_SUBSCRIPTION_ID} >/dev/null 2>&1
8+
az login --service-principal -u ${AZURE_CLIENT_ID} -p ${AZURE_CLIENT_SECRET} --tenant ${AZURE_TENANT_ID} >/dev/null 2>&1
9+
az account set -s ${AZURE_SUBSCRIPTION_ID} >/dev/null 2>&1
1010
eval "$tracestate"
1111

1212
echo "Create storage account"
@@ -15,7 +15,7 @@ export AZURE_LOCATION="${AZURE_LOCATION:-southcentralus}"
1515
az group create -n ${RESOURCE_GROUP_NAME} -l ${AZURE_LOCATION} --tags ${TAGS:-}
1616
CREATE_TIME="$(date +%s)"
1717
RANDOM_SUFFIX="$(head /dev/urandom | LC_ALL=C tr -dc a-z | head -c 4 ; echo '')"
18-
export STORAGE_ACCOUNT_NAME="capi${CREATE_TIME}${RANDOM_SUFFIX}"
18+
export STORAGE_ACCOUNT_NAME="${STORAGE_ACCOUNT_NAME:-capi${CREATE_TIME}${RANDOM_SUFFIX}}"
1919
az storage account check-name --name ${STORAGE_ACCOUNT_NAME}
2020
az storage account create -n ${STORAGE_ACCOUNT_NAME} -g ${RESOURCE_GROUP_NAME}
2121

0 commit comments

Comments
 (0)