Manage Azure Container Registry Artifacts
Python skill for managing images, manifests, tags, and cleanup in Azure Container Registry.
Why it matters
Automate the management of container images, artifacts, and repositories within Azure Container Registry. This skill enables programmatic control over your container registry, facilitating CI/CD pipelines and artifact lifecycle management.
Outcomes
What it gets done
List, get properties, and delete repositories.
Manage tags and manifests, including deletion and property updates.
Download manifests and layer blobs.
Clean up old or untagged manifests.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-azure-containerregistry-py | bash Overview
Azure Container Registry SDK for Python
Python skill for the Azure Container Registry SDK, covering repository, tag, and manifest management (list, get, update, delete), direct manifest/blob download, and a digest-based cleanup pattern for pruning old untagged images. Use when programmatically auditing, cleaning up, or locking down images and artifacts already pushed to Azure Container Registry.
What it does
This skill manages container images, artifacts, and repositories in Azure Container Registry using the Python SDK (pip install azure-containerregistry). A ContainerRegistryClient authenticates against a registry endpoint via DefaultAzureCredential (recommended for private registries) or anonymously with an explicit audience for public registries like Microsoft Container Registry. Repository operations cover listing all repository names, getting a repository's properties (creation/modification time, manifest count, tag count), updating its properties (e.g. can_delete/can_write flags to lock it down), and deleting it outright. Tag operations list a repository's tags (optionally ordered by ArtifactTagOrder.LAST_UPDATED_ON_DESCENDING for most-recent-first), fetch a specific tag's properties (digest, creation time), and delete a tag by name. Manifest operations mirror this at the manifest level: listing manifests (ordered similarly), getting a manifest's properties (digest, architecture, OS), updating its lock flags, and deleting it - explicitly by digest rather than by tag, to avoid leaving orphaned untagged images behind when multiple tags point to the same digest. Raw artifact content can be pulled directly via download_manifest (media type and digest) and download_blob (streamed layer content written to a local file in chunks). An async client (azure.containerregistry.aio) mirrors the sync API for high-throughput scenarios. A worked cleanup example iterates a repository's manifests, and deletes any manifest older than a 30-day cutoff that has no tags pointing to it - a common registry-hygiene pattern - checking manifest.tags first specifically to avoid removing images still in active use.
When to use - and when NOT to
Use this skill when programmatically managing Azure Container Registry contents - auditing repositories, pruning old or untagged images, locking production images against deletion, or pulling manifest/layer content directly. It is not a build or push tool (image building and pushing typically go through Docker/OCI tooling or CI/CD pipelines) - this SDK is focused on registry management, inspection, and cleanup of already-pushed artifacts.
Inputs and outputs
Input is a registry endpoint, repository names, and tag/digest identifiers. Output is repository/tag/manifest metadata (timestamps, counts, digests, architecture/OS), downloaded manifest and blob content, and confirmation of updates or deletions.
Integrations
Built on the Azure Container Registry Python SDK (ContainerRegistryClient), authenticated via Azure Identity's DefaultAzureCredential for private registries or anonymously (with an explicit audience) for public ones like mcr.microsoft.com.
pip install azure-containerregistry
Who it's for
Python developers and platform teams managing Azure Container Registry contents - auditing, cleaning up old or untagged images, locking production images, or pulling artifact content programmatically - rather than through the Azure CLI or portal.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.