An Azure service that provides a hybrid, multi-cloud management platform for APIs.
Hello Einat Gelbort,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you are having problem with api call to graph api.
Your production network is certainly enforcing Tenant Restrictions v2 / Universal Tenant Restrictions (or an equivalent proxy header), which blocks Graph data‑plane calls from that network, causing 403, while the same token works off‑network. Forcing traffic to a specific IP inadvertently bypassed the enforcement point, which is unsupported.
Follow the steps below in order to fix the issue:
- Verify token and permissions confirm the token matches the API: delegated needs
ChannelMessage.Read.All; app‑only needsChannelMessage.Read.GrouporChannelMessage.Read.All, and app‑only calls must be made in the channel owner’s tenant. Quick check:curl -H "Authorization: Bearer $TOKEN" "https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages?$top=20". See List channel messages and Resolve Graph auth errors. - Align consent model Ensure the granted permission type matches the token type (delegated vs application) and that admin consent is applied where required. If you use RSC, install the app in the team and use
ChannelMessage.Read.Group. See API permissions for channel messages. - Check for Tenant Restrictions enforcement From the production egress, verify whether Tenant Restrictions v2 or Universal Tenant Restrictions (Global Secure Access) are applied; these can block Graph data‑plane calls and yield 403 even with a valid token. Look for the TRv2 header (e.g.,
sec-Restrict-Tenant-Access-Policy). See Tenant restrictions v2 and Universal tenant restrictions. - Fix the policy (preferred) or isolate the workload In TRv2, allow your tenant/app (or the specific user group) so the Graph call is permitted from production; or exclude the service/principal or egress segment from Universal TR enforcement. Admins configure this in Cross‑tenant access settings and Global Secure Access. See Tenant restrictions v2 and Universal tenant restrictions.
- Remove IP pinning; use supported network controls Drop hardcoded IPs and rely on the Microsoft 365 endpoints service (Optimize/Allow) and supported service tags instead of static addresses; this is the recommended, durable approach for Graph connectivity. See Microsoft 365 URLs & IP ranges and Managing Microsoft 365 endpoints.
- Re‑test and keep Graph identifiers Re‑run the same request without IP pinning; it should now return 200. If anything fails, capture
request-idand UTCDatefrom response headers for escalation, per Microsoft’s troubleshooting practice. See Resolve Graph authorization errors.
I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.