I was almost positive I had written about this before, but seems I haven’t, so here goes.
The user profile store in SharePoint has several service accounts added to it from different Microsoft services running in SharePoint Online. Depending on your solution, these clutter up people search results and you might want to exclude them.
Below is a search for spo* on the SharePoint homepage illustrating these accounts.
In order to remove these accounts you can add the following to your query or query template:
-accountname:spo* -PreferredName:"Foreign Principal"
This will remove all accounts with an accountname starting with spo. If you think this will also remove some of your regular accounts you can do a more granular one:
-accountname:spofrm -accountname:spoapp -accountname:spocrawler -accountname:spocrwl -PreferredName:"Foreign Principal"
And we just have to hope that Microsoft don’t add more outside of this naming schema.
One thing to note is that you cannot edit the default “Local People Results” result source to make this a global exclusion. You can however create a query rule to append this to every query – but that might break other query rules so I would not recommend this.
This means you might not be able to fix SharePoint Home, but it works anywhere you have a search web part or can control the query being sent over.