In this blog, we will see the steps involved to remove external user from your Office 365 subscription . There is a chance that, you may have to remove the external users after adding them to the member groups.
Please ensure that you connect to sharepoint online powershell to execute the below commands.
$credentials = Get-Credential
Connect-SPOService -Url https://mysharepoint.admin.sharepoint.com -Credential $cred
$ExternalUser = Get-SPOExternalUser -filter email@example.com
Remove-SPOExternalUser -UniqueIDs @($ExternalUser .UniqueId)
Happy SharePointing 🙂