-
Notifications
You must be signed in to change notification settings - Fork 99
/
azure-deploy.sh
executable file
·51 lines (44 loc) · 1.46 KB
/
azure-deploy.sh
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
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -euo pipefail
# Load values from .env file or create it if it doesn't exists
FILE=".env"
if [[ -f $FILE ]]; then
echo "Loading from $FILE"
eval $(egrep "^[^#;]" $FILE | tr '\n' '\0' | xargs -0 -n1 | sed 's/^/export /')
else
cat << EOF > .env
resourceGroup=""
appName=""
location=""
# Connection string
azureSQL='Server=tcp:.database.windows.net,1433;Initial Catalog=todo_v6;Persist Security Info=False;User ID=webapp;Password=Super_Str0ng*P4ZZword!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;'
gitSource="https://github.com/Azure-Samples/azure-sql-db-fullstack-serverless-kickstart"
gitToken=""
EOF
echo "Enviroment file not detected."
echo "Please configure values for your environment in the created .env file"
echo "and run the script again."
exit 1
fi
echo "Creating Resource Group...";
az group create \
-n $resourceGroup \
-l $location
echo "Deploying Static Web App...";
az deployment group create \
--name "swa-deploy-6.0" \
--resource-group $resourceGroup \
--template-file azure-deploy.arm.json \
--parameters \
name=$appName \
location=$location \
repositoryToken=$gitToken \
repositoryUrl=$gitSource \
branch="v6.0" \
appLocation="./client" \
apiLocation="./api" \
azureSQL="$azureSQL"
echo "Getting Static Web App...";
dhn=`az staticwebapp show -g $resourceGroup -n $appName --query "defaultHostname"`
echo "Static Web App created at: $dhn";
echo "Done."