Skip to content

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                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚
          β”‚  Daily backup at 9 AM
          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Personal OneDrive       │───▢│ Google Drive          β”‚
β”‚ ~/OneDrive/             β”‚    β”‚ G:\My Drive\          β”‚
β”‚   CopilotCLI_Backups/   β”‚    β”‚   CopilotCLI_Backups\ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What's in the Backup (Complete Inventory)

βœ… Automatically Backed Up (daily at 9 AM)

Item Backup Location Purpose
copilot-instructions.md backup_*/ Your Copilot CLI personality & rules
copilot-instructions-reference.md backup_*/ Detailed project context & reference data
mcp-config.json backup_*/ MCP server definitions (contains Entra secrets)
secrets/github-personal-pat backup_*/secrets/ GitHub PAT for personal repos
config.json backup_*/ CLI configuration
permissions-config.json backup_*/ Tool permissions
backup-instructions.ps1 backup_*/ The backup script itself
skills/ backup_*/skills/ Custom Copilot skills
session-state/ backup_*/session-state/ Session history & artifacts
session-store.db backup_*/ Searchable index of all past sessions
installed-plugins/ backup_*/installed-plugins/ Plugin metadata
YouTube OAuth credentials backup_*/youtube-mcp-creds/ Google OAuth tokens for YouTube MCP
Windows Terminal settings backup_*/windows-terminal-settings.json Custom keybindings & profile
environment-manifest.json backup_*/ Auto-generated: tool versions, npm globals, pip packages, repo list
learning-docs/ source learning-docs-backup/ MkDocs Markdown + config
learning-docs/.env learning-docs-backup/.env Azure subscription/tenant IDs

❌ 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/ (~316 MB) Temporary session logs Regenerated automatically
session-store.db-shm, .db-wal SQLite runtime temp files Regenerated automatically
site/ folders Built output mkdocs build or hugo --minify
GitHub CLI auth OAuth tokens in OS keyring gh auth login
Azure CLI auth Token cache az login
Git global config Currently not set Set up during restore
Google Drive app Desktop app Reinstall + sign in

πŸ” 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:

Get-Content "G:\My Drive\CopilotCLI_Backups\backup_*\environment-manifest.json" |
    ConvertFrom-Json | Select-Object -ExpandProperty tools

Phase 2 β€” Restore Copilot CLI Config (5 min)

# Find the latest backup
$latestBackup = Get-ChildItem "G:\My Drive\CopilotCLI_Backups\backup_*" -Directory |
    Sort-Object Name -Descending | Select-Object -First 1

# Create .copilot directory
New-Item -ItemType Directory -Path "$env:USERPROFILE\.copilot" -Force | Out-Null

# Copy everything back
Copy-Item "$($latestBackup.FullName)\*" "$env:USERPROFILE\.copilot\" -Recurse -Force

Write-Host "βœ… Restored from: $($latestBackup.Name)"

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
$manifest = Get-Content "$($latestBackup.FullName)\environment-manifest.json" | ConvertFrom-Json
$manifest.repos | ForEach-Object {
    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 (3 min)

# Copy learning docs source
$docsBackup = "G:\My Drive\CopilotCLI_Backups\learning-docs-backup"
Copy-Item "$docsBackup\mkdocs.yml" "C:\ssClawy\learning-docs\" -Force
Copy-Item "$docsBackup\docs" "C:\ssClawy\learning-docs\docs" -Recurse -Force
Copy-Item "$docsBackup\.env" "C:\ssClawy\learning-docs\.env" -Force -ErrorAction SilentlyContinue

# Install Python dependencies and build
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)

Open PowerShell as Administrator:

$action = New-ScheduledTaskAction `
    -Execute "pwsh.exe" `
    -Argument '-NoProfile -WindowStyle Hidden -File "C:\Users\ssutheesh\.copilot\backup-instructions.ps1"'

$trigger = New-ScheduledTaskTrigger -Daily -At "09:00"

$settings = New-ScheduledTaskSettingsSet `
    -AllowStartIfOnBatteries `
    -DontStopIfGoingOnBatteries `
    -StartWhenAvailable

Register-ScheduledTask `
    -TaskName "CopilotCLI_BackupInstructions" `
    -Action $action `
    -Trigger $trigger `
    -Settings $settings `
    -Description "Daily backup of Copilot CLI config to Personal OneDrive"

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:

Subject: repo:susanthgit/-ainews:ref:refs/heads/main

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:

  1. Go to Google Cloud Console β†’ project aguidetocloud-mcp
  2. APIs & Services β†’ Credentials β†’ OAuth 2.0 Client IDs
  3. Download the client JSON β†’ save as credentials.json
  4. Place in %APPDATA%\npm\node_modules\youtube-channel-mcp\
  5. Run the MCP server once to trigger the OAuth consent flow:
    node "$env:APPDATA\npm\node_modules\youtube-channel-mcp\server.js"
    
  6. Complete the browser OAuth flow β€” tokens.json will 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.