All skills
microsoft avatar

/azure-containerregistry-py

@e19efc2
by microsoftmicrosoft/skills3.1k stars
351

Azure Container Registry SDK for Python. Use for managing container images, artifacts, and repositories. Triggers: "azure-containerregistry", "ContainerRegistryClient", "container images", "docker registry", "ACR".

Use this Skill: https://skilld.dev/gh/microsoft/skills/azure-containerregistry-py

This session only. Nothing lands on disk.

referencesnon-hero-scenarios.md

≈639 tokens on demand. Your agent reads this file only when SKILL.md points to it.

azure-containerregistry-py non-hero scenarios

These scenarios are intentionally separate from hero flows in SKILL.md. They cover secondary/advanced patterns typically used after the primary end-to-end path is working.

Tag Operations

Get Tag Properties

tag = client.get_tag_properties("my-image", "latest")
print(f"Digest: {tag.digest}")
print(f"Created: {tag.created_on}")

Delete Tag

client.delete_tag("my-image", "old-tag")

Upload and Download Artifacts

from azure.containerregistry import ContainerRegistryClient
from azure.identity import DefaultAzureCredential

with DefaultAzureCredential() as credential:
    with ContainerRegistryClient(endpoint, credential) as client:
        # Download manifest
        manifest = client.download_manifest("my-image", "latest")
        print(f"Media type: {manifest.media_type}")
        print(f"Digest: {manifest.digest}")

        # Download blob
        blob = client.download_blob("my-image", "sha256:abc123...")
        with open("layer.tar.gz", "wb") as f:
            for chunk in blob:
                f.write(chunk)

Async Client

from azure.containerregistry.aio import ContainerRegistryClient
from azure.identity.aio import DefaultAzureCredential

async def list_repos():
    async with DefaultAzureCredential() as credential:
        async with ContainerRegistryClient(endpoint, credential) as client:
            async for repo in client.list_repository_names():
                print(repo)

Clean Up Old Images

from datetime import datetime, timedelta, timezone

cutoff = datetime.now(timezone.utc) - timedelta(days=30)

for manifest in client.list_manifest_properties("my-image"):
    if manifest.last_updated_on < cutoff and not manifest.tags:
        print(f"Deleting {manifest.digest}")
        client.delete_manifest("my-image", manifest.digest)

Client Operations

Operation Description
list_repository_names List all repositories
get_repository_properties Get repository metadata
delete_repository Delete repository and all images
list_tag_properties List tags in repository
get_tag_properties Get tag metadata
delete_tag Delete specific tag
list_manifest_properties List manifests in repository
get_manifest_properties Get manifest metadata
delete_manifest Delete manifest by digest
download_manifest Download manifest content
download_blob Download layer blob

Source: SKILL.md on GitHub

1 warning15d4 checks · Risk SAFE
  • Gen Agent Trust Hub15d

    This skill provides a standard interface for the Azure Container Registry SDK for Python. It adheres to security best practices for Azure service interaction, including the use of Entra ID/DefaultAzureCredential and proper resource lifecycle management via context managers.

  • Socket15d

    No alerts

  • Snyk15d

    Risk: LOW · No issues

  • Runlayer7mo

    2/2 files flagged

Signed by skilld at e19efc2. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 19 hours ago.

Activeupdated 3 months ago
Other metadata
metadata
{
  "author": "Microsoft",
  "version": "1.0.0",
  "package": "azure-containerregistry"
}

README badge

README badge for microsoft/skills/azure-containerregistry-py