Search code examples
azureazure-container-apps

Stop an Azure ContainerApp?


I have an Azure ContainerApp deployed with a single revision, and I'd like to stop it - but not delete it and have to re-deploy it. I see the image in the registry, and there are options via the portal to deploy it to an AppService or ContainerInstance, but not to a ContainerApp.

I also have looked through the az CLI, specifically az containerapp, but see no way to stop a running instance. I can set the scale to 0-1, but it still runs.

Am I missing something? Stopping an instance seems like a pretty normal thing to do...

EDIT - Setting all revisions to inactive doesn't seem to be allowed. See images below.

Revisions

Save Revisions


Solution

  • Update: there is now a proper way to stop, see the answer by HQT


    You can deactivate a revision to shut down the containers. If you deactivate all active revisions, you will effectively stop your containerapp.

    https://learn.microsoft.com/en-us/azure/container-apps/application-lifecycle-management

    Once a revision is no longer needed, you can deactivate a revision with the option to reactivate later. During deactivation, containers in the revision are shut down.

    When you need it again, you can use activate to get new replicas.

    az containerapp revision deactivate --resource-group
                                        --revision
                                        [--name]
    
    az containerapp revision activate --resource-group
                                      --revision
                                      [--name]
    

    If you visit the containerapp url after deactivating all revisions, you will receive an error:

    Error 403 - This Container App is stopped.