{
  "schema": "https://ai-atoms.com/schemas/skill-v1.json",
  "type": "skill",
  "id": "skill/azure-containerregistry-py",
  "version": "1.0.1",
  "name": "Azure Containerregistry Py",
  "description": "Azure Container Registry SDK for Python. Use for managing container images, artifacts, and repositories.\nTriggers: \"azure-containerregistry\", \"ContainerRegistryClient\", \"container images\", \"docker registry\", \"ACR\".",
  "system_prompt_fragment": "# Azure Container Registry SDK for Python\n\nManage container images, artifacts, and repositories in Azure Container Registry.\n\n## Installation\n\n```bash\npip install azure-containerregistry\n```\n\n## Environment Variables\n\n```bash\nAZURE_CONTAINERREGISTRY_ENDPOINT=https://<registry-name>.azurecr.io\n```\n\n## Authentication\n\n### Entra ID (Recommended)\n\n```python\nfrom azure.containerregistry import ContainerRegistryClient\nfrom azure.identity import DefaultAzureCredential\n\nclient = ContainerRegistryClient(\n    endpoint=os.environ[\"AZURE_CONTAINERREGISTRY_ENDPOINT\"],\n    credential=DefaultAzureCredential()\n)\n```\n\n### Anonymous Access (Public Registry)\n\n```python\nfrom azure.containerregistry import ContainerRegistryClient\n\nclient = ContainerRegistryClient(\n    endpoint=\"https://mcr.microsoft.com\",\n    credential=None,\n    audience=\"https://mcr.microsoft.com\"\n)\n```\n\n## List Repositories\n\n```python\nclient = ContainerRegistryClient(endpoint, DefaultAzureCredential())\n\nfor repository in client.list_repository_names():\n    print(repository)\n```\n\n## Repository Operations\n\n### Get Repository Properties\n\n```python\nproperties = client.get_repository_properties(\"my-image\")\nprint(f\"Created: {properties.created_on}\")\nprint(f\"Modified: {properties.last_updated_on}\")\nprint(f\"Manifests: {properties.manifest_count}\")\nprint(f\"Tags: {properties.tag_count}\")\n```\n\n### Update Repository Properties\n\n```python\nfrom azure.containerregistry import RepositoryProperties\n\nclient.update_repository_properties(\n    \"my-image\",\n    properties=RepositoryProperties(\n        can_delete=False,\n        can_write=False\n    )\n)\n```\n\n### Delete Repository\n\n```python\nclient.delete_repository(\"my-image\")\n```\n\n## List Tags\n\n```python\nfor tag in client.list_tag_properties(\"my-image\"):\n    print(f\"{tag.name}: {tag.created_on}\")\n```\n\n### Filter by Order\n\n```python\nfrom azure.containerregistry import ArtifactTagOrder\n\n# Most recent first\nfor tag in client.list_tag_properties(\n    \"my-image\",\n    order_by=ArtifactTagOrder.LAST_UPDATED_ON_DESCENDING\n):\n    print(f\"{tag.name}: {tag.last_updated_on}\")\n```\n\n## Manifest Operations\n\n### List Manifests\n\n```python\nfrom azure.containerregistry import ArtifactManifestOrder\n\nfor manifest in client.list_manifest_properties(\n    \"my-image\",\n    order_by=ArtifactManifestOrder.LAST_UPDATED_ON_DESCENDING\n):\n    print(f\"Digest: {manifest.digest}\")\n    print(f\"Tags: {manifest.tags}\")\n    print(f\"Size: {manifest.size_in_bytes}\")\n```\n\n### Get Manifest Properties\n\n```python\nmanifest = client.get_manifest_properties(\"my-image\", \"latest\")\nprint(f\"Digest: {manifest.digest}\")\nprint(f\"Architecture: {manifest.architecture}\")\nprint(f\"OS: {manifest.operating_system}\")\n```\n\n### Update Manifest Properties\n\n```python\nfrom azure.containerregistry import ArtifactManifestProperties\n\nclient.update_manifest_properties(\n    \"my-image\",\n    \"latest\",\n    properties=ArtifactManifestProperties(\n        can_delete=False,\n        can_write=False\n    )\n)\n```\n\n### Delete Manifest\n\n```python\n# Delete by digest\nclient.delete_manifest(\"my-image\", \"sha256:abc123...\")\n\n# Delete by tag\nmanifest = client.get_manifest_properties(\"my-image\", \"old-tag\")\nclient.delete_manifest(\"my-image\", manifest.digest)\n```\n\n## Tag Operations\n\n### Get Tag Properties\n\n```python\ntag = client.get_tag_properties(\"my-image\", \"latest\")\nprint(f\"Digest: {tag.digest}\")\nprint(f\"Created: {tag.created_on}\")\n```\n\n### Delete Tag\n\n```python\nclient.delete_tag(\"my-image\", \"old-tag\")\n```\n\n## Upload and Download Artifacts\n\n```python\nfrom azure.containerregistry import ContainerRegistryClient\n\nclient = ContainerRegistryClient(endpoint, DefaultAzureCredential())\n\n# Download manifest\nmanifest = client.download_manifest(\"my-image\", \"latest\")\nprint(f\"Media type: {manifest.media_type}\")\nprint(f\"Digest: {manifest.digest}\")\n\n# Download blob\nblob = client.download_blob(\"my-image\", \"sha256:abc123...\")\nwith open(\"layer.tar.gz\", \"wb\") as f:\n    for chunk in blob:\n        f.write(chunk)\n```\n\n## Async Client\n\n```python\nfrom azure.containerregistry.aio import ContainerRegistryClient\nfrom azure.identity.aio import DefaultAzureCredential\n\nasync def list_repos():\n    credential = DefaultAzureCredential()\n    client = ContainerRegistryClient(endpoint, credential)\n    \n    async for repo in client.list_repository_names():\n        print(repo)\n    \n    await client.close()\n    await credential.close()\n```\n\n## Clean Up Old Images\n\n```python\nfrom datetime import datetime, timedelta, timezone\n\ncutoff = datetime.now(timezone.utc) - timedelta(days=30)\n\nfor manifest in client.list_manifest_properties(\"my-image\"):\n    if manifest.last_updated_on < cutoff and not manifest.tags:\n        print(f\"Deleting {manifest.digest}\")\n        client.delete_manifest(\"my-image\", manifest.digest)\n```\n\n## Client Operations\n\n| Operation | Description |\n|-----------|-------------|\n| `list_repository_names` | List all repositories |\n| `get_repository_properties` | Get repository metadata |\n| `delete_repository` | Delete repository and all images |\n| `list_tag_properties` | List tags in repository |\n| `get_tag_properties` | Get tag metadata |\n| `delete_tag` | Delete specific tag |\n| `list_manifest_properties` | List manifests in repository |\n| `get_manifest_properties` | Get manifest metadata |\n| `delete_manifest` | Delete manifest by digest |\n| `download_manifest` | Download manifest content |\n| `download_blob` | Download layer blob |\n\n## Best Practices\n\n1. **Use Entra ID** for authentication in production\n2. **Delete by digest** not tag to avoid orphaned images\n3. **Lock production images** with can_delete=False\n4. **Clean up untagged manifests** regularly\n5. **Use async client** for high-throughput operations\n6. **Order by last_updated** to find recent/old images\n7. **Check manifest.tags** before deleting to avoid removing tagged images\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.",
  "applicable_domains": [
    "devops"
  ],
  "category": "devops",
  "invocation": [
    "/azure-containerregistry-py"
  ],
  "authored_by": "claudeskills.in community",
  "source_url": "https://claudeskills.in/skill/azure-containerregistry-py",
  "provenance": {
    "source": "claudeskills.in",
    "source_url": "https://claudeskills.in/skill/azure-containerregistry-py",
    "license": "unknown",
    "imported_at": "2026-09-03",
    "notes": "Aggregated by claudeskills.in from community GitHub lists."
  },
  "tags": [
    "claudeskills",
    "devops"
  ],
  "lifecycle": "draft"
}