Tested on Windows and Ubuntu WSL2, 2026-10-29. This is an unofficial integration, not GitHub Copilot.
Pi (Windows or native Linux) -> localhost proxy -> work M365 Copilot
Pi keeps its normal file and shell tools. The proxy translates requests to M365 and emulates tool calls. Microsoft sign-in stays on Windows; Windows and Linux requests use separate conversation pools and OS instructions.
This uses the work account's Copilot allowance, not ChatGPT's. It does not automatically switch when a ChatGPT quota expires or migrate Codex conversations. Prompts, file contents and tool results go to the work tenant; employer policies and model limits still apply.
- A work/school account that can use M365 Copilot. Personal Microsoft Copilot and GitHub Copilot are different products.
- Windows, PowerShell 7, Git, Node 24+ and pnpm 10. The tested Pi version is
@earendil-works/pi-coding-agent@1.4.0. Edge is used for sign-in; setCHROMIUM_PATHif using another Chromium browser. - For WSL: current WSL2 with mirrored networking and a native Linux Node 22+ runtime. Windows executable interop must be enabled.
- The companion
m365-pi-support.zipbundle. It contains the local patch, server, helpers, launchers and example model configurations—not credentials.
The bridge is cramt/m365-copilot-proxy. These instructions reproduce the tested revision, rather than assuming its latest version is unchanged.
Examples use A:\apps\m365-copilot-proxy for the installation and A:\shims for commands. On the test system A: is a ReFS volume, a.k.a. Microsoft Dev Drive.
Substitute your preferred locations consistently in the supplied scripts and model configurations. Also adjust the WSL mount paths and native Node/Pi package paths.
git clone https://github.com/cramt/m365-copilot-proxy A:\apps\m365-copilot-proxy
cd A:\apps\m365-copilot-proxy
git checkout 65905e881d6597040966aff9b087aa9a908b358a
git apply --check C:\path\to\support\bridge-windows-wsl.patch
git apply C:\path\to\support\bridge-windows-wsl.patch
pnpm install --frozen-lockfile --ignore-scripts
pnpm --filter '@m365-copilot/proxy-lib...' build
pnpm exec vitest run packages/core packages/proxy-libThe local patch adds user-bound Windows encryption, interactive sign-in, and request-local Windows/Linux platform handling. Do not substitute the upstream default server if you want the same authentication and local-access protections.
- Copy the bundle's
localfiles into the bridge'slocaldirectory. Runlocal\initialize-local-key.ps1once as the Windows user who will run the proxy. It creates the encrypted local key and excludes local data from Git. - Merge
models\windows.jsoninto%USERPROFILE%\.pi\agent\models.json; keep existing providers. The example key is a command that reads the local proxy key, not a Microsoft token. - Copy the
windowslaunchers into a directory on PATH, such asA:\shims. There is no reason to put custom launchers in npm's package-bin directory. - Run
start-m365-proxyfor the first sign-in. Complete Microsoft SSO/MFA in the browser. Then usepi-m365from a project directory.
The server uses 127.0.0.1:4143, requires a random local key, and rejects browser-origin requests. Microsoft tokens and the key use Windows CurrentUser DPAPI encryption. Passwords and authenticator seeds are not stored. Debug payload logging is off, and automatic Copilot Studio agent creation is disabled. Keep the entire data directory private, including its browser profile.
pi-m365 only starts the proxy, selects an initial M365 model and uses a lean toolset. The provider is in ordinary Pi configuration: with the proxy running, use normal pi and /model, or:
pi --model m365/gpt-6.1-solCreate or merge this into Windows %USERPROFILE%\.wslconfig:
[wsl2]
networkingMode=mirroredSave Linux work, run wsl --shutdown from Windows, and reopen Ubuntu. This stops all WSL distributions. Mirrored mode provides direct Windows/WSL localhost access; no relay, LAN listener or new firewall rule is needed for this setup. Microsoft networking documentation
Merge models\wsl.json into Linux ~/.pi/agent/models.json. Its important differences are pwsh.exe in the key-helper command and the X-M365-Client-Platform: linux header. Do not copy Microsoft token caches into Linux.
Ensure pi actually runs Linux Node, not a Windows npm shim or node.exe. The supplied wsl/pi launcher uses native Node with the existing Windows Pi JavaScript package; adjust both paths, or use a separate native Linux Pi installation. Put it in ~/.local/bin if using this approach.
Install wsl/pi-m365 in a PATH directory, e.g. ~/.local/bin, or keep it in a shared shims directory and symlink it there. Make both scripts executable. Run hash -r if the shell cached an old pi path. The helper starts the Windows proxy, then runs Linux Pi with Bash tools.
Use /model to choose a configured route; reopening the picker reloads the configuration. The sample catalog includes Claude Sonnet 5/5.5, Opus 5.5, GPT-5.6 Quick/Think deeper, GPT-6, GPT-6.1 Sol and Auto. Routes and entitlements can change; a listed name alone is not proof it works.
M365 presets are not native low/medium/high effort controls:
m365/gpt-5.6:/thinking offselects the Quick route;/thinking highselects Think deeper.- Fixed-reasoning GPT entries expose only
high, meaning the M365 reasoning preset. GPT-6.1 Sol already reasons even if old metadata displayed thinking as off. - Claude/Auto do not advertise an unverified adjustable effort setting.
Check more than a chat response: have Pi read a toy program, fix a bug, and run its tests. Independently check the changed file and test results. In WSL, verify uname -s returns Linux and the working directory is the intended Linux project; in Windows, verify PowerShell runs. An unauthenticated /health request should return 401, not expose the API.
The tested setup passed 399 bridge unit tests, with 3 skipped, plus real Windows and Linux tool round trips. Linux bug-fix fixtures each passed all 3 tests without test changes.
Common traps: stale model lists, Node 18 in WSL, Windows shims winning PATH resolution, and unquoted comma-separated tool lists in PowerShell. Use the supplied quoted lists. Diagnose sign-in with the foreground start-m365-proxy; do not work around tenant access restrictions.
Stop with stop-m365-proxy. Before updating upstream, preserve the patch and support files and repeat the smoke tests. To clear local sign-in, stop the proxy and remove its encrypted MSAL cache and browser profile; that does not revoke other Microsoft sessions.