microsoft / azure-container-apps

Roadmap and issues for Azure Container Apps
MIT License
363 stars 29 forks source link

Deploying Azure Functions on internal Container App environment results in failure #944

Open ZachTB123 opened 11 months ago

ZachTB123 commented 11 months ago

Please provide us with the following information:

This issue is a: (mark with an x)

Issue description

I have an internal Container App environment that I am using to host my Container Apps. I would like to use this environment to host my Azure Functions. When I deploy my Azure Function to this existing environment, I get a failure message.

Steps to reproduce

  1. Deploy the following bicep file (base taken from https://github.com/Azure/azure-functions-on-container-apps/blob/main/samples/Biceptemplates/Func_on_ACA_Bicepdeploy.bicep):
    
    param location string = resourceGroup().location

@description('Resource name prefix') param resourceNamePrefix string var envResourceNamePrefix = toLower(resourceNamePrefix)

/ ###################################################################### / // Create storage account for function app prereq / ###################################################################### / resource azStorageAccount 'Microsoft.Storage/storageAccounts@2021-08-01' = { name: '${envResourceNamePrefix}storage' location: location kind: 'StorageV2' sku: { name: 'Standard_LRS' } properties: { minimumTlsVersion: 'TLS1_2' } } var azStorageConnectionString = 'DefaultEndpointsProtocol=https;AccountName=${azStorageAccount.name};EndpointSuffix=${az.environment().suffixes.storage};AccountKey=${azStorageAccount.listKeys().keys[0].value}'

resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2021-06-01' = { name: '${envResourceNamePrefix}-la' location: location properties: any({ retentionInDays: 30 features: { searchVersion: 1 } sku: { name: 'PerGB2018' } }) }

resource appInsights 'Microsoft.Insights/components@2020-02-02' = { name: '${envResourceNamePrefix}-ai' location: location kind: 'web' properties: { Application_Type: 'web' WorkspaceResourceId: logAnalyticsWorkspace.id } }

resource vnet 'Microsoft.Network/virtualNetworks@2023-04-01' = { name: '${envResourceNamePrefix}-vnet' location: location properties: { addressSpace: { addressPrefixes: [ '10.0.0.0/16' ] } } }

resource subnet 'Microsoft.Network/virtualNetworks/subnets@2023-04-01' = { name: 'default' parent: vnet properties: { addressPrefix: '10.0.0.0/24' delegations: [ { name: 'ac' properties: { serviceName: 'Microsoft.App/environments' } } ] } }

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 } } vnetConfiguration: { infrastructureSubnetId: subnet.id internal: true } workloadProfiles: [ { name: 'Consumption' workloadProfileType: 'Consumption' } ] } }

resource azfunctionapp 'Microsoft.Web/sites@2022-09-01' = { name: '${envResourceNamePrefix}-funcapp' location: location kind: 'functionapp' properties: { name: '${envResourceNamePrefix}-funcapp' managedEnvironmentId: environment.id siteConfig: { linuxFxVersion: 'Docker|mcr.microsoft.com/azure-functions/dotnet7-quickstart-demo:1.0' appSettings: [ { name: 'AzureWebJobsStorage' value: azStorageConnectionString } { name: 'APPLICATIONINSIGHTS_CONNECTION_STRING' value: appInsights.properties.ConnectionString } ]

}

} }

output functionAppName string = azfunctionapp.name


**Expected behavior** [What you expected to happen.]

The Function App is deployed successfully.

**Actual behavior** [What actually happened.]

Deploying the bicep file outputs the following error:

```json
{
    "status": "Failed",
    "error": {
        "code": "DeploymentFailed",
        "target": "<redacted>",
        "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
        "details": [
            {
                "code": "InternalServerError",
               "message": "There was an unexpected InternalServerError.  Please try again later.  x-ms-correlation-request-id: 7fb38ccc-7c21-4c30-bb48-be0396af293d"
            }
        ]
    }
}
vturecek commented 11 months ago

Hi @ZachTB123 we're looking into it, please stand by..

raorugan commented 11 months ago

Functions is not yet supported in a vnet internal enabled environmental. This feature work is in progress currently.

eduards-vavere commented 3 months ago

Is this now available?

raorugan commented 3 months ago

oh! yes it is now available. You can deploy your function apps in a VNET internal enabled container app environments .Check out the blog here - https://techcommunity.microsoft.com/t5/apps-on-azure-blog/general-availability-of-azure-functions-on-azure-container-apps/ba-p/4145577