Skip to content

Commit 6d2eced

Browse files
Add PostgreSQL flexible server samples to run-samples script (#101)
* Add PostgreSQL flexible server samples to run-samples script * Update deploy script to replace high-availability flag with zonal-resiliency * Fix parameter names in PostgreSQL firewall rule and database commands in deployment scripts
1 parent eda5425 commit 6d2eced

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎run-samples.sh‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ SAMPLES=(
4040
"samples/web-app-managed-identity/python|bash scripts/user-assigned.sh|bash scripts/validate.sh && bash scripts/call-web-app.sh"
4141
"samples/web-app-sql-database/python|bash scripts/deploy.sh|bash scripts/validate.sh && bash scripts/get-web-app-url.sh"
4242
"samples/web-app-mysql-flexible-server/python|bash scripts/deploy.sh|bash scripts/validate.sh && bash scripts/call-web-app.sh"
43+
"samples/web-app-postgresql-flexible-server/python|bash scripts/deploy.sh|bash scripts/validate.sh && bash scripts/call-web-app.sh"
4344
"samples/web-app-custom-image/python|bash scripts/deploy.sh|bash scripts/validate.sh && bash scripts/call-web-app.sh"
4445
"samples/aci-blob-storage/python|bash scripts/deploy.sh|bash scripts/validate.sh"
4546
)
@@ -54,6 +55,7 @@ TERRAFORM_SAMPLES=(
5455
"samples/web-app-managed-identity/python/terraform|bash deploy.sh"
5556
"samples/web-app-sql-database/python/terraform|bash deploy.sh"
5657
"samples/web-app-mysql-flexible-server/python/terraform|bash deploy.sh"
58+
"samples/web-app-postgresql-flexible-server/python/terraform|bash deploy.sh"
5759
"samples/aci-blob-storage/python/terraform|bash deploy.sh"
5860
)
5961

@@ -67,6 +69,7 @@ BICEP_SAMPLES=(
6769
"samples/web-app-cosmosdb-mongodb-api/python/bicep|bash deploy.sh"
6870
"samples/web-app-managed-identity/python/bicep|bash deploy.sh"
6971
"samples/web-app-mysql-flexible-server/python/bicep|bash deploy.sh"
72+
"samples/web-app-postgresql-flexible-server/python/bicep|bash deploy.sh"
7073
"samples/aci-blob-storage/python/bicep|bash deploy.sh"
7174
)
7275

‎samples/web-app-postgresql-flexible-server/python/scripts/deploy.sh‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ if [[ $? != 0 ]]; then
8585
--admin-user $PG_ADMIN_USER \
8686
--admin-password "$PG_ADMIN_PASSWORD" \
8787
--public-access Enabled \
88-
--high-availability Disabled \
88+
--zonal-resiliency Disabled \
8989
--yes \
9090
--tags environment=test iac=az-cli \
9191
--only-show-errors 1>/dev/null
@@ -146,9 +146,9 @@ echo "PostgreSQL host = $POSTGRES_FQDN, port = $POSTGRES_PORT"
146146
# Check if the server-level firewall rule already exists
147147
echo "Checking if [$FIREWALL_RULE_NAME] firewall rule already exists on the [$POSTGRES_SERVER_NAME] PostgreSQL flexible server..."
148148
az postgres flexible-server firewall-rule show \
149-
--name $POSTGRES_SERVER_NAME \
149+
--server-name $POSTGRES_SERVER_NAME \
150150
--resource-group $RESOURCE_GROUP_NAME \
151-
--rule-name $FIREWALL_RULE_NAME \
151+
--name $FIREWALL_RULE_NAME \
152152
--only-show-errors &>/dev/null
153153

154154
if [[ $? != 0 ]]; then
@@ -157,9 +157,9 @@ if [[ $? != 0 ]]; then
157157

158158
# Create a permissive firewall rule so the deploy machine can run the psql bootstrap
159159
az postgres flexible-server firewall-rule create \
160-
--name $POSTGRES_SERVER_NAME \
160+
--server-name $POSTGRES_SERVER_NAME \
161161
--resource-group $RESOURCE_GROUP_NAME \
162-
--rule-name $FIREWALL_RULE_NAME \
162+
--name $FIREWALL_RULE_NAME \
163163
--start-ip-address "0.0.0.0" \
164164
--end-ip-address "255.255.255.255" \
165165
--only-show-errors 1>/dev/null
@@ -179,7 +179,7 @@ echo "Checking if [$POSTGRES_DATABASE_NAME] database already exists on the [$POS
179179
az postgres flexible-server db show \
180180
--server-name $POSTGRES_SERVER_NAME \
181181
--resource-group $RESOURCE_GROUP_NAME \
182-
--database-name $POSTGRES_DATABASE_NAME \
182+
--name $POSTGRES_DATABASE_NAME \
183183
--only-show-errors &>/dev/null
184184

185185
if [[ $? != 0 ]]; then
@@ -190,7 +190,7 @@ if [[ $? != 0 ]]; then
190190
az postgres flexible-server db create \
191191
--server-name $POSTGRES_SERVER_NAME \
192192
--resource-group $RESOURCE_GROUP_NAME \
193-
--database-name $POSTGRES_DATABASE_NAME \
193+
--name $POSTGRES_DATABASE_NAME \
194194
--charset UTF8 \
195195
--collation en_US.utf8 \
196196
--only-show-errors 1>/dev/null

‎samples/web-app-postgresql-flexible-server/python/scripts/validate.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ echo -e "\n[$POSTGRES_DATABASE_NAME] PostgreSQL database:\n"
5555
az postgres flexible-server db show \
5656
--server-name "$POSTGRES_SERVER_NAME" \
5757
--resource-group "$RESOURCE_GROUP_NAME" \
58-
--database-name "$POSTGRES_DATABASE_NAME" \
58+
--name "$POSTGRES_DATABASE_NAME" \
5959
--query '{Name:name,ResourceGroup:resourceGroup,Charset:charset,Collation:collation}' \
6060
--output table \
6161
--only-show-errors
6262

6363
# Check PostgreSQL firewall rule
6464
echo -e "\n[$FIREWALL_RULE_NAME] PostgreSQL firewall rule:\n"
6565
az postgres flexible-server firewall-rule show \
66-
--name "$POSTGRES_SERVER_NAME" \
66+
--server-name "$POSTGRES_SERVER_NAME" \
6767
--resource-group "$RESOURCE_GROUP_NAME" \
68-
--rule-name "$FIREWALL_RULE_NAME" \
68+
--name "$FIREWALL_RULE_NAME" \
6969
--output table \
7070
--only-show-errors
7171

0 commit comments

Comments
 (0)