@Prabhakar.Billingi , Thank you for reaching out. For the following api call https://graph.microsoft.com/v1.0/servicePrincipals/{id}/appRoleAssignedTo, you would need to feed this url with the servicePrincipal's object ID which is referred as the resouceId here.
To fetch the servicePrincipal's object ID, you can use the following API calls:
GET /servicePrincipals ---> This would list all the available service principals in your AAD tenant.
If you would only want to fetch the Object ID of a specific Service Principal then you can also consider running this API call along with the filter mentioned:
https://graph.microsoft.com/beta/serviceprincipals?$filter=startswith(displayName, 'Application-Name')
Running the above API would give you the output and from there you need to copy the guid value present under the id key. This value of the id key is the resource-id, that you can use in the following API "**https://graph.microsoft.com/v1.0/servicePrincipals/{id}/appRoleAssignedTo**"
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.