-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-VMs_script.sh
More file actions
executable file
·42 lines (32 loc) · 1.12 KB
/
deploy-VMs_script.sh
File metadata and controls
executable file
·42 lines (32 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Script to deploy a resource group and vm file (multiple or single,just configure), validate too
# ==== CONFIGURATION ====
RESOURCE_GROUP="vmFleetCommander"
LOCATION="westus"
BICEP_FILE="main.bicep"
PARAMETER_FILE="test.parameters.json"
# .bicepparam file input is not supported in az CLI (only Bicep CLI)
# ==== PARAMETERS ====
ADMIN_PASSWORD="<yourSecurePassword>" # Or use read -s to securely prompt
read -s -p "Enter admin password: " ADMIN_PASSWORD
echo
# ==== LOGIN (Optional if already logged in) ====
# az login
# ==== CREATE RESOURCE GROUP (idempotent) ====
az group create \
--name $RESOURCE_GROUP \
--location $LOCATION
# # === VALIDATE BICEP AND PARAM FILES ===
# az deployment group validate \
# --resource-group "$RESOURCE_GROUP" \
# --template-file main.bicep \
# --parameters @"$PARAMETER_FILE" adminPassword="$ADMIN_PASSWORD"
echo "Validated the files"
==== DEPLOY BICEP FILE ====
az deployment group create \
--resource-group $RESOURCE_GROUP \
--template-file $BICEP_FILE \
--parameters @"$PARAMETER_FILE" \
adminPassword=$ADMIN_PASSWORD
# ==== DONE ====
echo "✅ Deployment complete"