![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=1739211192-f4s0lN6teObgPNPT7n7XnmqQOe6X5hbN-0-f140635446dc340149a15b525b189b36)
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=1739211192-vrsBqMSQ5DqroOPu0fwbhp3YXmeVkyHY-0-bffce7ee347d78fb37c21a085efcf8d5)
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=1739211192-FhctqJXwk0owsQ1dJzdZ5Z9rGHHYQBPv-0-b329319cd5bd4ee95c1221b921e214af)
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=1739211192-498dmqKie0lZ0z2drqQeNgtiAZc39dnF-0-e2efa0d544e7e806854c946faa542ecc)
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=1739211192-a6tpKI8ttyH7e860DJLC1zyqdNPXBVuL-0-97b415fc057d3d383428b0cb1a57a10d)
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=1739211192-YLqoIpGzOSfbc2nFxXEhVGUTCxhBdIRw-0-34004c97a8de6247d75a4fcdce41f410)
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.