az storage blob upload: Upload to Blob in CI
Upload a local file to a container in Azure Blob Storage.
az storage blob upload pushes a single file into a blob container. In CI it stores artifacts, static assets, or reports. Authentication is via account key, SAS token, or --auth-mode login using your az login identity.
Common flags
--account-name ACCOUNTand-c CONTAINER- target storage-f FILEand-n BLOB- local file and destination blob name--auth-mode login- use the logged-in identity instead of a key--overwrite- replace an existing blob
Example in CI
Upload a build artifact using the logged-in identity.
shell
az storage blob upload \
--account-name mystorage -c artifacts \
-f dist.tar.gz -n builds/${GITHUB_SHA}.tar.gz \
--auth-mode login --overwriteCommon errors in CI
- AuthorizationPermissionMismatch - identity lacks Storage Blob Data Contributor (with --auth-mode login)
- The specified container does not exist - wrong container name
- BlobAlreadyExists - destination exists and --overwrite was not passed
Key takeaways
- Uploads a single file to a Blob Storage container.
- Prefer --auth-mode login over account keys when the identity has data roles.
- Grant Storage Blob Data Contributor to avoid permission-mismatch errors.
Related guides
az login: Authenticate Azure CLI in CIAuthenticate the Azure CLI in CI with a service principal or federated token: flags, an example, and the auth…
az group create: Provision Resource Groups in CICreate an Azure resource group from CI: required flags, an idempotent example, and the location and permissio…
gcloud storage cp: Upload Artifacts to GCS in CICopy files to and from Cloud Storage in CI: recursive and parallel flags, an upload example, and the bucket a…