Skip to content

Commit 051afa8

Browse files
author
sivakami
committed
create storage account.
1 parent 631c6a1 commit 051afa8

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

.pipelines/swiftv2-long-running/scripts/create_storage.sh

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,30 @@ RG=$3
99
RAND=$(openssl rand -hex 4)
1010
SA1="sa1${RAND}"
1111
SA2="sa2${RAND}"
12-
API_VER="2025-06-01"
12+
13+
# Set subscription context
14+
az account set --subscription "$SUBSCRIPTION_ID"
1315

1416
# Create storage accounts
1517
for SA in "$SA1" "$SA2"; do
1618
echo "==> Creating storage account $SA"
17-
az rest --method put \
18-
--url "https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RG/providers/Microsoft.Storage/storageAccounts/$SA?api-version=$API_VER" \
19-
--body "{
20-
\"location\": \"$LOCATION\",
21-
\"sku\": { \"name\": \"Standard_LRS\" },
22-
\"kind\": \"StorageV2\",
23-
\"properties\": {
24-
\"minimumTlsVersion\": \"TLS1_2\",
25-
\"allowBlobPublicAccess\": false,
26-
\"allowSharedKeyAccess\": false
27-
}
28-
}" \
19+
az storage account create \
20+
--name "$SA" \
21+
--resource-group "$RG" \
22+
--location "$LOCATION" \
23+
--sku Standard_LRS \
24+
--kind StorageV2 \
25+
--allow-blob-public-access false \
26+
--https-only true \
27+
--min-tls-version TLS1_2 \
28+
--query "name" -o tsv \
2929
&& echo "Storage account $SA created successfully."
3030
done
3131

3232
echo "All storage accounts created successfully."
33+
34+
# Set pipeline output variables
3335
set +x
34-
echo "##vso[task.setvariable variable=StorageAccount1;isOutput=true]$SA1"
35-
echo "##vso[task.setvariable variable=StorageAccount2;isOutput=true]$SA2"
36+
echo "##vso[task.setvariable variable=StorageAccount1;isOutput=true]$SA1"
37+
echo "##vso[task.setvariable variable=StorageAccount2;isOutput=true]$SA2"
3638
set -x

0 commit comments

Comments
 (0)