Adds Postgres Connection String
This commit is contained in:
Родитель
a4603757b1
Коммит
ee842f43df
|
@ -232,3 +232,14 @@ include::../../../../../scripts/infra/azure.sh[tag=adocPostgresSelect, indent=0]
|
|||
====
|
||||
If you get the error `No module named 'psycopg2._psycopg'` that means that some of your Azure CLI dependencies are not correctly installed. Check https://github.com/Azure/azure-cli/issues/21998 for help.
|
||||
====
|
||||
|
||||
If you'd like to see the connection string to the database (so you can access your database from an external SQL client), use the following command:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
include::../../../../../scripts/infra/azure.sh[tag=adocPostgresConnectionString, indent=0]
|
||||
----
|
||||
|
||||
> **NOTE:**
|
||||
>
|
||||
> You need to append `ssl=true&sslmode=require` to the end of each connect string to force the driver to use ssl.
|
||||
|
|
|
@ -255,6 +255,20 @@ az containerapp env create \
|
|||
--querytext "select * from Statistics"
|
||||
# end::adocPostgresSelect[]
|
||||
|
||||
# tag::adocPostgresConnectionString[]
|
||||
POSTGRES_CONNECTION_STRING=$(
|
||||
az postgres flexible-server show-connection-string \
|
||||
--server-name "$POSTGRES_DB" \
|
||||
--admin-user "$POSTGRES_DB_ADMIN" \
|
||||
--admin-password "$POSTGRES_DB_PWD" \
|
||||
--database-name "$POSTGRES_DB_SCHEMA" \
|
||||
--query "connectionStrings.jdbc" \
|
||||
--output tsv
|
||||
)
|
||||
|
||||
echo "POSTGRES_CONNECTION_STRING=$POSTGRES_CONNECTION_STRING"
|
||||
# end::adocPostgresConnectionString[]
|
||||
|
||||
echo "Environment '${environment}' of project '${project_name}' ready."
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче