Unable to connect to Azure postgresql flexi database from temporal

I’m getting the below error:
sql schema version compatibility check failed: unable to read DB schema version keyspace/database: temporal error: no usable database connection found
Unable to create server. Error: could not build arguments for function “gouber.org/fx”.(*module).constructCustomLogger.func2 (/home/runner/go/pkg/mod/go.uber.org/fx@v1.22.0/module.go:292): failed to build fxevent.Logger: could not build arguments for function “go.temporal.io/server/temporal”.init.func8 (/home/runner/work/docker-builds/docker-builds/temporal/temporal/fx.go:1004): failed to build log.Logger: received non-nil error from function “go temporal io/server/temporal”.ServerOptionsProvider (/home/runner/work/docker-builds/docker-builds/temporal/temporal/fx.go:184): sql schema version compatibility check failed: unable to read DB schema version keyspace/database: temporal error: no usable database connection found.

Surprisingly, it was able to create database and schema successfully in the database server if I set (SKIP_SCHEMA_SETUP=true and SKIP_DB_CREATE=true)but the container is going down after few seconds with the above mentioned error. Below is my docker compose file.

version: “3.5”
services:
temporal:
container_name: temporal
environment:
- DB=postgres12
- DB_PORT=5432
- POSTGRES_USER=tfadmin
- POSTGRES_PWD=xxxxxxxxx
- POSTGRES_SEEDS=xxxxxxxxxxx
- SKIP_SCHEMA_SETUP=true
- SKIP_DB_CREATE=true
- POSTGRES_TLS_ENABLED=true
# - DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
- ENABLE_ES=true
- ES_SCHEME=https
- ES_SEEDS=xxxxxxxxxxxxxxxx
- ES_PORT=443
- ES_USER=elastic
- ES_PWD=xxxxxxxxxxxxxxxxx
- ES_VERSION=v7
- ES_SCHEMA_SETUP_TIMEOUT_IN_SECONDS=120
- ES_VIS_INDEX=temporal_visibility_v1_dev
- TEMPORAL_ADDRESS=temporal:7233
image: temporalio/auto-setup:${TEMPORAL_VERSION}
networks:
- temporal-network
ports:
- 7233:7233
volumes:
- ./dynamicconfig:/etc/temporal/config/dynamicconfig
temporal-admin-tools:
container_name: temporal-admin-tools
depends_on:
- temporal
environment:
- TEMPORAL_ADDRESS=temporal:7233
- TEMPORAL_CLI_ADDRESS=temporal:7233
image: temporalio/admin-tools:${TEMPORAL_ADMINTOOLS_VERSION}
networks:
- temporal-network
stdin_open: true
tty: true
temporal-ui:
container_name: temporal-ui
depends_on:
- temporal
environment:
- TEMPORAL_ADDRESS=temporal:7233
- TEMPORAL_CORS_ORIGINS=http//localhost:3000
image: temporalio/ui:${TEMPORAL_UI_VERSION}
networks:
- temporal-network
ports:
- 8080:8080
networks:
temporal-network:
driver: bridge
name: temporal-network

Can someone help?