Error when I deploy function app on Azure Container apps environment

Madhusudhana Rao Challapalli 40 Reputation points
2024-01-03T14:21:09.9233333+00:00

Hi all,

When I deploy function app on Container apps environment using bicep template

Error -

    "error": {
        "code": "InternalServerError",
        "message": "There was an unexpected InternalServerError.  Please try again later.  x-ms-correlation-request-id: 2be030aa-8b87-48f2-b202-f7008a936580"
    }

Bicep -

resource environment 'Microsoft.App/managedEnvironments@2023-05-01' = {
  name: '${envResourceNamePrefix}-env'
  location: location
  properties: {
    daprAIInstrumentationKey: appInsights.properties.InstrumentationKey
    appLogsConfiguration: {
      destination: 'log-analytics'
      logAnalyticsConfiguration: {
        customerId: logAnalyticsWorkspace.properties.customerId
        sharedKey: logAnalyticsWorkspace.listKeys().primarySharedKey
      }
    }
  }
}
resource azfunctionapp 'Microsoft.Web/sites@2022-09-01' = {
  name: '${envResourceNamePrefix}-funcapp'
  location: location
  tags: tags
  kind: 'functionapp'
    identity: {
    type: 'UserAssigned'
    userAssignedIdentities: {
      '${managedIdentity.id}' : {}
    }
  }
  properties: {
    managedEnvironmentId:environment.id
    httpsOnly: true
    clientAffinityEnabled: false
    virtualNetworkSubnetId: null
    siteConfig: {
      linuxFxVersion: 'Docker|ACR/${imageName}:${imageTag}'  
    appSettings: [
        {
          name: 'Storage'
          value: ConnectionString
        }
        {
          name: 'INSIGHTS_CONNECTION_STRING'
          value: ConnectionString
        }
      ]

    }
  }
}
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,908 questions
Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
685 questions
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2024-01-03T16:39:00.88+00:00

    Madhu Challapalli Thanks for posting your question in Microsoft Q&A. Quickly reviewing the correlation id, you shared, I found the following error message in the logs:

    {"error":{"code":"InvalidParameterValueInContainerTemplate","message":"The following field(s) are either invalid or missing. Field 'template.containers.functions-container.image' is invalid with details: 'Invalid value: \"<xxx>.azurecr.io/sandbox/ctr-adr-egpoc:latest\": GET https:?scope=repository%3Asandbox%2Fctr-adr-egpoc%3Apull&service=<xxx>.azurecr.io: UNAUTHORIZED: authentication required, visit https://aka.ms/acr/authorization for more information.';."}}

    From the error message, it looks like the field has invalid value or a private container registry missing the credentials for authentication.

    Please validate the field value is correct (sample value for docker: DOCKER|myacr.azurecr.io/myimage:mytag from doc reference) and if it is private container registry, add three registry settings in your bicep template as described in doc: Application Configuration.User's image

    I hope this helps and let me know if any questions.


    If you found the answer to your question helpful, please take a moment to mark it as Yes for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.


0 additional answers

Sort by: Most helpful

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.