Skip to content

Commit 7e39302

Browse files
committed
improved script
1 parent aba1731 commit 7e39302

File tree

2 files changed

+78
-9
lines changed

2 files changed

+78
-9
lines changed

azure-deploy.arm.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"name": {
6+
"type": "string"
7+
},
8+
"location": {
9+
"type": "string"
10+
},
11+
"repositoryUrl": {
12+
"type": "string"
13+
},
14+
"branch": {
15+
"type": "string"
16+
},
17+
"repositoryToken": {
18+
"type": "securestring"
19+
},
20+
"appLocation": {
21+
"type": "string"
22+
},
23+
"apiLocation": {
24+
"type": "string"
25+
},
26+
"azureSQL": {
27+
"type": "string"
28+
}
29+
},
30+
"resources": [
31+
{
32+
"apiVersion": "2021-01-15",
33+
"name": "[parameters('name')]",
34+
"type": "Microsoft.Web/staticSites",
35+
"location": "[parameters('location')]",
36+
"properties": {
37+
"repositoryUrl": "[parameters('repositoryUrl')]",
38+
"branch": "[parameters('branch')]",
39+
"repositoryToken": "[parameters('repositoryToken')]",
40+
"buildProperties": {
41+
"appLocation": "[parameters('appLocation')]",
42+
"apiLocation": "[parameters('apiLocation')]"
43+
}
44+
},
45+
"sku": {
46+
"Tier": "Free",
47+
"Name": "Free"
48+
},
49+
"resources":[
50+
{
51+
"apiVersion": "2021-01-15",
52+
"name": "appsettings",
53+
"type": "config",
54+
"location": "[parameters('location')]",
55+
"properties": {
56+
"DATABASE_URL": "[parameters('azureSQL')]"
57+
},
58+
"dependsOn": [
59+
"[resourceId('Microsoft.Web/staticSites', parameters('name'))]"
60+
]
61+
}
62+
]
63+
}
64+
]
65+
}

azure-deploy.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,19 @@ az group create \
3232
-l $location
3333

3434
echo "Deploying Static Web App...";
35-
az staticwebapp create \
36-
-n $appName \
37-
-g $resourceGroup \
38-
-s $gitSource \
39-
-l $location \
40-
-b main \
41-
--api-location "./api" \
42-
--app-location "./client" \
43-
--token $gitToken
35+
az deployment group create \
36+
--name ToDoMVC-SWA \
37+
--resource-group $resourceGroup \
38+
--template-file azure-deploy.arm.json \
39+
--parameters \
40+
name=$appName \
41+
location=$location \
42+
repositoryToken=$gitToken \
43+
repositoryUrl=$gitSource \
44+
branch=main \
45+
appLocation="./client" \
46+
apiLocation="./api" \
47+
azureSQL=$DATABASE_URL
4448

4549
echo "Getting Static Web App...";
4650
dhn=`az staticwebapp show -g $resourceGroup -n $appName --query "defaultHostname"`

0 commit comments

Comments
 (0)