Skip to content

Commit 5834488

Browse files
committed
completed deployment script
1 parent da884bc commit 5834488

File tree

2 files changed

+45
-24
lines changed

2 files changed

+45
-24
lines changed

.funcignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
.vscode
55
local.settings.json
66
test
7-
tsconfig.json
7+
tsconfig.json
8+
sql

azure-deploy.sh

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,23 @@
33
set -euo pipefail
44

55
# Make sure these values are correct for your environment
6-
resourceGroup="dm-api-03"
7-
appName="dm-api-03"
6+
resourceGroup="dm-api-04"
7+
appName="dm-api-04"
8+
storageName="dmapi04"
89
location="WestUS2"
910

1011
# Change this if you are using your own github repository
1112
gitSource="https://github.com/Azure-Samples/azure-sql-db-node-rest-api.git"
1213

1314
# Make sure variables are sent in local.settings.json
14-
if [[ -z "${SQLAZURECONNSTR_WWIF:-}" ]]; then
15-
echo "Plase export Azure SQL connection string:";
16-
echo "export SQLAZURECONNSTR_WWIF=\"your-connection-string-here\"";
15+
if [[ -z "${db_server:-}" ]]; then
16+
echo "Please export Azure SQL server to use:";
17+
echo "export db_server=\"your-database-name-here\".database.windows.net";
18+
exit 1;
19+
fi
20+
if [[ -z "${db_database:-}" ]]; then
21+
echo "Please export Azure SQL database to use:";
22+
echo "export db_database=\"your-database-name-here\"";
1723
exit 1;
1824
fi
1925

@@ -22,13 +28,6 @@ az group create \
2228
-n $resourceGroup \
2329
-l $location
2430

25-
echo "Creating Application Service Plan...";
26-
az appservice plan create \
27-
-g $resourceGroup \
28-
-n "linux-plan" \
29-
--sku B1 \
30-
--is-linux
31-
3231
echo "Creating Application Insight..."
3332
az resource create \
3433
-g $resourceGroup \
@@ -39,26 +38,47 @@ az resource create \
3938
echo "Reading Application Insight Key..."
4039
aikey=`az resource show -g $resourceGroup -n $appName-ai --resource-type "Microsoft.Insights/components" --query properties.InstrumentationKey -o tsv`
4140

42-
echo "Creating Web Application...";
43-
az webapp create \
41+
echo "Creating Storage Account...";
42+
az storage account create \
43+
-g $resourceGroup \
44+
-l $location \
45+
-n $storageName \
46+
--sku Standard_LRS
47+
48+
echo "Creating Function App...";
49+
az functionapp create \
4450
-g $resourceGroup \
4551
-n $appName \
46-
--plan "linux-plan" \
47-
--runtime "PYTHON|3.7" \
52+
--storage-account $storageName \
53+
--app-insights-key $aikey \
54+
--consumption-plan-location $location \
4855
--deployment-source-url $gitSource \
49-
--deployment-source-branch master
56+
--deployment-source-branch main \
57+
--functions-version 2 \
58+
--os-type Windows \
59+
--runtime node \
60+
--runtime-version 10 \
61+
5062

5163
echo "Configuring Connection String...";
52-
az webapp config connection-string set \
64+
az functionapp config appsettings set \
65+
-g $resourceGroup \
66+
-n $appName \
67+
--settings "db_server=$db_server"
68+
69+
az functionapp config appsettings set \
70+
-g $resourceGroup \
71+
-n $appName \
72+
--settings "db_database=$db_database"
73+
74+
az functionapp config appsettings set \
5375
-g $resourceGroup \
5476
-n $appName \
55-
--settings WWIF="$SQLAZURECONNSTR_WWIF" \
56-
--connection-string-type=SQLAzure
77+
--settings 'db_user=NodeFuncApp'
5778

58-
echo "Configuring Application Insights...";
59-
az webapp config appsettings set \
79+
az functionapp config appsettings set \
6080
-g $resourceGroup \
6181
-n $appName \
62-
--settings APPINSIGHTS_KEY="$aikey"
82+
--settings 'db_password=aN0ThErREALLY#$%TRONGpa44w0rd!'
6383

6484
echo "Done."

0 commit comments

Comments
 (0)