![Mastering Identity and Access Management with Microsoft Azure](https://wfqqreader-1252317822.image.myqcloud.com/cover/884/36698884/b_36698884.jpg)
Configuring a custom domain
Under the Azure Active Directory | Custom domain section, click Add custom domain and complete the verification process to prove that you are the owner of the domain:
![](https://epubservercos.yuewen.com/1A2C27/19470381808825406/epubprivate/OEBPS/Images/905e2a04-c21e-4430-804d-0e12897e9a3f.png?sign=1738868798-K9WaIF0vCpK0TwiPERZZpEH7AjcMXUA7-0-fc44bb01b949bc46f04d2a69213b5a44)
Add the TXT entry shown to your DNS zone to verify the domain:
![](https://epubservercos.yuewen.com/1A2C27/19470381808825406/epubprivate/OEBPS/Images/908703a0-f6d5-432d-82e9-c7bbb0959a58.png?sign=1738868798-0LHe02HiN8rNYGPZrv3u4H8qVEVMJLvm-0-934256fbabfd97a02bd7a069b3f6925a)
Click the Verify button on your Azure portal, and after successful verification, the new DOMAIN NAME will appear under DOMAINS. Choose the Make primary option:
![](https://epubservercos.yuewen.com/1A2C27/19470381808825406/epubprivate/OEBPS/Images/8d7858b2-3efe-484e-9590-5796a1e6a59b.png?sign=1738868798-eUmpjrhldznSz218QHyBqvmyY0IHBBo6-0-2e2979782e2a521f35ad428f1eef91b1)
Open https://portal.office.com to complete the domain setup process under the admin section:
![](https://epubservercos.yuewen.com/1A2C27/19470381808825406/epubprivate/OEBPS/Images/27f4b243-77d5-4fda-b894-abe32104a5df.png?sign=1738868798-FxWx5QrpjskWa09Umld0QHM5MQdquWnM-0-4c92b4eef1e75c72cbdf7ad2b1539402)
Choose the custom domain to be used for email addresses:
![](https://epubservercos.yuewen.com/1A2C27/19470381808825406/epubprivate/OEBPS/Images/c68834d4-fa43-4034-a5b6-cf6398b047a4.png?sign=1738868798-YE1IYInRcLWWQq2iV29xjsdoCofxrFDI-0-657935821265d074c6434e523bbf612f)
The last step we need to take is to set the new UserPrincipalNames to the existing users. We do this with a small example scripting solution:
- Connect to your Azure AD with your global administrator credentials:
Connect-AzureAD
- Export the existing users to a CSV file with the following cmdlet:
Get-AzureADUser -All $True | Where { $_.UserPrincipalName.ToLower().EndsWith("onmicrosoft.com")} | Export-Csv C:\Office365Users.csv
- Remove all accounts you don't want to modify and make the change with the following cmdlets:
$domain = "inovitlabs.ch"
Import-Csv 'C:\Office365Users.csv' | ForEach-Object {
$newupn = $_.UserPrincipalName.Split("@")[0] + "@" + $domain
Write-Host "Changing UPN value from: "$_.UserPrincipalName" to: " $newupn -ForegroundColor Green
Set-AzureADUser -ObjectId $_.UserPrincipalName -UserPrincipalName $newupn
}
- You should get a result similar to this:
![](https://epubservercos.yuewen.com/1A2C27/19470381808825406/epubprivate/OEBPS/Images/3279dc33-05cc-4006-b039-56615013fb6f.png?sign=1738868798-qGuD5lKtMjP3dpyreKP6KGvYK90WQlJr-0-8b7da40c424fdd5af1c7f4a3c8c2248e)
The primary email will also be changed to the custom domain.
Next, we will configure the Azure AD Domain services to provide a transition scenario for a Kerberos-based application that is normally provided in on-premises infrastructure.