> 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/w/windows-print-management.md).

# Windows Print Management

This adapter collects printers registered with Microsoft Universal Print through the Microsoft Graph API. The traditional on-premises Windows print server role has no REST API and cannot be connected.

## Use cases

* List all printers registered in Universal Print.

```
Adapters = windows-print-management
```

## Before you begin

### Network

| Source              | Destination                                        | Port                 | Protocol |
| ------------------- | -------------------------------------------------- | -------------------- | -------- |
| OctoXLabs connector | `login.microsoftonline.com` (default Login Domain) | 443                  | HTTPS    |
| OctoXLabs connector | `graph.microsoft.com` (default Domain)             | 443                  | HTTPS    |
| OctoXLabs connector | HTTP proxy (optional)                              | Set in **Proxy URL** | HTTP     |

### Required permissions

| Scope or role                                                                   | Permission     | Needed for                       |
| ------------------------------------------------------------------------------- | -------------- | -------------------------------- |
| Microsoft Graph delegated permission `Printer.Read.All` (admin consent granted) | Read           | Printers                         |
| Entra role Printer Administrator, on the account used                           | Not applicable | A complete set of printer fields |

Application permissions are not supported. Microsoft defines none for the Universal Print endpoints, so a client credentials application cannot list printers.

## Create credentials in Windows Print Management

{% stepper %}
{% step %}

### Register an app

In the Microsoft Entra admin center go to **Identity > Applications > App registrations** and create a new registration.
{% endstep %}

{% step %}

### Add the permission

Open **API permissions**. Add the **Microsoft Graph > Delegated permissions** entry **Printer.Read.All** and grant admin consent. Do not add application permissions.
{% endstep %}

{% step %}

### Create a client secret

Open **Certificates & secrets**, create a client secret and copy its value. It is shown once.
{% endstep %}

{% step %}

### Prepare the account

Assign the **Printer Administrator** role to the account used for the connection. The account must be excluded from multi-factor authentication and Conditional Access. This sign-in method does not work with MFA, federated (AD FS) or passwordless accounts.
{% endstep %}

{% step %}

### Or get a refresh token

If sign-in with the service account is blocked, complete an authorization code consent once with the `offline_access` scope, using an account with the Printer Administrator role. A refresh token expires 90 days after it is issued and is not renewed automatically.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter     | Required    | Type    | Default                   | Description                                                                      |
| ------------- | ----------- | ------- | ------------------------- | -------------------------------------------------------------------------------- |
| Domain        | No          | Text    | graph.microsoft.com       | Microsoft Graph host.                                                            |
| Login Domain  | No          | Text    | login.microsoftonline.com | Entra ID login host. Change only for a sovereign cloud.                          |
| Tenant ID     | Yes         | Text    |                           | Directory (tenant) ID, GUID or domain name.                                      |
| Client ID     | Yes         | Text    |                           | Application (client) ID.                                                         |
| Client Secret | Yes         | Text    |                           | Client secret of the app registration.                                           |
| Username      | Conditional | Text    |                           | User principal name of the service account, for example `svc-print@example.com`. |
| Password      | Conditional | Text    |                           | Password of the service account.                                                 |
| Refresh Token | Conditional | Text    |                           | Alternative to username and password.                                            |
| Proxy URL     | No          | Text    |                           | Proxy in `host:port` format.                                                     |
| Timeout       | No          | Integer | 30                        | Seconds to wait for API responses.                                               |

Provide a username and password, or a refresh token. If both are set, the username and password are used.

## Troubleshooting

| Error message                                                                                                              | Cause                              | Fix                                                                   |
| -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | --------------------------------------------------------------------- |
| Either username and password, or refresh token is required. Universal Print does not support application-only permissions. | No delegated identity was given.   | Fill the username and password, or the refresh token.                 |
| Max retries exceeded for                                                                                                   | The API kept returning 401 or 429. | Check the credentials and the Printer Administrator role, then retry. |

## Change history

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