Trying to connect keycloak 20.0.1 to Azure pgsql server

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

    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

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

1 Like