drift migrate
Move off another cloud. Every step runs locally, with your own provider login, Drift never holds your credentials or your data. The first provider is Azure; see the migration guide for the whole story.
| Command | Description |
|---|---|
drift migrate azure estimate -g <rg> [--json] [--csv] [--dry-run] [--az-log] | Read-only: map an Azure resource group's cost to the equivalent Drift slice |
drift migrate azure snapshot -g <rg> [-o <dir>] [--slice <name>] [--deref-secrets] [--source app=dir] [--az-log] | Read-only: pull function source, Cosmos documents, blobs, queue messages, $web sites, and app settings into a vendor-neutral folder (./azure_export by default) |
drift migrate azure transform [-i <dir>] [-o <dir>] | Offline: rewrite the export into a deployable Drift project, with a Driftfile validated before it is written, and a scaffold for each function (./azure_export in, ./drift_workspace out by default) |
drift migrate azure apply [-i <dir>] [--accept-refusals] | Run drift apply from the workspace; hard-refuses while anything is in REFUSED.md unless --accept-refusals |
The first two are read-only against your provider, and transform touches no network at all so you can run the whole assessment before deciding anything.
estimate --dry-run prints the az commands it would run and fetches nothing; --json/--csv change only the output format, and --az-log (on estimate and snapshot) prints every az command before it runs. snapshot writes app settings as secret names, never values, unless --deref-secrets asks for the plaintext too, in which case it lands on disk mode 0600, unencrypted. --slice names the target Drift slice (by default it is derived from the resource group). --source <app>=<dir> skips live retrieval for a function app you already have a local copy of, which works regardless of plan type. snapshot also needs mongoexport on your machine to read a Cosmos account's data, and squashfs-tools for Linux Consumption source; a missing one fails loudly with the command that installs it.
transform writes the workspace: a Driftfile declaring every function it can move, a Python scaffold for each one (Drift's return shape, with the original body preserved verbatim under TODOs), the Cosmos documents with id remapped to _id as seed files, each collection's size set to twice its migrated data (5MiB at least) for you to review, secrets read with env() from a .env.migrate file, and the reports REFUSED.md, REPORT.md and PLAN.md. It ends by telling you to review REPORT.md and then run drift plan in the workspace.
apply runs the ordinary drift apply from the workspace, after loading .env.migrate so the Driftfile's env() references resolve. The slice is the one the generated Driftfile names: apply creates it, and asks before the price and before anything it removes, as it does for any project. drift plan in the workspace shows all of it first.
Nothing deploys while REFUSED.md still has entries.
transform writes it listing what it would not translate, and apply refuses to deploy while anything is on it unless you pass --accept-refusals, which deploys what fits and leaves the rest on Azure. That is deliberate: a migration that silently drops a resource is worse than one that stops and names it.