Skip to content

Commit 8bd4d97

Browse files
Replace azlocal with az (#64)
* Replace azlocal with az * Fix prefix in function-app-service-bus/dotnet/scripts/deploy.sh
1 parent 454d6e1 commit 8bd4d97

67 files changed

Lines changed: 919 additions & 1288 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

samples/aci-blob-storage/python/bicep/deploy.sh

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ SUBSCRIPTION_NAME=$(az account show --query name --output tsv)
1616
CURRENT_DIR="$(cd "$(dirname "$0")" && pwd)"
1717
IMAGE_NAME="vacation-planner"
1818
IMAGE_TAG="v1"
19-
ENVIRONMENT=$(az account show --query environmentName --output tsv)
2019

2120
echo "=================================================="
2221
echo "DEBUG: Starting bicep deployment for aci-blob-storage"
@@ -26,26 +25,16 @@ echo "=================================================="
2625

2726
# Change the current directory to the script's directory
2827
cd "$CURRENT_DIR" || exit
29-
30-
# Choose the appropriate CLI based on the environment
31-
if [[ $ENVIRONMENT == "LocalStack" ]]; then
32-
echo "Using azlocal for LocalStack emulator environment."
33-
AZ="azlocal"
34-
else
35-
echo "Using standard az for AzureCloud environment."
36-
AZ="az"
37-
fi
38-
3928
# Validates if the resource group exists in the subscription, if not creates it
4029
echo "Checking if resource group [$RESOURCE_GROUP_NAME] exists in the subscription [$SUBSCRIPTION_NAME]..."
41-
$AZ group show --name $RESOURCE_GROUP_NAME &>/dev/null
30+
az group show --name $RESOURCE_GROUP_NAME &>/dev/null
4231

4332
if [[ $? != 0 ]]; then
4433
echo "No resource group [$RESOURCE_GROUP_NAME] exists in the subscription [$SUBSCRIPTION_NAME]"
4534
echo "Creating resource group [$RESOURCE_GROUP_NAME] in the subscription [$SUBSCRIPTION_NAME]..."
4635

4736
# Create the resource group
48-
$AZ group create \
37+
az group create \
4938
--name $RESOURCE_GROUP_NAME \
5039
--location $LOCATION \
5140
--only-show-errors 1>/dev/null
@@ -68,29 +57,29 @@ fi
6857
# Create ACR first so we can push the image
6958
ACR_NAME="${PREFIX}aciacr${SUFFIX}"
7059
echo "Creating ACR [$ACR_NAME] for image push..."
71-
$AZ acr create \
60+
az acr create \
7261
--name "$ACR_NAME" \
7362
--resource-group "$RESOURCE_GROUP_NAME" \
7463
--location "$LOCATION" \
7564
--sku Basic \
7665
--admin-enabled true \
7766
--only-show-errors 1>/dev/null
7867

79-
LOGIN_SERVER=$($AZ acr show \
68+
LOGIN_SERVER=$(az acr show \
8069
--name "$ACR_NAME" \
8170
--resource-group "$RESOURCE_GROUP_NAME" \
8271
--query "loginServer" \
8372
--output tsv \
8473
--only-show-errors)
8574

86-
ACR_USERNAME=$($AZ acr credential show \
75+
ACR_USERNAME=$(az acr credential show \
8776
--name "$ACR_NAME" \
8877
--resource-group "$RESOURCE_GROUP_NAME" \
8978
--query "username" \
9079
--output tsv \
9180
--only-show-errors)
9281

93-
ACR_PASSWORD=$($AZ acr credential show \
82+
ACR_PASSWORD=$(az acr credential show \
9483
--name "$ACR_NAME" \
9584
--resource-group "$RESOURCE_GROUP_NAME" \
9685
--query "passwords[0].value" \
@@ -130,7 +119,7 @@ if [[ $VALIDATE_TEMPLATE == 1 ]]; then
130119
if [[ $USE_WHAT_IF == 1 ]]; then
131120
# Execute a deployment What-If operation at resource group scope.
132121
echo "Previewing changes deployed by Bicep template [$TEMPLATE]..."
133-
$AZ deployment group what-if \
122+
az deployment group what-if \
134123
--resource-group $RESOURCE_GROUP_NAME \
135124
--template-file $TEMPLATE \
136125
--parameters $PARAMETERS \
@@ -148,7 +137,7 @@ if [[ $VALIDATE_TEMPLATE == 1 ]]; then
148137
else
149138
# Validate the Bicep template
150139
echo "Validating Bicep template [$TEMPLATE]..."
151-
output=$($AZ deployment group validate \
140+
output=$(az deployment group validate \
152141
--resource-group $RESOURCE_GROUP_NAME \
153142
--template-file $TEMPLATE \
154143
--parameters $PARAMETERS \
@@ -169,7 +158,7 @@ fi
169158

170159
# Deploy the Bicep template
171160
echo "Deploying Bicep template [$TEMPLATE]..."
172-
if DEPLOYMENT_OUTPUTS=$($AZ deployment group create \
161+
if DEPLOYMENT_OUTPUTS=$(az deployment group create \
173162
--resource-group $RESOURCE_GROUP_NAME \
174163
--only-show-errors \
175164
--template-file $TEMPLATE \

samples/aci-blob-storage/python/scripts/cleanup.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ ACI_GROUP_ADVANCED="${PREFIX}-aci-planner-advanced"
1515
KEY_VAULT_NAME="${PREFIX}acikv"
1616
ACR_NAME="${PREFIX}aciacr"
1717
STORAGE_ACCOUNT_NAME="${PREFIX}acistorage"
18-
ENVIRONMENT=$(az account show --query environmentName --output tsv)
1918

2019
# Choose the appropriate CLI based on the environment
2120
if [[ $ENVIRONMENT == "LocalStack" ]]; then
@@ -31,13 +30,13 @@ echo ""
3130

3231
# 1. Delete ACI container groups (basic + advanced)
3332
echo "[1/5] Deleting ACI container groups..."
34-
$AZ container delete \
33+
az container delete \
3534
--name "$ACI_GROUP_NAME" \
3635
--resource-group "$RESOURCE_GROUP_NAME" \
3736
--yes \
3837
--only-show-errors 2>/dev/null && echo " Deleted: $ACI_GROUP_NAME" || echo " Skipped: $ACI_GROUP_NAME (not found)"
3938

40-
$AZ container delete \
39+
az container delete \
4140
--name "$ACI_GROUP_ADVANCED" \
4241
--resource-group "$RESOURCE_GROUP_NAME" \
4342
--yes \
@@ -46,7 +45,7 @@ echo ""
4645

4746
# 2. Delete ACR
4847
echo "[2/5] Deleting ACR [$ACR_NAME]..."
49-
$AZ acr delete \
48+
az acr delete \
5049
--name "$ACR_NAME" \
5150
--resource-group "$RESOURCE_GROUP_NAME" \
5251
--yes \
@@ -55,18 +54,18 @@ echo ""
5554

5655
# 3. Delete Key Vault (delete + purge to release the vault name)
5756
echo "[3/5] Deleting Key Vault [$KEY_VAULT_NAME]..."
58-
$AZ keyvault delete \
57+
az keyvault delete \
5958
--name "$KEY_VAULT_NAME" \
6059
--resource-group "$RESOURCE_GROUP_NAME" \
6160
--only-show-errors 2>/dev/null && echo " Deleted: $KEY_VAULT_NAME" || echo " Skipped: $KEY_VAULT_NAME (not found)"
62-
$AZ keyvault purge \
61+
az keyvault purge \
6362
--name "$KEY_VAULT_NAME" \
6463
--only-show-errors 2>/dev/null && echo " Purged: $KEY_VAULT_NAME" || true
6564
echo ""
6665

6766
# 4. Delete Storage Account
6867
echo "[4/5] Deleting Storage Account [$STORAGE_ACCOUNT_NAME]..."
69-
$AZ storage account delete \
68+
az storage account delete \
7069
--name "$STORAGE_ACCOUNT_NAME" \
7170
--resource-group "$RESOURCE_GROUP_NAME" \
7271
--yes \
@@ -75,7 +74,7 @@ echo ""
7574

7675
# 5. Delete Resource Group
7776
echo "[5/5] Deleting Resource Group [$RESOURCE_GROUP_NAME]..."
78-
$AZ group delete \
77+
az group delete \
7978
--name "$RESOURCE_GROUP_NAME" \
8079
--yes \
8180
--only-show-errors 2>/dev/null && echo " Deleted: $RESOURCE_GROUP_NAME" || echo " Skipped: $RESOURCE_GROUP_NAME (not found)"

samples/aci-blob-storage/python/scripts/deploy.sh

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,18 @@ ACI_GROUP_NAME="${PREFIX}-aci-planner"
2222
IMAGE_NAME="vacation-planner"
2323
IMAGE_TAG="v1"
2424
LOGIN_NAME="paolo"
25-
ENVIRONMENT=$(az account show --query environmentName --output tsv)
2625
CURRENT_DIR="$(cd "$(dirname "$0")" && pwd)"
2726

2827
# Change the current directory to the script's directory
2928
cd "$CURRENT_DIR" || exit
30-
31-
# Choose the appropriate CLI based on the environment
32-
if [[ $ENVIRONMENT == "LocalStack" ]]; then
33-
echo "Using azlocal for LocalStack emulator environment."
34-
AZ="azlocal"
35-
else
36-
echo "Using standard az for AzureCloud environment."
37-
AZ="az"
38-
fi
39-
4029
# =============================================================================
4130
# Step 1: Create Resource Group
4231
# =============================================================================
4332
echo ""
4433
echo "============================================================"
4534
echo "Step 1: Creating resource group [$RESOURCE_GROUP_NAME]..."
4635
echo "============================================================"
47-
$AZ group create \
36+
az group create \
4837
--name $RESOURCE_GROUP_NAME \
4938
--location $LOCATION \
5039
--only-show-errors 1>/dev/null
@@ -63,7 +52,7 @@ echo ""
6352
echo "============================================================"
6453
echo "Step 2: Creating storage account [$STORAGE_ACCOUNT_NAME]..."
6554
echo "============================================================"
66-
$AZ storage account create \
55+
az storage account create \
6756
--name $STORAGE_ACCOUNT_NAME \
6857
--location $LOCATION \
6958
--resource-group $RESOURCE_GROUP_NAME \
@@ -84,7 +73,7 @@ echo ""
8473
echo "============================================================"
8574
echo "Step 3: Retrieving storage account key..."
8675
echo "============================================================"
87-
STORAGE_ACCOUNT_KEY=$($AZ storage account keys list \
76+
STORAGE_ACCOUNT_KEY=$(az storage account keys list \
8877
--account-name $STORAGE_ACCOUNT_NAME \
8978
--resource-group $RESOURCE_GROUP_NAME \
9079
--query "[0].value" \
@@ -104,7 +93,7 @@ echo ""
10493
echo "============================================================"
10594
echo "Step 4: Retrieving storage blob endpoint..."
10695
echo "============================================================"
107-
BLOB_ENDPOINT=$($AZ storage account show \
96+
BLOB_ENDPOINT=$(az storage account show \
10897
--name $STORAGE_ACCOUNT_NAME \
10998
--resource-group $RESOURCE_GROUP_NAME \
11099
--query "primaryEndpoints.blob" \
@@ -142,7 +131,7 @@ echo "Step 5: Creating blob container [$BLOB_CONTAINER_NAME]..."
142131
echo "============================================================"
143132
# Use --connection-string to ensure the correct endpoint is used
144133
# (--account-name constructs its own hostname which may not match LocalStack's cert)
145-
$AZ storage container create \
134+
az storage container create \
146135
--name $BLOB_CONTAINER_NAME \
147136
--connection-string "$STORAGE_CONN_STRING" \
148137
--only-show-errors 1>/dev/null
@@ -161,7 +150,7 @@ echo ""
161150
echo "============================================================"
162151
echo "Step 6: Creating Key Vault [$KEY_VAULT_NAME]..."
163152
echo "============================================================"
164-
KV_OUTPUT=$($AZ keyvault create \
153+
KV_OUTPUT=$(az keyvault create \
165154
--name "$KEY_VAULT_NAME" \
166155
--resource-group "$RESOURCE_GROUP_NAME" \
167156
--location "$LOCATION" \
@@ -186,7 +175,7 @@ echo "============================================================"
186175
echo "Step 7: Storing storage connection string in Key Vault..."
187176
echo "============================================================"
188177
# Store the container-friendly connection string so ACI can reach LocalStack
189-
$AZ keyvault secret set \
178+
az keyvault secret set \
190179
--vault-name "$KEY_VAULT_NAME" \
191180
--name "storage-conn" \
192181
--value "$CONTAINER_CONN_STRING" \
@@ -200,7 +189,7 @@ else
200189
fi
201190

202191
# Retrieve secret to verify and pass to ACI
203-
RETRIEVED_CONN_STRING=$($AZ keyvault secret show \
192+
RETRIEVED_CONN_STRING=$(az keyvault secret show \
204193
--vault-name "$KEY_VAULT_NAME" \
205194
--name "storage-conn" \
206195
--query "value" \
@@ -221,7 +210,7 @@ echo ""
221210
echo "============================================================"
222211
echo "Step 8: Creating ACR [$ACR_NAME] with admin user enabled..."
223212
echo "============================================================"
224-
$AZ acr create \
213+
az acr create \
225214
--name "$ACR_NAME" \
226215
--resource-group "$RESOURCE_GROUP_NAME" \
227216
--location "$LOCATION" \
@@ -243,7 +232,7 @@ echo ""
243232
echo "============================================================"
244233
echo "Step 9: Retrieving ACR credentials..."
245234
echo "============================================================"
246-
LOGIN_SERVER=$($AZ acr show \
235+
LOGIN_SERVER=$(az acr show \
247236
--name "$ACR_NAME" \
248237
--resource-group "$RESOURCE_GROUP_NAME" \
249238
--query "loginServer" \
@@ -256,14 +245,14 @@ if [ -z "$LOGIN_SERVER" ]; then
256245
fi
257246
echo "ACR Login Server: $LOGIN_SERVER"
258247

259-
ACR_USERNAME=$($AZ acr credential show \
248+
ACR_USERNAME=$(az acr credential show \
260249
--name "$ACR_NAME" \
261250
--resource-group "$RESOURCE_GROUP_NAME" \
262251
--query "username" \
263252
--output tsv \
264253
--only-show-errors)
265254

266-
ACR_PASSWORD=$($AZ acr credential show \
255+
ACR_PASSWORD=$(az acr credential show \
267256
--name "$ACR_NAME" \
268257
--resource-group "$RESOURCE_GROUP_NAME" \
269258
--query "passwords[0].value" \
@@ -333,7 +322,7 @@ echo "Step 11: Creating ACI container group [$ACI_GROUP_NAME]..."
333322
echo "============================================================"
334323

335324
if [ "$USE_ACR_IMAGE" = true ]; then
336-
$AZ container create \
325+
az container create \
337326
--resource-group "$RESOURCE_GROUP_NAME" \
338327
--name "$ACI_GROUP_NAME" \
339328
--image "$FULL_IMAGE" \
@@ -353,7 +342,7 @@ if [ "$USE_ACR_IMAGE" = true ]; then
353342
--location "$LOCATION" \
354343
--only-show-errors 1>/dev/null
355344
else
356-
$AZ container create \
345+
az container create \
357346
--resource-group "$RESOURCE_GROUP_NAME" \
358347
--name "$ACI_GROUP_NAME" \
359348
--image "$FULL_IMAGE" \

0 commit comments

Comments
 (0)