![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=1739291313-cNdKavuIeCIyWhtkGYnJoozcbLiRPf44-0-422b88005eeaa4d3d2632467cdbda93c)
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=1739291313-Rk0aTUlDfRqNNjIO9l1KuFQh0eR51PvQ-0-2f3c0838027e4558297aafabdfc019f5)
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=1739291313-Rzr9vcEAP4cFc8MPjbYX1Yw7319q8vlq-0-44e227548fc4030dce243ec5d1d51b68)
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=1739291313-ow6H8rMyrSSp8PTBr4MPbqq3qHTn8Kjo-0-1c1d0a732ce920e5a5444f6ab8f0392d)
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=1739291313-HybS60551ZYcTqApkRrYI0U0qvPYt8it-0-b162ab1f0b5c892b46963a1838f570a0)
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=1739291313-T0Q5MShm9fl266N4TB4psKVyCs9rScoj-0-c6888d04c55d5a1e37e4ef38a16a6710)
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.