Organization that owns this resource has a policy that prevents access form people in the domain
Error
One of the tenants I manage was running into this error:
The organization that owns this resource has a policy that prevents access from people in the domain you're currently signed in to. If you think you should have access, please contact the person who sent you the link to this resource.
So let's dig in and troubleshoot this bad boy.
Troubleshooting
Check Microsoft Entra sign-in logs and audit logs
The first this we'll need is to know who was attempting to access a file. Then, we'll need to know what file they were attempting to access. With that information we'll be able to go to the Microsoft Entra Admin Center > Users > All users > search for the user attempting to access the file and check their sign-in logs and their Audit logs for errors. If we don't have any errors, there we'll need to look at the SharePoint admin center next.
Check SharePoint Admin center
Verify External sharing
Next, we'll open the SharePoint admin center > Policies > Sharing. From there, we'll check the External sharing limits. Be sure it's set to Anyone, New and existing guests, or existing guests.
Verify Limit external sharing by domain
If that's setup correctly, we'll need to verify the external sharing is not limited to specific domains. We can see that setting under More external sharing settings > Limit external sharing by domain. In my case that's where the issue was. I see the Limit external sharing by domain is checked and there is a limited number of domains in the list.
Check site permissions
If I was still having an issue the next place, I would check is the site sharing permissions. I would verify the site by going to Site > Active sites. Click the site name and go to Settings. Check the External file sharing permissions are set to New and existing guests, or anyone. Then click More sharing settings. Verify those settings allow sharing with new and existing guests, specific people, or people with existing access. Click Advanced settings for external sharing and verify the Limit sharing by domain is unchecked.
Testing myself
The next thing I would do is test the issue myself. In short, I would share the file with my own work account and possibly a personal Gmail account too. That way I can see if I'm having the issue. If I was having the issue myself, I could continue to troubleshoot without interrupting the user. If I wasn't having the issue and the user was, I'd remove their permissions from the file and reshare the file to them.