29 C
Dubai
Wednesday, December 11, 2024

Adding Domains in Bulk to Microsoft 365 using Powershell

Use Microsoft Graph

Install-Module Microsoft.graph
Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"

Importing Bulk Domains to CSV

Import-Csv .\Export.csv | ForEach-Object {New-MgDomain -BodyParameter @{Id=$_.domainname}}

To get verification code for each domain

Get-MgDomain |ForEach-Object {(Get-MgDomainVerificationDnsRecord -DomainId $_.id | Where-Object {$_.RecordType -eq "Txt"}).AdditionalProperties.text}

run get-mgdomain put in a sheet, run this and put in the next column. Saves a lot of time.

Satheshwaran Manoharan
Satheshwaran Manoharanhttps://www.azure365pro.com
Award-winning Technology Leader with a wealth of experience running large teams and diversified industry exposure in cloud computing. From shipping lines to rolling stocks.In-depth expertise in driving cloud adoption strategies and modernizing systems to cloud native. Specialized in Microsoft Cloud, DevOps, and Microsoft 365 Stack and conducted numerous successful projects worldwide. Also, Acting as a Technical Advisor for various start-ups.

Related Articles

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

× How can I help you?