umbraco-cloud-fetch-media
v0.1.0
Published
Wizard-based CLI that downloads the media folder from an Umbraco Cloud project's blob storage into the local wwwroot/media folder.
Maintainers
Readme
umbraco-cloud-fetch-media
Wizard-based CLI that downloads the media/ folder from an Umbraco Cloud project's blob storage into the local wwwroot/media folder of your Umbraco ASP.NET Core project.
Companion to:
umbraco-cloud-fetch-database- replaces the LocalDB.mdf/.ldffilesumbraco-cloud-archiver- archives an entire Cloud project (git + blobs + database)
Requirements
- Windows
- Node.js 20 or newer
- An Umbraco ASP.NET Core project in the current directory (a
*.csprojreferencingUmbraco.Cms*) - A container-level Shared Access Signature (SAS) URL from the Umbraco Cloud portal
The tool uses AzCopy to copy blobs. If AzCopy is not found in PATH, the tool offers to download it into a per-user cache (%USERPROFILE%\.umbraco-cloud-fetch-media\bin\azcopy).
Usage
From the root of your Umbraco web project:
npx umbraco-cloud-fetch-mediaThe wizard will:
- Verify the current directory is an Umbraco web project.
- Ask for the SAS URL of the blob container (e.g.
https://<account>.blob.core.windows.net/<container>?sv=...). - If
wwwroot/mediaalready contains files, ask whether to back it up first. - Show a summary and ask for confirmation.
- Ensure AzCopy is available (downloading it if needed).
- Optionally copy the current
wwwroot/mediato<project-root>/.media-backup/<timestamp>/(keeping the last 3 backups). - Delete the existing
wwwroot/mediafolder and recreate it empty. - Run
azcopy copy "<container>/media/*?<sas>" "<wwwroot/media>" --recursive=true.
Finding the SAS URL
In the Umbraco Cloud portal, open your project → environment → Connection details → Blob Storage. Generate a read-only Shared Access Signature URL for the media container and paste it into the wizard.
Backup location
Backups go into <project-root>/.media-backup/<YYYYMMDD-hhmmss>/. This is outside wwwroot so the ASP.NET Core static file middleware will not serve them. The directory is .-prefixed so it is hidden and easy to add to .gitignore.
Development
npm install
npm run dev # run the TypeScript source with tsx
npm run build # compile to dist/
npm start # run the compiled CLILicense
MIT © Søren Kottal
