microsoft / azure-container-apps

Roadmap and issues for Azure Container Apps
MIT License
356 stars 27 forks source link

Portal bug occurs when authConfig's platform property is not specified #1076

Open robbelouwet opened 4 months ago

robbelouwet commented 4 months ago

Please provide us with the following information:

This issue is a: (mark with an x)

Issue description

Deployment succeeds when not specifying platform in a container app's auth config. This causes a portal bug.

Steps to reproduce

  1. Create a container app (through bicep)
  2. Do not specify the platform configuration
  3. Deployment should succeed
  4. In portal, go to container app > settings > authentication. There will be a notification telling you to enable authentication on the container app, along with a call to action button. Clicking this will trigger an infinite deployment, opening developer console reveals that it can't find the platform attribute.

Expected behavior [What you expected to happen.] An error should be thrown during deployment or at portal if platform is not required property.

Actual behavior [What actually happened.] Portal does not expect platform attribute to not be present and causes error. Re-deploying with platform property solves issue

Screenshots

github

Additional context

bicep used, notice the .properties.platform in comment of the authConfig child resource:

resource paperBackend 'Microsoft.App/containerapps@2023-05-02-preview' = {
  name: '${appName}-server'
  location: location
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    managedEnvironmentId: cappEnvironment.id
    configuration: {
      secrets: [
        {
          name: 'google-client-secret'
          value: googleClientSecret
        }
      ]
      ingress: {
        external: true
        targetPort: 5000
        transport: 'Http'
        traffic: [
          {
            weight: 100
            latestRevision: true
          }
        ]
      }
    }

    template: {
      containers: [
        {
          image: 'robbelouwet/paper-backend:latest'
          name: 'backend-container'
          env: [
            {
              name: 'ST_ACC_CONN_STRING'
              value: connString
            }
            {
              name: 'ST_ACC_RG'
              value: resourceGroup().name
            }
            {
              name: 'CAPP_ENV_NAME'
              value: cappEnvironment.name
            }
            {
              name: 'ST_ACC_NAME'
              value: storageName
            }
          ]
          resources: {
            cpu: json('0.5')
            memory: '1Gi'
          }
          probes: []
        }
      ]
      scale: {
        minReplicas: 0
        maxReplicas: 1
      }
    }
  }
  resource auth 'authConfigs@2023-05-01' = {
    name: 'current'
    properties: {
      globalValidation: {
        unauthenticatedClientAction: 'Return401'
      }
      // platform: {
      //   enabled: true
      // }
      identityProviders: {
        google: {
          enabled: true
          registration: {
            clientId: googleClientId
            clientSecretSettingName: 'google-client-secret'
          }
        }
      }
    }
  }
  dependsOn: [ cappEnvironment ]
}
anthonychu commented 4 months ago

Thanks for reporting. We're investigating this. (internal bug # 26777500)