关于测试自定义Graph API节流限制及超限通知的管理员问询
Customizing Outlook Service Throttling Limits
Unfortunately, you can’t manually reset the default Outlook service throttling limits (from 10,000 requests in 10 minutes to 100) through official admin settings or Graph API controls. These limits are predefined by Microsoft to maintain global service stability across all tenants, and there’s no built-in option to lower them for your environment.
If you need to simulate a stricter throttling scenario for testing, you’ll have to implement client-side throttling in your application code. For example, you could use a token bucket algorithm to cap your own request rate at 100 per 10 minutes. Here’s a simplified Python example to illustrate this:
import time from collections import deque # Track timestamps of the last 100 requests request_timestamps = deque(maxlen=100) def make_throttled_graph_request(): current_time = time.time() # Remove timestamps older than 10 minutes (600 seconds) while request_timestamps and current_time - request_timestamps[0] > 600: request_timestamps.popleft() if len(request_timestamps) >= 100: # Calculate wait time until the oldest request falls out of the window wait_duration = 600 - (current_time - request_timestamps[0]) time.sleep(wait_duration) request_timestamps.popleft() # Record the current request timestamp and execute the API call request_timestamps.append(current_time) # ... Add your actual Graph API request logic here ...
Throttling Limit Exceed Notifications for Admin Accounts
Yes, as a tenant admin, you can set up alerts and track throttling events through these methods:
- Azure Monitor Alerts: Configure alerts in the Azure Portal to trigger notifications (email, SMS, or webhook) when throttling occurs. You can filter logs for Graph API requests returning HTTP 429 status codes (the standard throttling response) and create a rule to alert you whenever these events are detected.
- Response Header Tracking: When your app hits a throttling limit, the Graph API response includes headers like
Retry-After(tells you how long to wait before retrying) andx-ms-throttle-limit(shows the current limit and remaining requests). You can log these headers in your application and build custom alerting based on threshold breaches. - Azure AD Audit Logs: Check Azure AD’s audit logs to track which apps or users are frequently hitting throttling limits. These logs can help you identify problematic usage patterns and adjust your application logic accordingly.
内容的提问来源于stack exchange,提问作者RohitK




