Examples of 'vanilla' App Insights logging in .NET Azure Function apps, and integrating Serilog, with both .NET 8 and 9.
The v3 version of this package introduced breaking changes, including a dependency on Microsoft.ApplicationInsights, Version=3.0.0.1, which is incompatible with the Microsoft.Azure.Functions.Worker.ApplicationInsights package.
The Functions team have commented that they will not be releasing a 3.0-compatible version of Microsoft.Azure.Functions.Worker.ApplicationInsights, and instead encourage the move to OpenTelemetry monitoring.
For Functions still using Microsoft.Azure.Functions.Worker.ApplicationInsights, then stick with the latest v2 release of Microsoft.ApplicationInsights.WorkerService
az group create --name rg-funcs-logging-australiaeast --location australiaeast
# Prepare a service principal for Login with OIDC
az ad sp create-for-rbac --name sp-funcs-logging-australiaeast --role Contributor --scopes /subscriptions/<yoursubscription>/resourceGroups/rg-funcs-logging-australiaeastMake a note of the appId value, as you'll enter that as the --id parameter.
az ad app federated-credential create --id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --parameters credential.jsonCreate credential.json
{
"name": "Testing",
"issuer": "https://token.actions.githubusercontent.com",
"subject": "repo:octo-org/octo-repo:environment:Production",
"description": "Testing",
"audiences": [
"api://AzureADTokenExchange"
]
}Get the Azure subscription ID:
az account subscription listand then set the following as GitHub secrets
- AZURE_CLIENT_ID the Application (client) ID
- AZURE_TENANT_ID the Directory (tenant) ID
- AZURE_SUBSCRIPTION_ID your subscription ID