![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=1738977324-VtoCGwbr75bm7i2E53HPvTq8i5fSqRr3-0-b28a2061dbfd082f342cd1c85d4ae8de)
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=1738977324-Vz1efynlpz9CXEsb6TnzqZBYEn4fGr1N-0-f8c8120ee8b603ebb983e3d836fb8fef)
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=1738977324-FjEH3fW4bmZZJFPKUjeRe489qta1meqq-0-e5043584f6f88fe9f6553eb426531428)
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=1738977324-DJ2CoGEtPyTkx7A3840tEqIFRACkjrQR-0-cee6dcb7e33c6983e87d6020dacde6f7)
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=1738977324-f46Fu48PulhhzGon4vqMcdukXWI0CnlR-0-adf1b51bfda222925250c0a2bd99e5cb)
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=1738977324-UyS4U95OS9UQZ52JePloPF7m8osGSCid-0-d0b172519f97ed43ef5f8d0c04351c47)
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.