"Name" is not a identifier you should be using, not for SPs, not for users, not for any object within Azure AD. As you've mentioned above it's not uniquely-valued, so it should only be used for display purposes and not looking up the actual object.
As for your other question, read this article to understand the difference/relationship between app and SP objects: https://learn.microsoft.com/en-us/azure/active-directory/develop/app-objects-and-service-principals
Technical Query : Reason behind some Service principal features
Recently observed that one can create multiple Service principals with the same name in Azure AD .
Note: They have different clientIds but same name. This in turn creates issues while creating users within Azure SQL. So any reason why same name App Ids are allowed in AAD?
Also , a same client ID has different objectid when looked up via Enterprise applications and when seen via AppIs it because Enterprise applications is a union of all managed identities, Service principals etc , the objectid creation for Enterprise applications is different as compared to App registrations. registrations.
-
Vasil Michev 105.7K Reputation points MVP
2021-02-15T09:31:59.723+00:00