This is mostly a note to self and i no credit whatsoever to myself. Info collected mainly from this SO question, but i had some issues with the info there, mainly stuff caused by changes to Azure CLI and some code formatting issues.
https://stackoverflow.com/questions/41446962/how-to-delete-image-from-azure-container-registry
- Login with Azure CLI,
az login
- Pick the correct subscription,
az account set -s your_id
- Then run this command.
az acr repository show-tags -n YourRegistry --repository YourRepository | ConvertFrom-String | %{$_.P2 -replace "[`",]",""} | where {$_ -notin "4698a2ae296ed953890c1d61bfaf370deedfb29f" } | %{az acr repository delete -n YourRegistry --image YourRepository:$_ --yes}
Top comments (0)