> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/rdm/it/knowledge-base/how-to-articles/rename-entra-id-accounts-domain.md).

# Rinominare il dominio degli account Entra ID

Se utilizza Remote Desktop Manager con l'integrazione Entra ID e modifica il nome del dominio e il tenant, dovrà modificarli anche nel suo database affinché gli utenti possano accedere.

Può utilizzare lo script SQL riportato di seguito per rinominare gli utenti con il dominio corretto.

{% hint style="success" %}
Innanzitutto si assicuri di disporre di un backup del suo database SQL, poiché dovrà eseguirvi delle modifiche.
{% endhint %}

1. In SSMS, si connetta al suo SQL Server cloud di Azure/on-premises e crei una nuova query. Si assicuri che venga eseguita sul suo database di Remote Desktop Manager e **non** sul suo master.
2. Utilizzi il seguente script con le sue informazioni:

```
DECLARE @oldDomain as varchar(255) = '@oldDomain'
DECLARE @newDomain as varchar(255) = '@newDomain'

UPDATE UserSecurity
SET Name=replace(Name,@oldDomain,@newDomain),
    UPN=replace(UPN,@oldDomain,@newDomain),
    ExternalID = NULL
WHERE UserType = 0

UPDATE UserProfile
SET Name=replace(Name,@oldDomain,@newDomain)
```

Se ha modificato il suo tenant Azure, deve anche effettuare quanto segue:

1. Esegua `Select*FROM sys.sysusers` per ottenere l'elenco di tutti gli utenti.
2. Per ogni utente, lo elimini e lo ricrei utilizzando il seguente script:

```
DROP USER [user@domain.com];
CREATE USER [user@domain.com] FROM EXTERNAL PROVIDER;
```

3. Una volta completati i passaggi precedenti, potrebbe essere necessario "reimpostare" la cache modificando il suo piano Azure e ripristinando successivamente il piano precedente, affinché i suoi utenti possano accedere.

Dopo aver completato i passaggi precedenti, il SID conterrà le informazioni attuali e dovrebbe essere in grado di autenticarsi con gli utenti precedenti.


---

# 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 dynamically by asking a question.

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

```
GET https://docs.devolutions.net/rdm/it/knowledge-base/how-to-articles/rename-entra-id-accounts-domain.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
