# Managing Exchange Service Accounts (admins.json)

Source: https://help.sendent.com/sendent-nextcloud-workspace/nextcloud-for-exchange/managing-exchange-service-accounts

This guide explains how to configure an optional pool of Exchange admin identities. If you already set AppId/ClientSecret or UserName/Password on the EventSyncClients Exchange client, the connector can run with that single account. Use admins.json only when you need several identities to avoid throttling.

## Step 1. Create the Directory and JSON File

### Pro Tip

The connector supports a highly flexible directory structure for your credentials. You can organize multiple JSON files in custom subfolders (e.g., separating test accounts from production accounts) and switch between them by simply updating a single path in your `.env` file.



Create a base directory named `exchangeAdmins` in the same location as your deployment files will be placed, and create your JSON file inside it:

```bash
# Create the directory
mkdir exchangeAdmins

# Create the JSON file (you can name it admins.json, testAdmins.json, etc.)
touch exchangeAdmins/admins.json
```

## Step 2. Format the Credentials Payload

Below are examples of how to format your `admins.json` file. You can configure a single administrator or multiple administrators to increase parallel processing capacity.

**Warning: Do Not Mix Exchange Types**

You cannot mix different Exchange connection types (e.g., placing one Cloud account and one On-Premise account) in the same `admins.json` file. The application initializes the client connection only once per instance. Mixing account types will break the application and cause specific accounts to fail.



**Example 1: Single Administrator (Cloud / Microsoft 365)**

For the Cloud Exchange type, the EventSyncClients\_\_0\_\_Settings\_\_ExchangeType parameter in .env should be set to 1.

Use `AppId` and `ClientSecret` for Cloud environments.

```json
[
  { 
    "AppId": "your-app-id-1",
    "ClientSecret": "your-client-secret-1"
  }
]
```



**Example 2: Multiple Administrators (On-Premise Kerberos)**

For the **On-Premise Kerberos** Exchange type, the`EventSyncClients__0__Settings__ExchangeType` parameter in `.env `should be set to `2`.

Use `Username` and `Password` for Kerberos environments.

```json
[
  {
    "Username": "serviceaccount-1",
    "Password": "your-password-1"
  },
  {
    "Username": "serviceaccount-2",
    "Password": "your-password-2"
  }
]
```



**Example 3: Multiple Administrators (On-Premise BasicAuth)**

**For the On-Premise BasicAuth Exchange type, the** `EventSyncClients__0__Settings__ExchangeType` **parameter in .env should be set to** `3`**.**

**Use** `Username` **and** `Password` **for BasicAuth environments.**

```json
[
  {
    "Username": "serviceaccount-1",
    "Password": "your-password-1"
  },
  {
    "Username": "serviceaccount-2",
    "Password": "your-password-2"
  }
]
```



**Example 4: Multiple Administrators (On-Premise ADFS)**

For the **On-Premise ADFS** Exchange type, the `EventSyncClients__0__Settings__ExchangeType` parameter in `.env` should be set to `4`.

Use `ClientId` and `ClientSecret` for ADFS environments.

```json
[
  {
    "ClientId": "your-client-id-1",
    "ClientSecret": "your-client-secret-1"
  },
  {
    "ClientId": "your-client-id-2",
    "ClientSecret": "your-client-secret-2"
  }
]
```



## Step 3. Link the File in your Configuration (.env)

Open your `.env` configuration file and update the `Service__ExchangeConfiguration__ExchangeAdminFile` parameter with the relative path to your JSON file.

**Note:**   
The application uses a fallback mechanism: it will first try to read the custom path you provide in the `Service__ExchangeConfiguration__ExchangeAdminFile` parameter.

By default, the application will automatically look for an `admins.json` file in the *exchangeAdmins* directory. You only need to configure the path if you are using custom subfolders or filenames.



**Example direct pointing to the** `exchangeAdmins` **folder:**

```bash
Service__ExchangeConfiguration__ExchangeAdminFile=
```

**Example pointing to a custom subfolder (e.g., exchangeAdmins/prod):**

```bash
Service__ExchangeConfiguration__ExchangeAdminFile=prod/admins.json
```

`admins.json` and `ExchangeAdminRaw` feed the admin pool. They do not replace client Settings such as `OnPremUrl`, `OnPremDomain`, or `TenantId`. Those stay on `EventSyncClients`.

Do not put `ExchangeAdminRaw` under `EventSyncClients__*__Settings`. If you use an inline JSON array, the key is `Service__ExchangeConfiguration__ExchangeAdminRaw`.

## Next Step

[Deploying via Docker (Single Instance)](https://help.sendent.com/sendent-nextcloud-workspace/nextcloud-for-exchange/deploying-via-docker-single-instance)
