If you want to remove the AD account and Shared Mailbox completely, use the first command and run it On-PREM
Remove-RemoteMailbox ******@contoso.com
This will also delete the account in Azure on the next AADConnect sync.
https://learn.microsoft.com/en-us/powershell/module/exchange/remove-remotemailbox?view=exchange-ps