# Trying to connect keycloak 20.0.1 to Azure pgsql server

**URL:** <https://forum.keycloak.org/t/trying-to-connect-keycloak-20-0-1-to-azure-pgsql-server/18598>\
**Category:** Configuring the server\
**Created:** [November 25, 2022, 8:50am UTC](https://forum.keycloak.org/t/trying-to-connect-keycloak-20-0-1-to-azure-pgsql-server/18598 "2022-11-25T08:50:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![balder](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@balder](https://forum.keycloak.org/u/balder)\
**Post date:** [November 25, 2022, 8:50am UTC](https://forum.keycloak.org/t/trying-to-connect-keycloak-20-0-1-to-azure-pgsql-server/18598/1 "2022-11-25T08:50:49Z")

</div>

Hi, hopefully someone here are able to help me getting this to work.

Currently I am trying to set up keycloak 20.0.1 to use a postgres sql server. Not used to JDBC constring, and the azure provided one does not seem to work.

To connect to postgres i am using these environmental variables in the azure web app. Deploying using terraform with dockerimage [Quay](http://quay.io/keycloak/keycloak)

```auto
    KC_DB = postgres
    KC_DB_URL_DATABASE = "keycloak"
    KC_DB_URL_HOST = "mypgsql.postgres.database.azure.com"
    KC_DB_URL_PORT = 5432
    KC_DB_URL_PROPERTIES = "?sslmode=require" (have tried with and without and several variant of this)
    KC_DB_SCHEMA = "public"
    KC_DB_USERNAME = "user"
    KC_DB_PASSWORD = "pass"

```

Each time i am getting

```auto
ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to obtain JDBC connection
2022-11-25T08:47:32.061744422Z 2022-11-25 08:47:32,061 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: URL format error; must be "jdbc:h2:{ {.|mem:}[name] | [file:]fileName | {tcp|ssl}:[//]server[:port][,server2[:port]]/name }[;key=value...]" but is "jdbc:postgresql://mypgsql.postgres.database.azure.com:5432/keycloak;sslmode=require" [90046-214]

```

have also tried the KC\_DB\_URL with full jdbc constring from azure, but with no luck
