I'm trying to creating az acr task with purge command for keeping latest 5 images for related branches and remaining all images should delete but what am I using command for this it's not working can you help me on mu issue

Salini, Krovi 0 Reputation points
2023-11-15T08:15:28.82+00:00

Command what I'm using:

$Purge_CMD = "acr purge --filter '<repo name>:^((?!develop|Integration|Release).)*$' --ago 14d --keep 5"

az acr task create --name imagetask --registry <acr name> --cmd $Purge_CMD --context /dev/null --schedule '* * * * *'

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
455 questions
{count} votes

1 answer

Sort by: Most helpful
  1. kobulloc-MSFT 26,321 Reputation points Microsoft Employee
    2023-11-17T00:58:09.05+00:00

    Hello, @Salini, Krovi !

    Why isn't my scheduled purge task running correctly?

    I reached out to the Azure Container Registry team and usually additional information is needed to troubleshoot these issues (specific error codes, resulting actions, etc.) however in reproducing this issue, the task failed to execute due to a syntax error near unexpected token `('. When the ' char was removed from the end, the task was successful.

    You can troubleshoot the command by using --dry-run to get a list of what will be purged.


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.