The syntax is OK. You can use the exact same cmdlet/syntax for Exchange Online, apart from the OU parameter, so just remove it.
Create Contact
Rising Flight
4,556
Reputation points
Hi all I am using exchange 2016 hybrid environment. I want to create mail contact from exchange onprem powershell. Please correct me with the below syntax. Also guide me to how to create contact in exchange online.
New-MailContact -Name "Glenn Maxwell External" -DisplayName "Glenn Maxwell External" -FirstName "Glenn" -LastName "Maxwell External" -ExternalEmailAddress maxwell@somedomain.com -Alias maxwell.ext -OU "contoso.com/OU1/OU2"