I'm trying to use the code below to add domains to a tenant. I'm using an older version of MSONLINE module (MSOnline V1 PowerShell module for Azure Active Directory). However, this operation cannot be successfully done once there's around 6~700 domains been added to the tenant, and no more domains can be added to this tenant afterwards.
$password = ConvertTo-SecureString 'Con6406629' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential
"admin@kevin01.test.com",$password
Connect-MsolService -Credential $cred
Function CreateDomains([int] $InitID=0, [int]$IntervalInSeconds = 5, [string]$ParentDomain = "kevin01.test.com")
{
$LastID = $InitID + 5000;
$idn = $InitID;
While ($idn -le $LastID){
$dname = "CapTest{0:D5}.{1}" -f $idn, $ParentDomain
New-MsolDomain -Name $dname
$idn += 1
Start-Sleep $IntervalInSeconds
}
}
CreateDomains -InitID 0 -ParentDomain kevin01.test.com
The error message is like this, but I don't think I can get any useful info from this:
Maybe this error is just like what you think the added domains reach the limit, so unable to complete your action.
You could try to add the domain manually in the portal and check the current total added domain.
For the details, you could refer to Domain Limitation .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.