> For the complete documentation index, see [llms.txt](https://docs.realmjoin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmjoin.com/automation/runbooks/runbook-references/user/userinfo/rename-user.md).

# Rename User

Change this user's sign-in name (UPN) and mailbox alias

### Description

Gives this user a new user principal name in Entra ID and, optionally, updates the mailbox alias and the primary email address in Exchange Online to match. Display name, given name and surname are not touched.

### Location

User → Userinfo → Rename User

**Full Runbook name**

rjgit-user\_userinfo\_rename-user

### Details

| Property         | Value                                                                             |
| ---------------- | --------------------------------------------------------------------------------- |
| Version          | 1.0.1                                                                             |
| Required modules | <p>RealmJoin.RunbookHelper (>= 0.8.10)<br>ExchangeOnlineManagement (>= 3.9.2)</p> |
| Schedulable      | no                                                                                |

### Permissions

#### Application permissions

* **Type**: Microsoft Graph
  * User.ReadWrite.All
    * *Patches /users/{UPN} to set the new user principal name*
* **Type**: Office 365 Exchange Online
  * Exchange.ManageAsApp
    * *Runs Get-EXOMailbox and Set-Mailbox to update alias and SMTP addresses after the rename*

#### RBAC roles

* Exchange Administrator
  * *Required for the app-only Exchange Online session rewriting the mailbox addresses*

### Parameters

#### UserName

User principal name of the user the runbook acts on. Set by the portal from the selected user.

| Property         | Value                                  |
| ---------------- | -------------------------------------- |
| Required         | true                                   |
| Default Value    |                                        |
| Type             | String                                 |
| Hidden in portal | yes (preset via runbook customization) |

#### NewUpn

New sign-in name, for example <jane.doe@contoso.com>.

| Property            | Value                   |
| ------------------- | ----------------------- |
| Required            | true                    |
| Default Value       |                         |
| Type                | String                  |
| Portal display name | New user principal name |

#### ChangeMailnickname

Sets the mailbox alias and name from the new user principal name.

| Property            | Value                     |
| ------------------- | ------------------------- |
| Required            | false                     |
| Default Value       | True                      |
| Type                | Boolean                   |
| Portal display name | Update the mailbox alias? |

#### UpdatePrimaryAddress

Makes the new user principal name the primary email address; the previous addresses stay as aliases.

| Property            | Value                             |
| ------------------- | --------------------------------- |
| Required            | false                             |
| Default Value       | True                              |
| Type                | Boolean                           |
| Portal display name | Update the primary email address? |

[Back to Runbook Reference overview](/automation/runbooks/runbook-references.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.realmjoin.com/automation/runbooks/runbook-references/user/userinfo/rename-user.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
