Skip to content

[enhancement]: Support Different Resource Groups for Container App and Environment in AzureContainerApps@1 #20594

@jsinghcode

Description

@jsinghcode

Task name

AzureContainerApps@1

Describe your feature request here

Description

When deploying Container Apps in Azure, it is common for the Container Apps Environment and the Container App itself to reside in separate resource groups (e.g., the environment Dev-Environment in Resource Group A and the app MyContainerApp in Resource Group B). However, when using the AzureContainerApps@1 task in an Azure DevOps pipeline, specifying different resource groups for the environment and the app leads to an error, as the task expects both resources to be in the same group.

Steps to Reproduce

  1. Configure a pipeline with the AzureContainerApps@1 task:
    - stage: Deploy  
      jobs:
      - job:
        steps:
        - task: AzureContainerApps@1
          inputs:
            azureSubscription: 'MyAzureSubscription'
            acrName: 'myContainerRegistry'
            imageToDeploy: 'myContainerRegistry.azurecr.io/MyContainerApp:$(Build.BuildNumber)'
            containerAppName: 'MyContainerApp'
            resourceGroup: 'Resource Group B'
            containerAppEnvironment: 'Dev-Environment'
  2. Run the deployment.

Current Behavior
The deployment fails with the following error:

(ResourceNotFound) The Resource 'Microsoft.App/managedEnvironments/Dev-Environment' under resource group 'Resource Group B' was not found.

Expected Behavior
It should be possible to specify a different resource group for the Container Apps Environment using a full resource ID path, allowing for more flexible resource configurations.

Proposed Solution
Enable support for specifying a full resource ID for the containerAppEnvironment input in the AzureContainerApps@1 task, like:

containerAppEnvironment: '/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/Resource Group A/providers/Microsoft.App/managedEnvironments/Dev-Environment'

Full Example Task
Here is an example of the full task configuration with the proposed solution:

- stage: Deploy  
  jobs:
  - job:
    steps:
    - task: AzureContainerApps@1
      inputs:
        azureSubscription: 'MyAzureSubscription'
        acrName: 'myContainerRegistry'
        imageToDeploy: 'myContainerRegistry.azurecr.io/MyContainerApp:$(Build.BuildNumber)'
        containerAppName: 'MyContainerApp'
        resourceGroup: 'Resource Group B'
        containerAppEnvironment: '/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/Resource Group A/providers/Microsoft.App/managedEnvironments/Dev-Environment'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions