Disaster Recovery & Device Migration Guide¶
What This Guide Covers¶
A complete, step-by-step runbook for restoring your entire Copilot CLI environment from scratch — whether you're moving to a new device, rebuilding after a wipe, or migrating from your Enterprise GitHub account (ssutheesh_microsoft) to a personal GitHub Pro account (susanthgit).
☕ Cloud Café Analogy
Imagine your entire café — recipes, staff rosters, supplier contacts, kitchen layout, equipment list — all written down in a single binder. This guide IS that binder. If your café burns down, you can open a new one in days using this.
Architecture — What Makes Up Your Environment¶
┌──────────────────────────────────────────────────┐
│ YOUR PC (C:\ssClawy) │
│ │
│ ~/.copilot/ │
│ ├── copilot-instructions.md ← Brain │
│ ├── copilot-instructions-reference.md ← Memory │
│ ├── mcp-config.json ← MCP servers │
│ ├── secrets/github-personal-pat ← Auth │
│ ├── backup-instructions.ps1 ← This backup │
│ ├── config.json ← CLI config │
│ ├── permissions-config.json ← Permissions │
│ ├── skills/ ← Custom skills│
│ └── session-state/ ← History │
│ │
│ C:\ssClawy\ │
│ ├── aguidetocloud-revamp/ ← Main website │
│ ├── ainews/ ← AI News pipeline │
│ ├── learning-docs/ ← Learning portal │
│ └── (12+ other repos) ← Reference/tools │
│ │
│ %APPDATA%\npm\node_modules\ │
│ └── youtube-channel-mcp\ ← YouTube OAuth │
│ ├── credentials.json │
│ └── tokens.json │
│ │
│ Windows Terminal settings.json │
│ PowerShell profile │
└──────────────────────────────────────────────────┘
│
│ Twice daily (08:00 + 18:00, Scheduled Task)
▼
┌─────────────────────────┐ ┌──────────────────────┐
│ Personal OneDrive │───▶│ Google Drive │
│ ~/OneDrive/ │ │ G:\My Drive\ │
│ CopilotCLI_Backups/ │ │ CopilotCLI_Backups\ │
│ ├── snapshots/ │ │ (mirror) │
│ ├── session-mirror/ │ │ │
│ ├── ssclawy-mirror/ │ │ │
│ └── system-mirror/ │ │ │
└─────────────────────────┘ └──────────────────────┘
What's in the Backup (Complete Inventory)¶
✅ Automatically Backed Up (twice daily at 08:00 + 18:00)¶
v3 tiered design (since 2026-05-09)
Backups now use 4 tiers: snapshots/ (versioned config), session-mirror/ (history), ssclawy-mirror/ (working folder minus build artifacts), system-mirror/ (Azure CLI, OBS, Pictures). See Backup Setup for the full design.
| Item | Backup Location | Purpose |
|---|---|---|
copilot-instructions.md |
snapshots/snapshot_*/ |
Your Copilot CLI personality & rules |
copilot-instructions-reference.md |
snapshots/snapshot_*/ |
Detailed project context & reference data |
mcp-config.json |
snapshots/snapshot_*/ |
MCP server definitions (contains Entra secrets) |
secrets/github-personal-pat |
snapshots/snapshot_*/secrets/ |
GitHub PAT for personal repos |
config.json, permissions-config.json |
snapshots/snapshot_*/ |
CLI configuration & tool permissions |
backup-instructions.ps1 |
snapshots/snapshot_*/ |
The backup script itself |
skills/ |
snapshots/snapshot_*/skills/ |
Custom Copilot skills |
session-state/ (no events.jsonl) |
session-mirror/ |
Session history & artifacts (live mirror) |
session-store.db |
snapshots/snapshot_*/ |
Searchable index of all past sessions |
| YouTube OAuth credentials | snapshots/snapshot_*/youtube-mcp-creds/ |
Google OAuth tokens for YouTube MCP |
| Windows Terminal settings | snapshots/snapshot_*/windows-terminal-settings.json |
Custom keybindings & profile |
environment-manifest.json |
snapshots/snapshot_*/ |
Auto-generated: tool versions, npm globals, pip packages, repo list |
| System configs (git, npm, gh CLI, VS Code user, hosts, PSReadLine, scheduled task XML) | snapshots/snapshot_*/system-configs/ |
Critical for new-device restore |
| VS Code extensions list | snapshots/snapshot_*/system-configs/vscode-extensions.txt |
One-shot reinstall on new device |
C:\ssClawy\ (full working folder, minus build artifacts and customer-research-private/) |
ssclawy-mirror/ |
All planets, sites, tools, Connect tracking (live mirror) |
learning-docs/ source |
ssclawy-mirror/learning-docs/ |
MkDocs Markdown + config (subsumed by ssclawy-mirror) |
~/.azure/ Azure CLI auth |
system-mirror/azure-cli/ |
Subscription/profile data |
%APPDATA%/obs-studio/ |
system-mirror/obs-studio/ |
OBS Studio profiles for YouTube recording |
~/Pictures/ |
system-mirror/Pictures/ |
Personal photos folder |
❌ NOT Backed Up (by design — reinstall or re-authenticate)¶
| Item | Why Not | How to Restore |
|---|---|---|
mcp-servers/ (~50 MB) |
Installed packages — reinstall from npm | npm install per server |
logs/ (~24 GB) |
Temporary session logs | Regenerated automatically |
events.jsonl files (in session folders) |
Runtime telemetry, ~3.7 GB savings | Regenerated as you use sessions |
crash-reports/, m-playwright-profiles/, m-sessions/ |
Runtime/transient | Regenerated automatically |
installed-plugins/, bin/, ide/, heartbeat/ |
Runtime, regenerated on first run | Auto |
node_modules/, dist/, .astro/, .next/, bin/, obj/ etc. in C:\ssClawy\ |
Build artifacts — recreated by npm install etc. |
npm install / framework's build command |
customer-research-private/ |
🛡️ Privacy guardrail — Microsoft customer data must NOT go to Personal cloud | Restore from your Corp OneDrive separately |
~/Downloads/ |
Too large, rarely permanent | Re-download as needed |
session-store.db-shm, .db-wal |
SQLite runtime temp files | Regenerated automatically |
site/ folders |
Built output | mkdocs build or hugo --minify |
🔐 Credentials & Secrets (Where They Live)¶
| Secret | Location | Backed Up? | How to Recreate |
|---|---|---|---|
| GitHub personal PAT | ~/.copilot/secrets/github-personal-pat |
✅ | Generate new at github.com/settings/tokens |
| Entra client secret | Inside mcp-config.json |
✅ | Azure Portal → App registrations |
| YouTube OAuth | %APPDATA%\npm\...\youtube-channel-mcp\ |
✅ | Google Cloud Console → OAuth consent |
| NewsAPI key | GitHub Actions secret on -ainews |
❌ (in cloud) | newsapi.org dashboard |
| Azure SWA tokens | GitHub Actions secrets | ❌ (in cloud) | az staticwebapp secrets list |
| OIDC federated credentials | Azure AD app registration | ❌ (in cloud) | Azure Portal → App registrations → Certificates |
Scenario 1: New Device (Same GitHub Accounts)¶
Estimated time: 30–45 minutes
Phase 1 — Install Base Tools (10 min)¶
Open PowerShell and install:
# 1. Git
winget install Git.Git
# 2. Node.js (LTS)
winget install OpenJS.NodeJS.LTS
# 3. Python 3.12
winget install Python.Python.3.12
# 4. PowerShell 7
winget install Microsoft.PowerShell
# 5. GitHub CLI
winget install GitHub.cli
# 6. Azure CLI
winget install Microsoft.AzureCLI
# 7. Hugo Extended
winget install Hugo.Hugo.Extended
# 8. Azure SWA CLI
npm install -g @azure/static-web-apps-cli
# 9. Google Drive for Desktop
# Download: https://www.google.com/drive/download/
# Sign in — will mount as G:\ drive
Check versions against the manifest
Your backup includes environment-manifest.json with exact versions. Compare after install:
Phase 2 — Restore Copilot CLI Config (5 min)¶
# Find the latest snapshot (Tier 1)
$latestBackup = Get-ChildItem "G:\My Drive\CopilotCLI_Backups\snapshots\snapshot_*" -Directory |
Sort-Object Name -Descending | Select-Object -First 1
# Create .copilot directory
New-Item -ItemType Directory -Path "$env:USERPROFILE\.copilot" -Force | Out-Null
# Copy config files (top-level + small folders) — but skip the system-configs/ folder,
# we'll restore that to OS locations in step 2b
Get-ChildItem "$($latestBackup.FullName)" -File |
Copy-Item -Destination "$env:USERPROFILE\.copilot\" -Force
Get-ChildItem "$($latestBackup.FullName)" -Directory |
Where-Object { $_.Name -notin @('system-configs', 'youtube-mcp-creds') } |
ForEach-Object { Copy-Item $_.FullName "$env:USERPROFILE\.copilot\$($_.Name)" -Recurse -Force }
# Restore session history from Tier 2 mirror
robocopy "G:\My Drive\CopilotCLI_Backups\session-mirror" "$env:USERPROFILE\.copilot\session-state" /MIR
Write-Host "✅ Restored from: $($latestBackup.Name)"
Phase 2b — Restore System Configs (2 min)¶
$sysCfg = "$($latestBackup.FullName)\system-configs"
# Global git config + npmrc
if (Test-Path "$sysCfg\.gitconfig") { Copy-Item "$sysCfg\.gitconfig" "$env:USERPROFILE\.gitconfig" -Force }
if (Test-Path "$sysCfg\.npmrc") { Copy-Item "$sysCfg\.npmrc" "$env:USERPROFILE\.npmrc" -Force }
# GitHub CLI auth
if (Test-Path "$sysCfg\github-cli") {
Copy-Item "$sysCfg\github-cli\*" "$env:APPDATA\GitHub CLI\" -Recurse -Force
}
# VS Code user settings + snippets
if (Test-Path "$sysCfg\vscode-user") {
Copy-Item "$sysCfg\vscode-user\*" "$env:APPDATA\Code\User\" -Recurse -Force
}
# Reinstall VS Code extensions from list
if (Test-Path "$sysCfg\vscode-extensions.txt") {
Get-Content "$sysCfg\vscode-extensions.txt" | ForEach-Object { code --install-extension $_ }
}
# Hosts file (requires admin)
if (Test-Path "$sysCfg\windows-hosts") {
Copy-Item "$sysCfg\windows-hosts" "$env:WINDIR\System32\drivers\etc\hosts" -Force
}
# PSReadLine history
if (Test-Path "$sysCfg\psreadline-history.txt") {
$psHistDir = "$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine"
New-Item -ItemType Directory -Path $psHistDir -Force | Out-Null
Copy-Item "$sysCfg\psreadline-history.txt" "$psHistDir\ConsoleHost_history.txt" -Force
}
# Azure CLI auth (Tier 4)
if (Test-Path "G:\My Drive\CopilotCLI_Backups\system-mirror\azure-cli") {
robocopy "G:\My Drive\CopilotCLI_Backups\system-mirror\azure-cli" "$env:USERPROFILE\.azure" /MIR
}
Phase 3 — Restore YouTube MCP Credentials (2 min)¶
# Install the YouTube MCP server
npm install -g youtube-channel-mcp
# Copy OAuth credentials from backup
$ytBackup = "$($latestBackup.FullName)\youtube-mcp-creds"
$ytTarget = "$env:APPDATA\npm\node_modules\youtube-channel-mcp"
Copy-Item "$ytBackup\credentials.json" "$ytTarget\" -Force
Copy-Item "$ytBackup\tokens.json" "$ytTarget\" -Force
Phase 4 — Restore Windows Terminal Settings (1 min)¶
$wtTarget = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState"
Copy-Item "$($latestBackup.FullName)\windows-terminal-settings.json" "$wtTarget\settings.json" -Force
Phase 5 — Authenticate CLIs (5 min)¶
# GitHub CLI — EMU account (interactive)
gh auth login
# Azure CLI
az login
# Set Azure subscription (lab tenant)
az account set --subscription "ME-M365CPI52224224-ssutheesh-1"
Phase 6 — Clone Repos (5 min)¶
# Create working directory
New-Item -ItemType Directory -Path "C:\ssClawy" -Force | Out-Null
Set-Location "C:\ssClawy"
# Read repo manifest and clone each one (only needed if you didn't restore C:\ssClawy from Tier 3 mirror)
$manifest = Get-Content "$($latestBackup.FullName)\environment-manifest.json" | ConvertFrom-Json
$manifest.repos | ForEach-Object {
if (-not (Test-Path "C:\ssClawy\$($_.name)")) {
Write-Host "Cloning $($_.name)..."
git clone $_.remote $_.name 2>&1 | Out-Null
}
}
Personal repos need PAT
Repos under susanthgit (aguidetocloud-revamp, -ainews, learning-docs) use a PAT-authenticated URL. After cloning, update the remote:
$pat = Get-Content "$env:USERPROFILE\.copilot\secrets\github-personal-pat"
@('aguidetocloud-revamp', 'ainews', 'learning-docs') | ForEach-Object {
$dir = "C:\ssClawy\$_"
if (Test-Path $dir) {
$remote = git -C $dir remote get-url origin
$authed = $remote -replace 'https://', "https://x-access-token:$pat@"
git -C $dir remote set-url origin $authed
}
}
Phase 7 — Restore Learning Portal & C:\ssClawy Working Folder (3 min)¶
# Restore the entire C:\ssClawy working folder from Tier 3 mirror
# (preserves all uncommitted work, planet sites, Connect tracking, screenshots, etc.)
robocopy "G:\My Drive\CopilotCLI_Backups\ssclawy-mirror" "C:\ssClawy" /MIR /XJ
# OR if you prefer to re-clone from git (cleaner but loses uncommitted work):
# Use environment-manifest.json (Phase 6) to re-clone each repo
# Build the learning portal
cd C:\ssClawy\learning-docs
pip install mkdocs-material mkdocs-print-site-plugin
mkdocs build
Phase 8 — Install NPM Globals (3 min)¶
# Read from manifest and install
$manifest = Get-Content "$($latestBackup.FullName)\environment-manifest.json" | ConvertFrom-Json
$manifest.npm_global | ForEach-Object {
$pkg = $_ -replace '@\d.*$', '' # strip version for latest
Write-Host "Installing $pkg..."
npm install -g $pkg 2>&1 | Out-Null
}
Phase 9 — Re-create Scheduled Task (1 min)¶
The backup task XML is included in every snapshot. Restore it with one command:
$xml = Get-Content "$($latestBackup.FullName)\system-configs\scheduled-tasks\CopilotCLI_BackupInstructions.xml" -Raw
Register-ScheduledTask -TaskName "CopilotCLI_BackupInstructions" -Xml $xml -User "$env:USERNAME"
Or recreate manually (open PowerShell as Administrator):
$action = New-ScheduledTaskAction `
-Execute "pwsh.exe" `
-Argument '-NoProfile -WindowStyle Hidden -File "C:\Users\ssutheesh\.copilot\backup-instructions.ps1"'
# Twice daily: 08:00 and 18:00
$trigger1 = New-ScheduledTaskTrigger -Daily -At "08:00"
$trigger2 = New-ScheduledTaskTrigger -Daily -At "18:00"
$settings = New-ScheduledTaskSettingsSet `
-AllowStartIfOnBatteries `
-DontStopIfGoingOnBatteries `
-StartWhenAvailable
Register-ScheduledTask `
-TaskName "CopilotCLI_BackupInstructions" `
-Action $action `
-Trigger @($trigger1, $trigger2) `
-Settings $settings `
-Description "Twice-daily backup of Copilot CLI config + working folder to Personal OneDrive (mirrored to Google Drive)"
Phase 10 — Verify Everything Works¶
# Test Copilot CLI
gh copilot --version
# Test GitHub auth
gh auth status
# Test Azure CLI
az account show
# Test Hugo build
cd C:\ssClawy\aguidetocloud-revamp && hugo --minify
# Test MkDocs build
cd C:\ssClawy\learning-docs && mkdocs build
# Run a backup to confirm
& "$env:USERPROFILE\.copilot\backup-instructions.ps1"
Scenario 2: Migrate from EMU (ssutheesh_microsoft) to Personal GitHub Pro (susanthgit)¶
This is a bigger change
Your EMU account is managed by Microsoft. If you leave or the org changes policies, you could lose access. This section documents how to ensure all your important repos and workflows are on your personal account.
What Lives Where Today¶
| Repo | Account | Action Needed |
|---|---|---|
aguidetocloud-revamp |
susanthgit ✅ |
None — already personal |
-ainews |
susanthgit ✅ |
None — already personal |
learning-docs |
susanthgit ✅ |
None — already personal |
sveltia-cms-auth |
susanthgit ✅ |
None — already personal |
| Various Microsoft repos | microsoft/* |
Read-only forks — no action needed |
GitHub CLI Auth After Migration¶
If you stop using the EMU account entirely:
# Remove EMU account
gh auth logout -h github.com -u ssutheesh_microsoft
# Login with personal account
gh auth login -h github.com
# Verify
gh auth status
Update Git Remotes¶
All repos in C:\ssClawy\ that point to Microsoft org repos are read-only references (cloned for learning). They don't need migration.
Your personal repos already use the susanthgit account. Just ensure the PAT is valid:
# Check PAT expiry
$pat = Get-Content "$env:USERPROFILE\.copilot\secrets\github-personal-pat"
gh api -H "Authorization: token $pat" /user --jq '.login'
# Should output: susanthgit
Azure Resources (No Change Needed)¶
Your Azure resources are in your personal lab subscription, not tied to the EMU account:
| Resource | Subscription | How to Access |
|---|---|---|
| Main site SWA | ME-M365CPI52224224-ssutheesh-1 | az login with Microsoft account |
| Learning portal SWA | Same | Same |
| AI News (ainews-openai) | Same | OIDC federated credentials |
OIDC Federated Credentials¶
These are tied to an Azure AD app registration, which uses your personal GitHub repo as the subject:
No change needed if staying on susanthgit. If you ever move the repo, update the federated credential subject in Azure Portal → App registrations → Certificates & secrets → Federated credentials.
GitHub Actions Secrets to Re-create¶
If starting fresh on a new GitHub account, re-create these secrets on each repo:
susanthgit/aguidetocloud-revamp:
| Secret | Where to Get |
|---|---|
AZURE_STATIC_WEB_APPS_API_TOKEN |
az staticwebapp secrets list --name "aguidetocloud-revamp" --resource-group "ssClawy" --query "properties.apiKey" -o tsv |
susanthgit/-ainews:
| Secret | Where to Get |
|---|---|
AZURE_CLIENT_ID |
Azure Portal → App registrations → ainews app → Application (client) ID |
AZURE_TENANT_ID |
Azure Portal → App registrations → ainews app → Directory (tenant) ID |
AZURE_SUBSCRIPTION_ID |
az account show --query id -o tsv |
NEWSAPI_KEY |
newsapi.org → Dashboard → API Key |
PERSONAL_PAT |
github.com/settings/tokens (fine-grained, scoped to repos) |
MAIN_SITE_SWA_TOKEN |
Same as aguidetocloud-revamp SWA token above |
susanthgit/learning-docs:
| Secret | Where to Get |
|---|---|
AZURE_STATIC_WEB_APPS_API_TOKEN |
az staticwebapp secrets list --name "sutheesh-learning-hub" --resource-group "ssClawy" --query "properties.apiKey" -o tsv |
Scenario 3: YouTube MCP OAuth Re-setup¶
If the YouTube OAuth tokens expire or get revoked:
- Go to Google Cloud Console → project
aguidetocloud-mcp - APIs & Services → Credentials → OAuth 2.0 Client IDs
- Download the client JSON → save as
credentials.json - Place in
%APPDATA%\npm\node_modules\youtube-channel-mcp\ - Run the MCP server once to trigger the OAuth consent flow:
- Complete the browser OAuth flow —
tokens.jsonwill be created automatically
Quick Reference — File Paths Cheat Sheet¶
| What | Path |
|---|---|
| Copilot CLI config | ~\.copilot\ |
| Custom instructions | ~\.copilot\copilot-instructions.md |
| Reference context | ~\.copilot\copilot-instructions-reference.md |
| MCP server config | ~\.copilot\mcp-config.json |
| GitHub PAT | ~\.copilot\secrets\github-personal-pat |
| Backup script | ~\.copilot\backup-instructions.ps1 |
| YouTube MCP creds | %APPDATA%\npm\node_modules\youtube-channel-mcp\ |
| Windows Terminal | %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_*\LocalState\settings.json |
| Working directory | C:\ssClawy\ |
| Main website source | C:\ssClawy\aguidetocloud-revamp\ |
| AI News pipeline | C:\ssClawy\ainews\ |
| Learning portal source | C:\ssClawy\learning-docs\ |
| OneDrive backup | ~\OneDrive\CopilotCLI_Backups\ |
| Google Drive backup | G:\My Drive\CopilotCLI_Backups\ |
Change Log¶
| Date | Change |
|---|---|
| 2026-04-04 | Initial DR guide created. Added YouTube MCP creds, Windows Terminal settings, environment manifest, and learning-docs .env to backup script. |
Summary
With your daily backup + this guide, you can go from a blank Windows PC to a fully working environment in under 45 minutes. The auto-generated environment-manifest.json ensures you always know exactly what tools, packages, and repos to restore.