forked from Welasco/Bicep
-
Notifications
You must be signed in to change notification settings - Fork 15
/
deploy.azcli
27 lines (20 loc) · 895 Bytes
/
deploy.azcli
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
baseline='Contoso'
location='westus'
# Create Base64 script value
script64=$(cat script.sh | base64)
# Generate and SSH key pair to pass the public key as parameter
ssh-keygen -m PEM -t rsa -b 4096 -C '' -f ./jbsshkey.pem
pubkeydata=$(cat jbsshkey.pem.pub)
# Create / Update the deployment (replace AAD Group ID)
az deployment sub create -n $baseline'Dep' -l $location -f main.bicep \
--parameters baseName=$baseline \
--parameters script64=$script64 \
--parameters pubkeydata=$pubkeydata \
--parameters aadGroupdIds='("e822cf30-7f5e-4968-a215-5cc48d538580")'
# Attach ACR, grab the ACR name
az aks update -n $baseline'aks' -g $baseline'-RG' --attach-acr '...ACR Name...'
# Get AKS Credentials
az aks get-credentials -n $baseline'aks' -g $baseline'-RG'
# Cleanup. Delete the RG and Deployment
az group delete -g $baseline'-RG' -y
az deployment sub delete -n $baseline'Dep'