Azure App Service (Kudu) - Why is the Current working directory path not matching the system path?

SimonY-1215 95 Reputation points
2026-04-04T06:45:39.7333333+00:00

I have an Azure Web App. When I look at the environment variables it shows that the current working directory is a weird path: (C:\Program Files (x86)\SiteExtensions\ApplicationInsightsAgent\2.8.47\ExtensionManager).

How is this path set?

Does this path do anything?

Can it be reset to C:\Windows\system32?

User's image

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.


Answer accepted by question author
Shree Hima Bindu Maganti 7,590 Reputation points Microsoft External Staff Moderator
2026-04-06T18:04:57.4633333+00:00

Hi @SimonY-1215
In Azure App Service, the “Current working directory” shown in Kudu is process-specific and dynamically set at runtime, not a fixed system path like C:\Windows\system32. The path you are seeing (C:\Program Files (x86)\SiteExtensions\ApplicationInsightsAgent\...\ExtensionManager) indicates that the active process is running from the Application Insights site extension, which defines its own working directory when it starts. This is expected behavior in App Service, where multiple components (Kudu, site extensions, your app) run as separate processes, each with its own working directory. This setting does not affect your application’s execution, as your app content is always hosted under D:\home\site\wwwroot, and Microsoft recommends using absolute paths or environment variables instead of relying on the current working directory. Additionally, this value cannot be manually reset to C:\Windows\system32 because it is controlled by the process startup context, not by App Service configuration.
https://learn.microsoft.com/en-us/azure/app-service/monitor-app-service?tabs=aspnetcore
https://learn.microsoft.com/en-us/azure/app-service/operating-system-functionality
https://learn.microsoft.com/en-us/azure/app-service/resources-kudu
Let me know if you have any further assistance needed.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Oldest
  1. AI answer

    2026-04-04T06:45:53.43+00:00

    In Azure App Service the “Current working directory” shown in Kudu is simply the process working directory for the worker process at the time it was started. It does not have to match the system directory and it can legitimately point into a site extension folder such as the Application Insights agent.

    On Windows, the working directory is just a process property (Environment.CurrentDirectory) that can be set by the process that launches the app or changed at runtime. It is independent of the system directory (C:\Windows\system32) and of the drives that App Service exposes for content and logs (for example %SystemDrive%, %ResourceDrive%, and the network content share).

    This path is mainly used when code or tools rely on relative paths. Windows path normalization applies the current directory to relative paths that are not fully qualified, so any relative file access from that process will be resolved against this working directory. If the app uses fully qualified paths or the recommended environment variables (%SystemDrive%, %ResourceDrive%, or the UNC content paths), the value shown here does not affect behavior.

    Changing it to C:\Windows\system32 is neither required nor recommended for App Service apps. Instead, code should:

    • Use environment variables such as %SystemDrive% and %ResourceDrive% rather than hard‑coded paths.
    • Avoid relying on the process working directory for locating content; use explicit, fully qualified paths or framework features like IHostEnvironment.ContentRootPath in .NET.

    The system directory (C:\Windows\system32) remains what Windows reports as the system folder regardless of the current working directory.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.