Overview
Microsoft Graph Developer proxy is a tool that helps to simulate elusive API errors that might typically occur in specific circumstances (e.g: in the Production environment). It helps you build logic into your code to handle these errors during development. It is not uncommon for errors to occur arbitrarily in the production environment and to be difficult to detect during the development process due to environment-dependent factors. These errors typically occur when the application is used at scale or occurs in specific circumstances. By using the Microsoft Graph Developer proxy, you can simulate these errors and verify that your application handles them gracefully if they occur. Providing best practices and help creating highly resilient applications is the aim of the tool.
Consider the following scenario, a time-sensitive enterprise application is built using API integration. Before it is approved for PROD deployment, it is thoroughly tested by developers and also tested with pilot users. However, when it is deployed to PROD users report the issue and they receive the generic exception message “System encountered an issue” or “Error Occurred”. Due to the time-sensitive nature of the application, this can create chaos as the user is unable to comprehend what is going on.
Upon investigation, it is found that this issue occurs when the API returns HTTP error 429 which was not reproducible in the dev environment. Microsoft Graph developer proxy is useful in these cases where you can simulate the API errors in the dev environment and address these errors by handling exceptions gracefully. Furthermore, it allows users(developers) to mock API responses to ensure that the response can be handled appropriately in the integrated application.
Advantages of Microsoft Graph Developer Proxy
- Operating System agnostic (you can run it on Windows, Mac or Linux)
- It allows developers to test their code against the APIs by simulating errors.
- By intercepting HTTP requests with mock responses, it is easier to test API-related code and handle exceptions properly.
- Provide API guidance and best practices recommendation, e.g.: notifications of request to Microsoft Graph beta API, using $select parameter etc.
- Developers can control proxy settings by using parameters, such as throttling rate, port, and HTTP error messages.
- Support for recording request logs and analyze in the context of other requests.
Prerequisites for using Microsoft Graph Developer Proxy
To use the Microsoft Graph Developer Proxy, you'll need to have the following prerequisites,
- Download the ZIP file for your operating system.
- Extract the contents of the ZIP into a folder.
Once you have these downloaded, you can use the following steps to configure the Microsoft Graph Developer Proxy. These steps are required only for initial setup:
- Open a command prompt or terminal window on your computer.
- Navigate to the directory where you have installed the Microsoft Graph Developer Proxy
- Start the proxy by running the "mgdp" command. You will get a security warning message to install certificate, click "yes" on below prompt. In order to decrypt HTTPS traffic sent from your machine, the proxy uses this certificate. This certificate will be installed in the Certificate store >> Current User >> Personal >> Certificates folder.
- Windows Defender Firewall prompt will be displayed, click "Allow access". This will allow the traffic through firewall.

The getting started documentation for the Microsoft Graph Developer Proxy can be found at the following link: https://github.com/microsoftgraph/msgraph-developer-proxy
How to use Microsoft Graph Developer Proxy
Once the prerequisites settings are completed, open a command prompt or terminal window on your computer, navigate to the directory where you have installed the Microsoft Graph Developer Proxy and start the proxy by running the "mgdp" command.

Following information is displayed when a request is intercepted using the proxy:
- Request - URL of the API intercepted
- Chaos - HTTP error code with error message.
- Warning - Guidance to build better apps like use $select for better performance in Microsoft Graph API requests etc.
- Tip - Tip to improve the API request like user Microsoft Graph SDK etc.
You can also record the request logs.
To start recording:
- Use the `–record` argument when starting the proxy, or
- press r (for record) on the keyboard
To stop recording:
- press s (for stop) on the keyboard.
Proxy can be stopped by using Ctrl+C
Configuration
All the default configuration settings are fetched from the "appsetttings.json" file located in the directory where you have installed the Microsoft Graph Developer Proxy, however you have an option to override the settings by-passing parameters in the command itself as shown below:
mgdp --no-mocks --allowed-errors 429 --failure-rate 100
There are two important files, appsettings.json and responses.json in the downloaded folder which provides control on how to use the Microsoft Graph Developer Proxy :
Appsettings. json
In this file there are several settings that you can use to control how you would like to configure the proxy. By default, Microsoft Graph and Sharepoint API's are configured in to "urlsToWatch" array of URL's. If you want to intercept requests to your custom API, add the URL of your API in this array in the same format.

rate(failureRate) and allowedErrors are other crucial configurations which are helpful to simulate errors and handle exceptions.


Join the conversation! Your thoughts help the community grow.