@@ -10,10 +10,33 @@ location="WestUS2"
1010#  Change this if you are using your own github repository
1111gitSource=" https://github.com/Azure-Samples/azure-sql-db-dotnet-rest-api.git" 
1212
13+ 14+ #  Azure configuration
15+ FILE=" .env" 
16+ if  [[ -f  $FILE  ]];  then 
17+ 	echo  " loading from .env" 
18+  export  $( egrep .  $FILE  |  xargs -n1) 
19+ else 
20+ 	cat <<  EOF  > .env
21+ ConnectionStrings__ReadWriteConnection="Server=.database.windows.net;Database=;UID=;PWD=" 
22+ ConnectionStrings__ReadOnlyConnection="Server=.database.windows.net;Database=;UID=;PWD=" 
23+ EOF 
24+ 	echo  " Enviroment file not detected." 
25+ 	echo  " Please configure values for your environment in the created .env file" 
26+ 	echo  " and run the script again." 
27+ 	echo  " ConnectionStrings__ReadWriteConnection: Azure SQL Connection String used for Read/Write workloads" 
28+ 	echo  " ConnectionStrings__ReadOnlyConnection: Azure SQL Connection String used for Read-Only workloads" 
29+ 	exit  1
30+ fi 
31+ 1332#  Make sure connection string variable is set
14- if  [[ -z  " ${ConnectionStrings__DefaultConnection:- } " ;  then 
15- 	echo  " Please export Azure SQL connection string:" ; 
16-  echo  " export ConnectionStrings__DefaultConnection=\" your-connection-string-here\" " ; 
33+ if  [[ -z  " ${ConnectionStrings__ReadWriteConnection:- } " ;  then 
34+  echo  " ConnectionStrings__ReadWriteConnection not found." 
35+ 	exit  1; 
36+ fi 
37+ 38+ if  [[ -z  " ${ConnectionStrings__ReadOnlyConnection:- } " ;  then 
39+ 	echo  " ConnectionStrings__ReadOnlyConnection not found." 
1740	exit  1; 
1841fi 
1942
@@ -40,7 +63,13 @@ echo "Configuring Connection String...";
4063az webapp config connection-string set  \
4164 -g $resourceGroup  \
4265 -n $appName  \
43-  --settings DefaultConnection=$ConnectionStrings__DefaultConnection  \
66+  --settings ReadWriteConnection=$ConnectionStrings__ReadWriteConnection  \
67+  --connection-string-type=SQLAzure
68+ 69+ az webapp config connection-string set  \
70+  -g $resourceGroup  \
71+  -n $appName  \
72+  --settings ReadOnlyConnection=$ConnectionStrings__ReadOnlyConnection  \
4473 --connection-string-type=SQLAzure
4574
4675echo  " Done." 
0 commit comments