Its ideal to avoid distribution lists wherever possible and adopt Microsoft 365 groups instead however, we can’t apply it for every scenario as DLs are still very useful and in some cases the only option you have. This post will showcase the steps to provision DLs in bulk (in Exchange Online)
Steps:
1. Create a 3 column simple CSV file as shown below and save it locally in your PC as “DL_Pilot.csv”
2. Login to Exchange online PowerShell module
Connect-ExchangeOnline
3. Run the following command (set the location to match yours) and point the path to your previously created CSV file.
Import-CSV “C:\Official\Mantoso\DL_Pilot.csv” | foreach {New-DistributionGroup -Name $.name -Type $.Type -PrimarySmtpAddress $_.email}
That’s it. It’ll simply provision the DLs defined in the the CSV (sample below)