
azure-migrate
by benwk
Claude Code Skills: Azure migration tools and utilities
SKILL.md
name: azure-migrate description: Migrate Azure PostgreSQL databases, Storage Accounts, and Container Registry (ACR) images between subscriptions/regions. Use when user asks to migrate databases, storage, container images, or Azure resources between environments. user-invocable: true
Azure Resource Migration Skill
You are helping with Azure resource migration using the migration tools bundled with this skill.
IMPORTANT: The migration scripts are located in the skill directory at .claude/skills/azure-migrate/. When executing the scripts, use the full path from the project root or navigate to the skill directory first.
Available Tools
1. PostgreSQL Migration (migrate_postgresql.sh)
Purpose: Migrate PostgreSQL databases between Azure subscriptions/regions
Usage:
.claude/skills/azure-migrate/migrate_postgresql.sh <source_config.json> <target_config.json> [options]
Options:
--verify-only- Only verify data, don't migrate--skip-backup- Skip backup step (use existing backup)--backup-dir DIR- Use specific backup directory
Configuration Format (JSON):
{
"subscription": "subscription-id",
"host": "psql-server-name.postgres.database.azure.com",
"username": "psqladmin",
"keyvault": "kv-name",
"databases": ["db1", "db2", "db3"]
}
Features:
- Auto-retrieves passwords from Azure Key Vault
- Uses pg_dump/pg_restore for complete backup/restore
- Accurate verification using COUNT(*) on all tables
- Supports multiple databases in one run
2. Storage Account Migration (migrate_storage.sh)
Purpose: Migrate Azure Storage Account blob containers between subscriptions/regions
Usage:
.claude/skills/azure-migrate/migrate_storage.sh <source_config.json> <target_config.json> [options]
Options:
--verify-only- Only verify file counts, don't migrate--skip-download- Skip download step (use existing local files)--temp-dir DIR- Use specific temporary directory
Configuration Format (JSON):
{
"subscription": "subscription-id",
"account_name": "storageaccountname",
"resource_group": "rg-name",
"containers": ["container1", "container2"]
}
Features:
- Uses SAS tokens for secure transfer
- Three-step migration: source → local → destination
- Automatically creates target containers if missing
- File count verification
3. Container Registry Migration (migrate_acr.sh)
Purpose: Migrate Azure Container Registry (ACR) images between subscriptions/regions with time-based filtering
Usage:
.claude/skills/azure-migrate/migrate_acr.sh <source_config.json> <target_config.json> [options]
Options:
--days N- Only sync images updated in last N days (default: 7)--all-images- Sync all images regardless of age--diff-only- Only show differences, don't sync--verify-only- Only verify sync status, don't sync
Configuration Format (JSON):
{
"subscription": "subscription-id",
"registry_name": "myacrname",
"repositories": ["repo1", "repo2"] // optional, if omitted will sync all
}
Features:
- Time-based filtering for incremental syncing (last N days)
- Diff mode to preview changes before syncing
- Smart deduplication - skips images already in target ACR
- Repository filtering - sync specific repos or all
- Detailed statistics (synced, skipped, failed counts)
- Uses ACR Import API for secure cross-subscription migration
Common Use Cases:
- Incremental sync:
--days 3for recent images only - Initial migration:
--all-imagesfor full sync - Preview changes:
--diff-onlybefore actual sync - Scheduled sync: Run daily with
--days 1for continuous sync
Example Configurations
See .claude/skills/azure-migrate/examples/ for sample configuration files:
source_db.json.example/target_db.json.example- Database examplessource_storage.json.example/target_storage.json.example- Storage examplessource_acr.json.example/target_acr.json.example- Container Registry examples
Users should copy these .example files, remove the .example extension, and fill in their actual Azure resource details.
When User Requests Migration
-
Ask for source and target details:
- Subscription ID
- Resource names (PostgreSQL server or Storage Account)
- Resource group (for Storage Account)
- Key Vault name (for PostgreSQL)
- Database/container names
-
Create configuration files:
- Save as JSON in a temporary location or project directory
- Use descriptive names like
source_db.jsonandtarget_db.json
-
Execute migration:
- Run the appropriate script with configuration files
- Monitor output for errors
- Report progress to user
-
Verify results:
- Run with
--verify-onlyflag to confirm data integrity - Report verification results to user
- Run with
Best Practices
- Always verify first: Run
--verify-onlyon existing data to check if migration is needed - Test with small datasets: If migrating large databases, suggest testing with one small database first
- Check prerequisites: Ensure Azure CLI is authenticated, azcopy is installed, PostgreSQL tools available
- Network access: Verify firewall rules allow access from current machine
- Backup awareness: Let users know where backups are stored (
/tmpby default) - Cleanup: Remind users to clean up temporary backup files after successful migration
Error Handling
Common issues and solutions:
- Key Vault access denied: User needs proper RBAC permissions on Key Vault
- PostgreSQL connection failed: Check firewall rules and network access
- Container not found: Script auto-creates containers, but verify storage account exists
- SAS token expired: Tokens have 4-hour expiry, re-run if needed
- Disk space: Large migrations need significant temporary disk space
Workflow Example
When user says "Migrate production database to staging" (or similar):
- Check if user has existing config files or ask them to provide environment details
- Create JSON config files based on user's Azure resource information
- Save configs with descriptive names (e.g.,
source_prod.json,target_staging.json) - Run migration with full script path:
.claude/skills/azure-migrate/migrate_postgresql.sh - Run verification with
--verify-onlyflag - Report results including any mismatches or errors
Example .example files are available in .claude/skills/azure-migrate/examples/ for reference.
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon