Last active
March 2, 2022 03:25
-
-
Save apgapg/d3ca88d3b61fdb7c3719ece40725dc38 to your computer and use it in GitHub Desktop.
VS code Script that purges old acr images and retains latest 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This vs code script purges the old images in 'acr' (Azure Container Registry) via 'az' cli. | |
# Retains only latest 5 in a particular repository | |
# You need to change 'myacr' with your acr name and 'mysubs' with your subscription name. | |
# Make sure az cli is installed and logged in. | |
# | |
# Read more: https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auto-purge | |
# azcli: https://github.com/Microsoft/vscode-azurecli | |
# List subscriptions | |
az account list --output table | |
# Set DMS subscription | |
az account set --name "mysubs" | |
# Check account | |
az account show | |
# Dry run purge acr 'server acr' | |
az acr run --cmd "acr purge --dry-run --keep=5 --filter 'server:.*' --ago 0d" --registry myacr /dev/null | |
# Run actual cmd for server acr | |
az acr run --cmd "acr purge --keep=5 --filter 'server:.*' --ago 0d" --registry myacr /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use individual commands in terminal