This sample contains a demo web application connected to Microsoft Graph. Using Dev Proxy, you can simulate random errors returned by Microsoft Graph and see how the app handles them.
- Ensure that the Entra App Registration is completed as described in the Configure Azure AD App Registration section
- Start the sample app by running
npx lite-server
- Start Dev Proxy with the Microsoft 365 preset by running
devproxy --config-file "~appFolder/presets/m365.json"
- In a web browser, navigate to
http://localhost:3000
and interact with the sample app to see how it handles random errors
There are two ways which you can configure the App Registration required for the samples to work correctly, through automation using either a bash
or pwsh
script we provide for you in the scripts
directory, or manually through Azure Portal.
Note that the script will create a file called
env.js
, in the root of thesamples
directory. This file contains the client ID of the application registration that is created.
The script uses CLI for Microsoft 365 to authenticate with and create the app registration in your tenant, therefore requires nodejs, v8 or greater to be installed
PS > cd ./samples/
PS > ./scripts/setup.ps1
Follow the prompts in the terminal.
The script uses CLI for Microsoft 365 to authenticate with and create the app registration in your tenant, therefore requires nodejs, v8 or greater to be installed
$ > cd ./samples/
$ > chmod +x /scripts/setup.sh
$ > ./scripts/setup.sh
Follow the prompts in the terminal.
The following table provides details of how to configure your app registration.
Property | Value |
---|---|
Name | dev-proxy-samples |
Account types | Accounts in any organizational directory (Any Azure AD directory - Multitenant) |
Platform type | Single-page application |
Redirect URIs | http://localhost:3000/withsdk.html http://localhost:3000/nosdk.html |
API Permissions | Microsoft Graph User.Read.All (Delegate) w/ Admin Consent Presence.Read.All |
After creating the app registration, create a file called env.js
in the root of the samples
directory with the following contents, replacing <clientid>
with the value which can be copied from the portal.
const appId = '<clientid>';
This sample is created from the Sample Reference already available in the Microsoft 365 Dev Proxy Samples which is created and pubished by Waldek Mastykarz.
THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.