How to set the Container App alocation to have 4CPUs and 8Gb of RAM in bicep

Gunther Wirgman 0 Reputation points
2024-11-13T18:26:16.28+00:00

I'm trying to set the Container App allocation to 4CPUs and 8Gb of RAM in the consumption plan.

Through the Azure portal I managed to provision a Container App with that kind of resources, but when I try this using bicep, I get this error in the deployment of a Managed Application (through a Service Catalog Managed Application Definition)
"The total requested CPU and memory resources for this application (CPU: 4.0, memory: 8) is invalid. Total CPU and memory for all containers defined in a Container App must add up to one of the following CPU - Memory combinations: [cpu: 0.25, memory: 0.5Gi]; [cpu: 0.5, memory: 1.0Gi]; [cpu: 0.75, memory: 1.5Gi]; [cpu: 1.0, memory: 2.0Gi]; [cpu: 1.25, memory: 2.5Gi]; [cpu: 1.5, memory: 3.0Gi]; [cpu: 1.75, memory: 3.5Gi]; [cpu: 2.0, memory: 4.0Gi]"

I've tried to replicate what the portal has by exporting the ARM of the Container App that I provisioned using the portal, then de-compiling it to bicep and see what is missing, but with no luck so far. I've tested by adding the "workloadProfileName" and set it to 'Consumption', but the deployment fails with this error message: "Cannot specify workload profile name for container app in Consumption Only environment."

This is a section of my bicep file for the Container App

resource functionsContainerApp ``'Microsoft.App/containerApps@2023-05-01' = {

  name: testContainerAppFullName

  location: location

  identity: {

    type: ``'UserAssigned'

    userAssignedIdentities: {

      ``'${managedIdentity.id}': {}

    }

  }

  dependsOn: [

    acrImport

  ]

  properties: {

    managedEnvironmentId: containerAppEnvironment``.id

    configuration: {

      activeRevisionsMode: ``'Single'

      secrets: [

        {

          name: ``'application-insights-secret'

          value: ``applicationInsights.properties.ConnectionString

        }

        {

          name: ``'app-registration-secret'

          value: appRegistrationSecret

        }

      ]

      registries: [

        {

          server: containerRegistry``.properties.loginServer

          username: containerRegistry``.name

          passwordSecretRef: ``'registry-password'

        }

      ]

    }

    template: {

      containers: [

        {

          name: ``'functions-'

          image: ``'${containerRegistry.properties.loginServer}/${containerAppImageName}:${containerAppTag}'

          resources: {

            cpu: ``4

            memory: ``'8Gi'

          }

          env: [

            {

              name: ``'ADMIN_TENANTS'

              value: adminTenants

            }

          ]

        }

      ]

      scale: {

        minReplicas: containerAppBackendMinReplicas

        maxReplicas: containerAppBackendMaxReplicas

      }

    }

  }

}

Below is a screenshot of the Container App that I provisioned using the portal.

firefox_sZ66KZ4bHH

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

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.