skip to Main Content

my scenario is like I have shared container registry in one subscription say subscription A, I need to pull image from ACR to ACA through DevOps pipelines. The ACAs are present for each environment like dev, test, UAT & etc which is in another subscription say subscription B. I am using ‘az containerapp up’ command in azure devops pipelines to pull image of the shared ACR. Getting error ‘The resource is not found in the subscription B’. What might be the alternative possible solution because we need to reduce cost of using container registry for each environment.
I am using service connections to pull image and the service connections are separate for separate subscriptions.

I know that they are in different subscriptions but I searched on websites to connect two different subscriptions.
Is there a possibility that I can connect two different service connections in azure devops & use one service connection to pull that image.

2

Answers


  1. Before integrating the Azure CLI command az containerapp up with Azure pipelines, please first confirm you are able to pull the ACR image from Sub B to deploy the container app in Sub A via CloudShell or LocalPowerShell.

    I tested to create ARM service connection with Tenant Root Management Group whose referenced service principle had access to both subscriptions; the issue still existed.

    FailureWithTenantRootMG

    In local PowerShell, I az login with my user account and still could reproduce the issue.

    az containerapp up `
        --name XXcontainerapp `
        --image XXacrsubB.azurecr.io/azurecontainerappdemo:XX `
        --resource-group rg-containerapp `
        --environment TestEnv `
        --registry-username XXacrsubB `
        --registry-password XXXXXX
    

    FailureInLocalPowerShell

    It seemed to be a limitation with this command az containerapp up. You may consider reporting the issue with Azure CLI.

    Login or Signup to reply.
  2. It looks like, there is some kind of workaround

    Steps:

    • Deploy to an azure container app any version of docker ‘image-x’ manually
    • Then with ‘az containerapp update’ it possible to update version of the image, without an error, ever if registry and the app container in diff subscriptions

    Code snippet:

    - task: AzureCLI@2
            inputs:
              azureSubscription: 'service-connection'
              scriptType: 'bash'
              scriptLocation: 'inlineScript'
              inlineScript: |
                az config set extension.use_dynamic_install=yes_without_prompt
                
                az containerapp update 
                  --name "app-name" 
                  --resource-group "rg" 
                  --image 'registry-host/image-x:v' 
            displayName: 'Update azurecontainer app'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search