In my opinion this is a terrible answer and doesn't address Robert's question. I'm seeking an answer to the same question.
The question concerns removing an AzureAD user profile which by definition is not a local user. When I use "Get-localuser" none of the AzureAD profiles are displayed.
The Windows device in question is Azure AD joined and numerous users have logged in to the device and are utilizing disk space but no longer use the device. The goal is to remove AzureAD profile and any disk space associated with the user, but not prevent the user from logging in again in the future and creating a new profile.
Is there a simple way to accomplish this from powershell?
P.S. I queried ChatAI to answer this question and it responded with
Remove-AzureADUser -objectId "*** Email address is removed for privacy ***"
which goes to show you can't always trust AI as that removes the user from AzureAD not their profile from local device!
I did find that you can accomplish the task manually by entering
"Advance System Settings" in Windows search
Click on Advanced | User Profiles | Settings
From there you can properly delete any AzureAD profiles on the local device.
How to do that from powershell remains the outstanding question.
Also see spiceworks.com article 2336982-how-to-remove-user-s-azure-ad-profile-from-windows-10-pc
for how to set user profiles to automatically expire in X days of inactivity which is perhaps an even better answer.