> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/m/manage-engine-mdm.md).

# Manage Engine MDM

ManageEngine Mobile Device Manager Plus manages Android, iOS, Windows, macOS and Chrome OS devices. OctoXLabs reads the enrolled devices, their installed apps and the MDM users, and adds them to the inventory.

## Use cases

* **Find managed mobile devices that are missing from other sources.** List MDM devices that no other adapter reports. How devices are matched depends on your merge settings.

```
Adapters = manage-engine-mdm AND NOT Adapters = active-directory
```

* **Review MDM users.** List the users that the MDM server reports, to compare them with your directory.

```
Adapters = manage-engine-mdm
```

## Before you begin

### Network

| Source              | Destination                                                                                 | Port                 | Protocol |
| ------------------- | ------------------------------------------------------------------------------------------- | -------------------- | -------- |
| OctoXLabs connector | Manage Engine MDM host (IP parameter; default `mdm.manageengine.com`)                       | 443 (Port parameter) | HTTPS    |
| OctoXLabs connector | Zoho accounts domain (Zoho Domain parameter; default `accounts.zoho.com`), cloud OAuth only | 443                  | HTTPS    |

The connector builds the MDM URL from the IP, Port and SSL parameters. The Zoho token request always uses HTTPS.

### Required permissions

| Scope or role                 | Permission | Needed for         |
| ----------------------------- | ---------- | ------------------ |
| MDMOnDemand.MDMInventory.READ | Read       | Device information |
| MDMOnDemand.MDMUser.READ      | Read       | User information   |

The scopes come from the baseline instructions. They apply to the cloud OAuth flow. The on-premises API key is generated by an administrator and the sources do not list a separate role for it.

## Create credentials in Manage Engine MDM

Use the API key for an on-premises server. Use OAuth for the cloud service.

{% stepper %}
{% step %}

### On-premises: generate an API key

On the MDM server, open the **Admin** tab, then select **API Key Generation** under **Integrations**. Follow the on-screen instructions to generate the key.
{% endstep %}

{% step %}

### Cloud: register a client

Register a client in the Zoho API console. Note the **Client ID**, the **Client Secret** and the **Redirect URI** you used. The Redirect URI in OctoXLabs must be the same as the one you registered.
{% endstep %}

{% step %}

### Cloud: get a grant code

Open the Zoho authorization URL `https://accounts.zoho.com/oauth/v2/auth` with the `scope`, `client_id`, `response_type=code`, `redirect_uri` and `access_type=offline` query parameters. Use the scopes `MDMOnDemand.MDMInventory.READ` and `MDMOnDemand.MDMUser.READ`. Click **Accept** on the consent page. Zoho redirects to your Redirect URI with a `code` value. The code is valid for 60 seconds. If you click **Deny**, the server returns an error.
{% endstep %}

{% step %}

### Cloud: get a refresh token (recommended)

Send a POST request to `https://accounts.zoho.com/oauth/v2/token` with the `code`, `client_id`, `client_secret`, `redirect_uri` and `grant_type=authorization_code` fields. Copy the `refresh_token` value from the response and enter it in the **Refresh Token** field. You do this once. The refresh token stays valid unless it is revoked.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
If you give a Refresh Token, OctoXLabs uses it to get new access tokens and does not need the Code. Without a Refresh Token, the connector exchanges the Code for tokens on each run, and the Code expires after 60 seconds.
{% endhint %}

## Connection parameters

| Parameter     | Required | Type    | Default              | Description                                                                                                  |
| ------------- | -------- | ------- | -------------------- | ------------------------------------------------------------------------------------------------------------ |
| IP            | Yes      | String  | mdm.manageengine.com | Host of the Manage Engine MDM server.                                                                        |
| Port          | No       | Integer | 443                  | Port of the MDM server.                                                                                      |
| API Key       | No       | String  | None                 | API key for an on-premises server. When set, it is sent as the `Authorization` header and OAuth is not used. |
| Zoho Domain   | Yes      | String  | accounts.zoho.com    | Zoho accounts domain for your region, used for the token request.                                            |
| Client ID     | No       | String  | None                 | OAuth client ID (cloud).                                                                                     |
| Client Secret | No       | String  | None                 | OAuth client secret (cloud).                                                                                 |
| Code          | No       | String  | None                 | One-time grant code (cloud). Valid for 60 seconds.                                                           |
| Refresh Token | No       | String  | None                 | OAuth refresh token (cloud).                                                                                 |
| Redirect URI  | No       | String  | None                 | Must match the redirect URI registered for the client.                                                       |
| SSL           | No       | Boolean | True                 | Use HTTPS for the connection to the MDM host.                                                                |
| Timeout       | No       | Integer | 30                   | Seconds to wait for an API response.                                                                         |

## Troubleshooting

| Error message                                                  | Cause                                                                                   | Fix                                                                            |
| -------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| Request to {url} failed after 5 retries (last status: {code})  | The API kept answering 401 or 429.                                                      | Check the credentials and the refresh token, then run discovery again later.   |
| Status Code: `, followed by URL, Method and the response body` | The API answered with a status other than 200. This is the shared REST connector error. | Read the status code and body, then check the credentials, scopes and address. |

## Change history

{% hint style="info" %}
Available starting from version 5.0.0.
{% endhint %}
