Skip to content

Commit 5f7962b

Browse files
Merge pull request #366 from microsoft/fix/handled-exceptions-in-the-scripts
fix: improvement to error handling in the script
2 parents 1f9b5cc + 1620926 commit 5f7962b

File tree

2 files changed

+8
-93
lines changed

2 files changed

+8
-93
lines changed

scripts/quota_check_all_regions.sh

-92
This file was deleted.

scripts/quota_check_params.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ echo "🔄 Fetching available Azure subscriptions..."
1010
SUBSCRIPTIONS=$(az account list --query "[?state=='Enabled'].{Name:name, ID:id}" --output tsv)
1111
SUB_COUNT=$(echo "$SUBSCRIPTIONS" | wc -l)
1212

13-
if [ "$SUB_COUNT" -eq 1 ]; then
13+
if [ "$SUB_COUNT" -eq 0 ]; then
14+
echo "❌ ERROR: No active Azure subscriptions found. Please log in using 'az login' and ensure you have an active subscription."
15+
exit 1
16+
elif [ "$SUB_COUNT" -eq 1 ]; then
1417
# If only one subscription, automatically select it
1518
AZURE_SUBSCRIPTION_ID=$(echo "$SUBSCRIPTIONS" | awk '{print $2}')
19+
if [ -z "$AZURE_SUBSCRIPTION_ID" ]; then
20+
echo "❌ ERROR: No active Azure subscriptions found. Please log in using 'az login' and ensure you have an active subscription."
21+
exit 1
22+
fi
1623
echo "✅ Using the only available subscription: $AZURE_SUBSCRIPTION_ID"
1724
else
1825
# If multiple subscriptions exist, prompt the user to choose one

0 commit comments

Comments
 (0)