I have an asp.net 5 web application on .NET Framework 4.8 running as an azure app service with a windows server 2019 container image. I setup a diagnostic setting to send the 'AppServiceHTTPLogs' to an event hub and when inspecting the logs, I noticed that the CsUsername property is missing for authenticated requests.
Running the same container image locally or even as an Azure Container Instance and inspecting the IIS logs on the container I can see the username so it's something to do with how and where the https logs are captured when running as an app service where the logs don't pick up on the authenticated principal's identity name.
Has anybody else run into this? Do I need to expose the principal as a response header for the logging to pick it up?
UPDATE: 02/24/2022
In addition to asking here I had also started a case with azure support inquiring about why the web server logs from an azure app service on a windows app service plan running a windows container is missing the cs-username information whereas consoling the running container of the app service and inspecting the w3c log in C:\inetpub\logs\LogFiles\W3SVC1 shows the cs-username value.
They finally got back and said:
At this moment I'm afraid that this feature is not supported for the architecture that you have set, the only way to get the details for the CsUsername is to deploy a Linux App Service and then target an Azure Storage account as the data endpoint.
That doesn't help me at all since I can't run a .NET Framework 4.8 ASP.NET MVC 5 application container in a Linux app service plan. Generally, through this ordeal of deploying windows containers to run as an azure app service with an Azure DevOps pipeline to running the container as an azure app service, I've found microsoft's support for running windows based containers to be very challenging and without much ongoing support. They try to push the linux hosting environment which unfortunately is an option only if your architecture is based on the .NET core framework.