I have a multi-tenant app registration in Azure AD with permissions to Sites.Selected to use the Microsoft Graph API for reading/writing to SharePoint sites. Tenant B has successfully given admin consent through the generated admin consent link, resulting in an enterprise application in Tenant B. However, while I can access sites in Tenant A using the app registration, I receive an ‘invalid hostname for this tenancy’ error when trying to access sites in Tenant B.
How can I resolve this issue to access sites in Tenant B using the Microsoft Graph API?
Any help or guidance would be greatly appreciated. Thank you.
I tried calling “/sites/{hostName}:{serverRelativePath}” microsoft graph endpoint using a site from Tenant B which resulted in this error:
{"error":{"code":"invalidRequest","message":"Invalid hostname for this tenancy","innerError":{"date":"2024-07-04T08:03:02","request-id":"22ceb0ec-b377-4086-91ec-610ed637413f","client-request-id":"22ceb0ec-b377-4086-91ec-610ed637413f"}}}