![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=1738843796-LPHfImkHAwBWXV7lkp4SFkfPXTx4Y6CQ-0-af1e04e6e4e4a969ef8f51f028032297)
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=1738843796-u2XV6lOBZhmbezT6cUh1GnsnSegQZ768-0-0bae792a10545bfd58ec9491162ea379)
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=1738843796-hFRs9OYpErucALqADYzp7g0ILRZn4YPb-0-c7da6ca9db6068976e06420143b9e86d)
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=1738843796-dzcoXZvSOGrOjICSqpkcgyjDeYRvjX33-0-005155eff2a6b26bf16fa1871e9fe8f4)
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=1738843796-FrAGzjwHs8Iy2yWgMtEtmroiX8CZlWJO-0-ab70d9c37a3148888f4b59efb2b7d92c)
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=1738843796-Co825AJf5TdjZn4nc33uuvmovnB461xU-0-c977e8d42262c5d6bbd1c7d847195dea)
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.