# Configure Active Directory Username Lookup

Where a server is joined to an Active Directory domain, and when <code class="expression">space.vars.PRODUCT\_NAME</code> starts-up on the server, <code class="expression">space.vars.PRODUCT\_NAME</code> will automatically look-up the user's <code class="expression">space.vars.PRODUCT\_NAME</code> username from Active Directory.

By default, <code class="expression">space.vars.PRODUCT\_NAME</code> will look up the username from the *user principal name* Active Directory property. <code class="expression">space.vars.PRODUCT\_NAME</code> will then validate the username is set-up on the <code class="expression">space.vars.PRODUCT\_NAME</code> subscription.

Typically, in most environments, the Active Directory user principal name attribute should match the user's Microsoft 365 username, and hence their <code class="expression">space.vars.PRODUCT\_NAME</code> username.

But, you may have an environment where this is not the case. The Active Directory user principal name may be set to a different domain to the Microsoft 365 domain, and you do not want to change this on your Active Directory.

<figure><img src="https://4182749601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBkDVFDwNmEHlZv1KwwiY%2Fuploads%2F0i2lVBxtrTX4aNCAR6gJ%2Fimage.png?alt=media&#x26;token=b604a6a4-78fe-46fd-946a-9ab022d6f9d7" alt=""><figcaption><p>An example where a user's user principal name may be set to some other domain than their Microsoft 365 domain</p></figcaption></figure>

This will cause an error for <code class="expression">space.vars.PRODUCT\_NAME</code> when it starts up as it will fail to verify the user is set up on the subscription as the Active Directory user principal name does not match their <code class="expression">space.vars.PRODUCT\_NAME</code> username.

Through the <code class="expression">space.vars.PRODUCT\_NAME</code> Administration Console, you can configure <code class="expression">space.vars.PRODUCT\_NAME</code> to use an alternative Active Directory attribute from which to look up their username. For example, you can configure <code class="expression">space.vars.PRODUCT\_NAME</code> to look up the username from the mail attribute instead.

<figure><img src="https://4182749601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBkDVFDwNmEHlZv1KwwiY%2Fuploads%2FBXy77r90HwPY9o154npF%2FActive%20Directory%20Mail%20Attribute.png?alt=media&#x26;token=4db93f5d-fb7f-4af9-9e14-185f3b8fcf27" alt=""><figcaption><p>The mail (E-mail) attribute for this particular user is set to Henry@test.net in Active Directory. <code class="expression">space.vars.PRODUCT_NAME</code> can be configured to lookup from <em>mail</em> instead of <em>user principal name</em></p></figcaption></figure>

Here's how to change the lookup attribute:

{% stepper %}
{% step %}
From the [Administration Console](https://docs.zeedrive.com/administration-guide/overview-of-the-administration-console), click the action button then click the "Manage hot desk computers and desktop servers" option

<figure><img src="https://4182749601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBkDVFDwNmEHlZv1KwwiY%2Fuploads%2FG3UenqONB0w6ifVcRsKD%2Fimage.png?alt=media&#x26;token=2cfa1826-0679-45c1-be8f-5b701dcc1164" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Click the "Choose an action..." button then click the option "Configure the AD attribute for username lookup"

<figure><img src="https://4182749601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBkDVFDwNmEHlZv1KwwiY%2Fuploads%2FzLhJ67hfZvqMWYT9wYf3%2Fimage.png?alt=media&#x26;token=2062c8ed-d174-466d-a1bd-a0fcf40bdbfa" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %} <code class="expression">space.vars.PRODUCT\_NAME</code> will show the current lookup attribute name. If you haven't yet changed it, it will be set to the default, *userprincipalname*. Enter the new lookup attribute and then click the Update button

<figure><img src="https://4182749601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBkDVFDwNmEHlZv1KwwiY%2Fuploads%2FiQhpIhZYLcvVqRNLZloS%2Fimage.png?alt=media&#x26;token=95b2a203-5048-4258-8a2b-0315a398e3e8" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
In this example, I changed the lookup attribute to mail. On clicking the Update button, the busy indicator will show whilst <code class="expression">space.vars.PRODUCT\_NAME</code> updates the attribute

<figure><img src="https://4182749601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBkDVFDwNmEHlZv1KwwiY%2Fuploads%2FymnZyvk5xWNm1FRS2tzM%2Fimage.png?alt=media&#x26;token=16fd5ec6-4c2e-442a-acf3-4d5fe19fed88" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
The green tick mark will show after <code class="expression">space.vars.PRODUCT\_NAME</code> has successfully updated the lookup attribute. When users next sign in to the server, <code class="expression">space.vars.PRODUCT\_NAME</code> will use the new attribute name to lookup their username from Active Directory

<figure><img src="https://4182749601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBkDVFDwNmEHlZv1KwwiY%2Fuploads%2FHSNZ1bJgfchn0vCnVVB9%2Fimage.png?alt=media&#x26;token=4dfd6f94-b596-46ee-a907-e96eb3581334" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zeedrive.com/administration-guide/deploying-to-desktop-servers/configure-active-directory-username-lookup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
