Skip to content

Latest commit

 

History

184 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logging .NET Azure Functions in isolated worker model

Examples of 'vanilla' App Insights logging in .NET Azure Function apps, and integrating Serilog, with both .NET 8 and 9.

Microsoft.ApplicationInsights.WorkerService 3.0.0

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

Azure environment configuration

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-australiaeast

Make a note of the appId value, as you'll enter that as the --id parameter.

https://learn.microsoft.com/entra/workload-id/workload-identity-federation-create-trust?pivots=identity-wif-apps-methods-azp&WT.mc_id=DOP-MVP-5001655#github-actions

az ad app federated-credential create --id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --parameters credential.json

Create 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 list

and 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

About

Example of a .NET Azure Function with isolated worker model and Serilog logging

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages