> 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/da/knowledge-base/how-to-articles/rename-entra-id-accounts-domain.md).

# Omdøb domænet for Entra ID-konti

Omdøb Entra ID-konti til et nyt domæne og en ny lejer i databasen i Remote Desktop Manager ved hjælp af et medfølgende SQL-script.

Hvis De bruger Remote Desktop Manager med integrationen til Entra ID og ændrer domænenavn og lejer, skal De ændre dem i databasen, for at brugerne kan logge på.

De kan bruge SQL-scriptet nedenfor til at omdøbe brugerne til det korrekte domæne.

{% hint style="success" %}
Sørg først for, at De har en sikkerhedskopi af SQL-databasen, da De skal foretage ændringer i den.
{% endhint %}

1. I SSMS skal De oprette forbindelse til Azure-cloud/det lokale SQL Server og oprette en ny forespørgsel. Sørg for, at den køres mod databasen i Remote Desktop Manager og **ikke** master.
2. Brug følgende script med Deres oplysninger:

```
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)
```

Hvis De har ændret Azure-lejeren, skal De også gøre følgende:

1. Kør `Select*FROM sys.sysusers` for at få en liste over alle brugerne.
2. For hver bruger skal De slette dem og oprette dem igen ved hjælp af følgende script:

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

3. Når trinnene ovenfor er fuldført, skal De muligvis "nulstille" cachen ved at ændre Azure-planen og derefter skifte tilbage til den gamle plan, så brugerne kan logge på.

Når trinnene ovenfor er fuldført, indeholder SID'en de aktuelle oplysninger, og De bør kunne godkende med de gamle brugere.


---

# 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.devolutions.net/rdm/da/knowledge-base/how-to-articles/rename-entra-id-accounts-domain.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.
