Azure / azure-functions-on-container-apps

Docs , samples and issues for Azure Functions on Azure Container Apps
MIT License
74 stars 18 forks source link

Applications Insights not Enabled when deploying with Azure CLI #22

Closed KaiWalter closed 3 months ago

KaiWalter commented 1 year ago

When I deploy some Functions on ACA with CLI like

        az functionapp create -g $RESOURCE_GROUP_NAME --name $app \
        --environment $ENVIRONMENT_NAME \
        --functions-version 4 \
        --runtime dotnet-isolated \
        --storage-account $STORAGE_NAME \
        --app-insights $APPINSIGHTS_NAME \
        --app-insights-key $APPINSIGHTS_INSTRUMENTATIONKEY \
        --image $AZURE_CONTAINER_REGISTRY_ENDPOINT/$IMAGE

and initialize Application Insights in Program.cs like

using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Hosting;

var host = new HostBuilder()
    .ConfigureFunctionsWorkerDefaults(builder =>
    {
        builder
            .AddApplicationInsights()
            .AddApplicationInsightsLogger();
    })
    .Build();

await host.RunAsync();

I cannot see telemetry in Application Insights and noticed, that Application Insights is not enabled on the Functions Resource

image

$ azure-cli                         2.48.1 *

core                              2.48.1 *
telemetry                          1.0.8

Extensions:
aks-preview                      0.5.137
containerapp                      0.3.29

Dependencies:
msal                              1.20.0
azure-mgmt-resource               22.0.0

Python location '/opt/az/bin/python3'
Extensions directory '/home/kai/.azure/cliextensions'

Python (Linux) 3.10.10 (main, Apr 25 2023, 04:23:10) [GCC 11.3.0]
raorugan commented 1 year ago

Have you seen any deployment errors while creating this function app? Btw we have launched Azure Functions on ACA in public preview - https://techcommunity.microsoft.com/t5/apps-on-azure-blog/azure-functions-for-cloud-native-microservices-public-preview/ba-p/3826800. You may now try Bicep deployments as well

raorugan commented 1 year ago

Can you share the az functionapp create --debug output?

raorugan commented 1 year ago

@KaiWalter - please confirm if this issue is resolved?

KaiWalter commented 1 year ago

@raorugan sorry, deleted the Functions on ACA apps and re-created 'em - see #7

but still Application Insights does not seem to be enabled image

with my CLI version of a create:

    az functionapp create -g $RESOURCE_GROUP_NAME --name $capp \
      --environment $ENVIRONMENT_NAME \
      --functions-version 4 \
      --runtime dotnet-isolated \
      --storage-account $STORAGE_NAME \
      --app-insights $APPINSIGHTS_NAME \
      --app-insights-key $APPINSIGHTS_INSTRUMENTATIONKEY \
      --image $AZURE_CONTAINER_REGISTRY_ENDPOINT/$IMAGE

my current version posture:

azure-cli                         2.48.1 *

core                              2.48.1 *
telemetry                          1.0.8

Extensions:
aks-preview                      0.5.137
application-insights              0.1.19
containerapp                      0.3.33

Dependencies:
msal                              1.20.0
azure-mgmt-resource               22.0.0

Python location '/opt/az/bin/python3'
Extensions directory '/home/kai/.azure/cliextensions'

Python (Linux) 3.10.10 (main, Apr 25 2023, 04:23:10) [GCC 11.3.0]
raorugan commented 1 year ago

looking into this

sushmithavangala commented 1 year ago

Hi @KaiWalter , I'll be trying to reproduce this and get back to you.

raorugan commented 1 year ago

@KaiWalter the fix is in progress! if this is high priority pls enable from AppInsights of functions resource. Once deployment completes will let you know

kamperiadis commented 3 months ago

Marking as closed as this should already have been resolved with my changes