COLD FILE
Azure Blob Storage · Container decommission kit Portal + az CLI

Archive first.Delete second.

Retiring a blob container is one command. Losing its contents is the same command, run too early. This kit walks you through pulling every blob to disk, proving the counts match, and only then deleting, with Portal clicks and az commands for each step.

5 steps 1 count check 1 irreversible command download-batch
Copying to /optCentral US · private
nautilus-blob-171972291
BACKUP/opt/nautilus-blob-171972291
host: azure-client
Blobs in container
16
Files in /opt
0
$ az storage blob download-batch --source nautilus-blob-171972291 …
VERIFIED16 = 16
DELETEDexists: false

The manifest

Every retirement starts with a transmittal: what's being boxed, where it's going, and what happens after. These are the values from the Nautilus lab. Swap in your own in the runbook builder below.

Storage account
nautilusst171972291
Region
Central US
Container
nautilus-blob-171972291
Access level
Private · existing
Backup destination
/opt on the azure-client (landing) host
Disposition
Delete container after backup is verified

Five steps, in this order

The order is the safety mechanism. Steps 1–3 are read-only or additive. Step 4 is the only one you can't take back, so it sits behind a count check.

Step 01 · Credentials
01

Set variables and fetch the account key

Name everything once so every later command reads the same values. The key authenticates the blob commands that follow.

RESOURCE_GROUP=$(az group list --query "[0].name" -o tsv)
STORAGE_ACCOUNT="nautilusst171972291"
CONTAINER_NAME="nautilus-blob-171972291"
BACKUP_DIR="/opt/${CONTAINER_NAME}"

ACCOUNT_KEY=$(az storage account keys list \
  --account-name $STORAGE_ACCOUNT \
  --resource-group $RESOURCE_GROUP \
  --query "[0].value" -o tsv)
Step 02 · Backup
02

Copy the whole container to /opt

Run this on the azure-client host itself. download-batch pulls every blob recursively and mirrors the container's virtual folders under $BACKUP_DIR.

The Portal's Download button saves through your browser to your own machine, not to a VM's disk. For a backup that lives in /opt on the host, use the CLI.

# Create the destination directory
sudo mkdir -p $BACKUP_DIR
sudo chown $(whoami) $BACKUP_DIR

# Download every blob, keeping folder structure
az storage blob download-batch \
  --destination $BACKUP_DIR \
  --source $CONTAINER_NAME \
  --account-name $STORAGE_ACCOUNT \
  --account-key $ACCOUNT_KEY
Step 03 · Verify
03
The step people skip

Prove the backup is complete

Count files on disk and blobs in the container. The two numbers must match, and the files should look right, before anything gets deleted.

# What's on disk now
ls -la $BACKUP_DIR

# Files on disk…
find $BACKUP_DIR -type f | wc -l

# …must equal blobs in the container
az storage blob list \
  --container-name $CONTAINER_NAME \
  --account-name $STORAGE_ACCOUNT \
  --account-key $ACCOUNT_KEY \
  --query "length(@)"

Large container? blob list returns 5,000 results per call by default. Add --num-results "*" so the count covers every blob.

Step 04 · Disposal
04
Irreversible

Delete the blob container

This removes the container and every blob in it.

Unless container soft-delete is enabled on the storage account, there is no undo. Don't run this until Step 3's counts match.

az storage container delete \
  --name $CONTAINER_NAME \
  --account-name $STORAGE_ACCOUNT \
  --account-key $ACCOUNT_KEY
Step 05 · Confirm
05

Prove it's gone

Ask Azure directly. The expected answer is false. In the Portal, the container should no longer appear in the list.

az storage container exists \
  --name $CONTAINER_NAME \
  --account-name $STORAGE_ACCOUNT \
  --account-key $ACCOUNT_KEY \
  --query "exists"

# expected: false
The rule that saves you

Files = blobs,
or no delete.

Step 3 is a gate, not a formality. If a download was interrupted, throttled, or hit a permissions error partway through, the count is where you find out. Try it: drag the slider to simulate a partial copy.

Files on disk
11
Blobs in container
16
5 blobs are not on disk yet. Deletion stays locked.

Build your runbook

Enter your own names and get one script that runs all five steps. With the count gate on, the script stops before deleting if the numbers don't match.

3–24 characters, lowercase letters and numbers.
3–63 characters: lowercase letters, numbers, single hyphens.
The container name is added as a subfolder.
decommission.shbash · 5 steps
ISSUED

Sign-off

Tick each line as you confirm it. All four ticked means the container is retired and its contents are safe on the host.

0 of 4 signed off