If you have deleted a user in Exchange Online that is synced from onprem and you need to restore it, you might not want to re-sync the local user. In that case you can restore the deleted user directly in Exchange Online and make a cloud only user.

Get the deleted mailbox by name and Exchange GUI:

Get-Mailbox -SoftDeletedMailbox | Select-Object Name,ExchangeGuid

Create a new cloud only user or shared mailbox and run this command:

Get-Mailbox -Identity <NameOrAliasOfNewTargetMailbox> | Format-List ExchangeGuid

Restore the deleted mailbox/user into the newly created cloud user:

New-MailboxRestoreRequest -SourceMailbox <SoftDeletedMailboxGUID> -TargetMailbox <NewTargetMailboxGUID> –AllowLegacyDNMismatch

References:

https://learn.microsoft.com/en-us/exchange/recipients-in-exchange-online/delete-or-restore-mailboxes