Azure AD graph has been deprecated and will be completely retired by June 30 of this year, and all features of Azure AD graph have been migrated to the latest Microsoft Graph, so I recommend that you use the Microsoft Graph API to get an application service principal.
GET https://graph.microsoft.com/v1.0/servicePrincipals?$filter=appId eq '{app id}'
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.