I had a similar problem when I wanted to delete historical images from the repository, since our quota reached 100%
I was able to do this using the following commands in Azure CLI 2.0. The process does the following: gets a list of tags, filters it with grep, and cleans it with sed before passing it to the delete command.
Get all tags for this repository.
az acr repository show-tags -n [registry] --repository [repository]
Get all tags that begin with a specific input and channel that will be passed to sed, which will remove the trailing comma
grep \"[starts with] | sed 's/,*$//g'
Using xargs, assign the output to the variable X and use this as a tag.
- manifest: Remove the manifest referenced by the tag. It also removes any associated layer data and all other tags that reference the manifest.
- yes -y: do not ask for confirmation.
xargs -IX az acr repository delete -n [registry] --repository [repository] --tag X --manifest --yes
eg. registry = myRegistry, repository = myRepo, I want to remove all tags that start with the tag 'test' (this will include test123, testing, etc.)
az acr repository show-tags -n myRegistry --repository myRepo | grep \"test | sed 's/,*$//g' | xargs -IX az acr repository delete -n myRegistry --repository myRepo --tag X --manifest --yes
More information can be found here Microsoft Azure Docs