The official KB lists some possible causes when running this command Set-FederatedOrganizationIdentifier and get the error "An unexpected error occurred on a send"
I would suggest you firstly check if your issue is related to TLS1.2, please make sure your on-premises environment supports TLS 1.2, just like this similar error discussed: Hybrid Configuration Wizard Stuck on adding federated domains
Exchange Server TLS guidance Part 2: Enabling TLS 1.2 and Identifying Clients Not Using It
Exchange Server TLS guidance Part 3: Turning Off TLS 1.0/1.1
And after performing the operations above, verify the result again, and check if anything else missed introduced in the KB above.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.