Automating Azure Container App Jobs Triggered by New Image Push to Azure Container Registry

nikithakoshy 20 Reputation points
2024-09-26T10:29:48.5866667+00:00

I want to trigger the Azure Container App job whenever a new image is pushed to an Azure container registry repository. How can I achieve this cost-effectively and straightforwardly?

Currently I am pushing the image to container registry through Azure release pipelines and manually triggering the container app job every time the image is pushed

Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
422 questions
0 comments No comments
{count} votes

Accepted answer
  1. LeelaRajeshSayana-MSFT 15,396 Reputation points Microsoft Employee
    2024-09-26T19:01:57.54+00:00

    Hi @nikithakoshy Greetings! Welcome to Microsoft Q&A forum. Thank you for posting this question here.

    One of the ways we can achieve the use case is by sending the ImagePushed events from the Azure Container Registry to a storage queue and trigger the Container job based on the messages received to the Storage Queue.

    Please refer to the article Subscribe to registry events which provides a sample implementation of subscribing event to Event grid. Instead of subscribing to event grid, you can use the az eventgrid event-subscription create command to create a subscription to Storage queue end point. You can find the samples to create this event subscription in the document az eventgrid event-subscription create

    Here is a sample for reference

    az eventgrid event-subscription create --name es2 --source-resource-id /subscriptions/{SubID} --endpoint-type storagequeue --endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/queueservices/default/queues/q1
    
    
    

    Once you have the events routed, you can refer the article Deploy an event-driven job with Azure Container Apps and follow the steps to trigger the deployed job based on the triggered events

    Hope this helps! Please let us know if you have any additional questions.


    If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Lex Li (Microsoft) 5,582 Reputation points Microsoft Employee
    2024-09-27T07:02:54.79+00:00

    Currently I am pushing the image to container registry through Azure release pipelines and manually triggering the container app job every time the image is pushed

    Then you can use Azure pipelines to directly deploy to Azure Container Apps, by adding AzureContainerApps@1 task after the task that pushes image to ACR, if you follow this tutorial,

    https://learn.microsoft.com/en-us/azure/container-apps/azure-pipelines

    That removes the manual work.

    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.