Here is what I use - setting $_.Userprincipalname to the account in question:
[array]$SkusToRemove = Get-MgUserLicenseDetail -UserId $_.Userprincipalname
Set-MgUserLicense -UserId $_.Userprincipalname -RemoveLicenses $SkusToRemove.skuId -AddLicenses @() -Confirm:$false
[https://practical365.com/microsoft-365-license-graph-sdk/