@PrabhakarBillingi-9819, The following API call "https://graph.microsoft.com/beta/serviceprincipals?$filter=startswith(displayName, 'Application-Name')", would get you the service principal ID of the mentioned service-principal name that you have mentioned in the "Application-Name" section of the above api call.
Now, the following API call "**https://graph.microsoft.com/v1.0/servicePrincipals/{id}/appRoleAssignedTo**", would get you the AppRoleAssigments present on this Service Principal.
The API call "**https://graph.microsoft.com/v1.0/oauth2PermissionGrants**" would get you the API Permissions that you have set on this application.
AppRoleAssignments and OAuth2Permissions are two different things. All these entities (AppRoleAssigment, OAuth2Permissions etc) are tied to a specific Application (service-principal) registered in AAD and Applications registered to AAD are always tenant specific. Applications registered in a specific tenant would be visible only under that specific tenant.
Event Application registered in AAD would have two broad objects:
- Application Object
- Service Principal Object
Both these objects would have separate object IDs and these object IDs would only be visible under the tenant where they are registered.
Do let me know the exact end goal of yours so that accordingly I can share the powershell cmdlets too. There are Powershell cmdlets available to achieve the same task as the powershell cmdlets use the same Graph APIs in the backend.
Hope this helps.
Do let us know if this helps and if there are any more queries around this, please do let us know so that we can help you further. Also, please do not forget to accept the response as Answer; if the above response helped in answering your query.