# Export/Import fails while using a vault

**URL:** <https://forum.keycloak.org/t/export-import-fails-while-using-a-vault/2986>\
**Category:** Configuring the server\
**Tags:** user-federation, ldap\
**Created:** [May 27, 2020, 9:53am UTC](https://forum.keycloak.org/t/export-import-fails-while-using-a-vault/2986 "2020-05-27T09:53:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![deBFM](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/debfm/32/884_2.png) [@deBFM](https://forum.keycloak.org/u/deBFM)\
**Post date:** [May 27, 2020, 9:53am UTC](https://forum.keycloak.org/t/export-import-fails-while-using-a-vault/2986/1 "2020-05-27T09:53:30Z")

</div>

Hi,

I managed to setup a [vault](https://www.keycloak.org/docs/latest/server_admin/#_vault-administration) and that an User-Federation (ldap) makes use of it, but I have a problem to [import/export](https://www.keycloak.org/docs/latest/server_admin/#_export_import) this configuration.

Keycloak Version: jboss/keycloak:10.0.1

## Problem

The import/export fails when using a vault for “LDAP bind credential”.

Realm: `company`  
Bind Credential Field: `${vault.ldap-password}`  
Password file: `/run/secrets/company_ldap-password`

```auto
INFO [org.keycloak.storage.ldap.LDAPIdentityStoreRegistry] (ServerService Thread Pool -- 60) Creating new LDAP Store for the LDAP storage provider: 'ldap', LDAP Configuration: {pagination=[true], fullSyncPeriod=[86400], usersDn=[DC=intern,DC=company,DC=de], connectionPooling=[true], cachePolicy=[DEFAULT], useKerberosForPasswordAuthentication=[false], importEnabled=[true], enabled=[true], bindDn=[CN=Adm,OU=Test,DC=intern,DC=company,DC=de], changedSyncPeriod=[3600], usernameLDAPAttribute=[cn], lastSync=[1590407853], vendor=[ad], uuidLDAPAttribute=[objectGUID], connectionUrl=[ldaps://dc3.intern.company.de], allowKerberosAuthentication=[false], syncRegistrations=[false], authType=[simple], customUserSearchFilter=[(!(|(cn=Test ID 1)(cn=Server1)))], debug=[false], searchScope=[2], useTruststoreSpi=[ldapsOnly], trustEmail=[false], priority=[0], userObjectClasses=[person, organizationalPerson, user], rdnLDAPAttribute=[cn], editMode=[WRITABLE], validatePasswordPolicy=[false], batchSizeForSync=[1000]}, binaryAttributes: []
FATAL [org.keycloak.services] (ServerService Thread Pool -- 60) org.keycloak.models.ModelException: LDAP Query failed

```

### Workaround

Disable (enabled =\> false) the User-Federation which makes use of the vault for the export/import.

## Configuration:

### Vault:

```auto
<spi name="vault">
    <default-provider>files-plaintext</default-provider>
    <provider name="files-plaintext" enabled="true">
        <properties>
            <property name="dir" value="/run/secrets"/>
        </properties>
    </provider>
</spi>

```

### Export-Script

```auto
#!/bin/bash
docker exec -it $(docker ps -f name=jwt-security --format "{{.ID}}") /opt/jboss/keycloak/bin/standalone.sh -c standalone-ha.xml \
    -Djboss.socket.binding.port-offset=100 \
    -Dkeycloak.migration.action=export \
    -Dkeycloak.migration.provider=dir \
    -Dkeycloak.migration.usersExportStrategy=DIFFERENT_FILES \
    -Dkeycloak.migration.dir=/tmp/config/data

```

* * *

Thank you in advance for any help you can offer.  
Regards, Dennis Kronbügel

---

<div class="post-metadata">

**Author:** ![Dacit](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@Dacit](https://forum.keycloak.org/u/Dacit)\
**Post date:** [June 10, 2020, 4:25pm UTC](https://forum.keycloak.org/t/export-import-fails-while-using-a-vault/2986/2 "2020-06-10T16:25:14Z")

</div>

I have the same problem. Found any solution?
