@@ -10,49 +10,49 @@ Create a PostgreSQL database using commandline tools.
1010
1111Create a Petstore database using Azure CLI and PostgreSQL CLI:
1212
13- ``` bash
14- az postgres server create --resource-group ${RESOURCE_GROUP} \
15- --name ${POSTGRES_SERVER_NAME} \
16- --location ${REGION} \
17- --admin-user ${POSTGRES_SERVER_ADMIN_LOGIN_NAME} \
18- --admin-password ${POSTGRES_SERVER_ADMIN_PASSWORD} \
19- --sku-name GP_Gen5_2
20-
21- az postgres server firewall-rule create \
22- --resource-group ${RESOURCE_GROUP} \
23- --server ${POSTGRES_SERVER_NAME} --name allAzureIPs \
24- --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0
25-
26- az postgres server firewall-rule create \
27- --resource-group ${RESOURCE_GROUP} \
28- --server ${POSTGRES_SERVER_NAME} --name myDevBox \
29- --start-ip-address ${DEVBOX_IP_ADDRESS} --end-ip-address ${DEVBOX_IP_ADDRESS}
30-
31- psql --host=${POSTGRES_SERVER_FULL_NAME} --port=5432 \
32- --username=${POSTGRES_SERVER_ADMIN_FULL_NAME} \
33- --dbname=${POSTGRES_DATABASE_NAME} --set=sslmode=require
34- ```
35- ``` text
36- Password for user postgres@petstore-db:
37- psql (11.1, server 9.6.10)
38- SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-SHA384, bits: 256, compression: off)
39- Type "help" for help.
40-
41- postgres=> \l
42- List of databases
43- Name | Owner | Encoding | Collate | Ctype | Access privileges
44- -------------------+-----------------+----------+----------------------------+----------------------------+-------------------------------------
45- azure_maintenance | azure_superuser | UTF8 | English_United States.1252 | English_United States.1252 | azure_superuser=CTc/azure_superuser
46- azure_sys | azure_superuser | UTF8 | English_United States.1252 | English_United States.1252 |
47- postgres | azure_superuser | UTF8 | English_United States.1252 | English_United States.1252 |
48- template0 | azure_superuser | UTF8 | English_United States.1252 | English_United States.1252 | =c/azure_superuser +
49- | | | | | azure_superuser=CTc/azure_superuser
50- template1 | azure_superuser | UTF8 | English_United States.1252 | English_United States.1252 | =c/azure_superuser +
51- | | | | | azure_superuser=CTc/azure_superuser
52- (5 rows)
53-
54- postgres=> \q
55- ```
13+ ``` bash
14+ az postgres server create --resource-group ${RESOURCE_GROUP} \
15+ --name ${POSTGRES_SERVER_NAME} \
16+ --location ${REGION} \
17+ --admin-user ${POSTGRES_SERVER_ADMIN_LOGIN_NAME} \
18+ --admin-password ${POSTGRES_SERVER_ADMIN_PASSWORD} \
19+ --sku-name GP_Gen5_2
20+
21+ az postgres server firewall-rule create \
22+ --resource-group ${RESOURCE_GROUP} \
23+ --server ${POSTGRES_SERVER_NAME} --name allAzureIPs \
24+ --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0
25+
26+ az postgres server firewall-rule create \
27+ --resource-group ${RESOURCE_GROUP} \
28+ --server ${POSTGRES_SERVER_NAME} --name myDevBox \
29+ --start-ip-address ${DEVBOX_IP_ADDRESS} --end-ip-address ${DEVBOX_IP_ADDRESS}
30+
31+ psql --host=${POSTGRES_SERVER_FULL_NAME} --port=5432 \
32+ --username=${POSTGRES_SERVER_ADMIN_FULL_NAME} \
33+ --dbname=${POSTGRES_DATABASE_NAME} --set=sslmode=require
34+ ```
35+ ``` text
36+ Password for user postgres@petstore-db:
37+ psql (11.1, server 9.6.10)
38+ SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-SHA384, bits: 256, compression: off)
39+ Type "help" for help.
40+
41+ postgres=> \l
42+ List of databases
43+ Name | Owner | Encoding | Collate | Ctype | Access privileges
44+ -------------------+-----------------+----------+----------------------------+----------------------------+-------------------------------------
45+ azure_maintenance | azure_superuser | UTF8 | English_United States.1252 | English_United States.1252 | azure_superuser=CTc/azure_superuser
46+ azure_sys | azure_superuser | UTF8 | English_United States.1252 | English_United States.1252 |
47+ postgres | azure_superuser | UTF8 | English_United States.1252 | English_United States.1252 |
48+ template0 | azure_superuser | UTF8 | English_United States.1252 | English_United States.1252 | =c/azure_superuser +
49+ | | | | | azure_superuser=CTc/azure_superuser
50+ template1 | azure_superuser | UTF8 | English_United States.1252 | English_United States.1252 | =c/azure_superuser +
51+ | | | | | azure_superuser=CTc/azure_superuser
52+ (5 rows)
53+
54+ postgres=> \q
55+ ```
5656
5757> 💡 - you can reinstall ` psql ` command line tool using ` brew reinstall postgresql ` .
5858
0 commit comments