This article talks about how to add multiple contacts in O365
Contacts are people outside your organization that you’d like everyone to be able to find. Anyone listed in contacts can be found in Outlook under People in Microsoft 365
Steps to add multiple contacts in O365
Login to O365 admin portal : https://admin.microsoft.com/
Navigate to Users–> contacts–> click on add multiple contacts

Download and save one of the files below. Open the file in Excel or a similar app and add your contact info, I would recommend to go with second option: Download a CSV file with headers and sample contact info

Save .csv file in Downloads location :

Open .csv file –> add contact details –> save it

finally click on browse and upload the updated .csv file

We are done here

Multiple contacts in O365 can be seen here

PowerShell Script for above manual task
DisplayName,FirstName,LastName,ExternalEmailAddress
John Doe,John,Doe,john.doe@example.com
Jane Smith,Jane,Smith,jane.smith@example.com
Michael Lee,Michael,Lee,michael.lee@example.com
# Install and import Exchange Online PowerShell module (if not installed)
Install-Module ExchangeOnlineManagement -Force -AllowClobber
# Connect to Exchange Online
Connect-ExchangeOnline
# Path to your CSV file
$CSVPath = "C:\Scripts\contacts.csv"
# Import CSV and loop through each contact
$Contacts = Import-Csv -Path $CSVPath
foreach ($Contact in $Contacts) {
try {
New-MailContact -Name $Contact.DisplayName `
-FirstName $Contact.FirstName `
-LastName $Contact.LastName `
-ExternalEmailAddress $Contact.ExternalEmailAddress
Write-Host "Contact $($Contact.DisplayName) added successfully."
}
catch {
Write-Host "Failed to add contact $($Contact.DisplayName): $_"
}
}
# Disconnect session
Disconnect-ExchangeOnline -Confirm:$false
Conclusion:
Post reading above article reader can add contacts in O365 successfully.
Also you can read https://microbrother.com/how-to-create-contacts-in-o365/ this article to add single or few contacts in O365
Thank you ☺️