Sad Tux - Windows bias detected
This page contains Windows bias

About This Page

This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.

Bias Analysis

Detected Bias Types
powershell_heavy
windows_tools
windows_first
Summary
The documentation provides both Linux and Windows instructions for advanced Tomcat configuration, but the Windows section is notably more detailed and relies heavily on PowerShell scripts and Windows-specific patterns (e.g., .cmd, %ENVVAR% notation, Windows paths). The Linux section uses shell scripts and standard Linux tools, but the Windows instructions are longer, more explicit, and introduce more custom scripting. Windows tools and patterns (PowerShell, .cmd, Windows environment variables) are described in detail, while Linux equivalents are less emphasized. The order of presentation sometimes puts Windows instructions before Linux, and the Windows section is more verbose.
Recommendations
  • Ensure parity in detail and clarity between Linux and Windows sections. Expand Linux instructions to match the step-by-step guidance given for Windows, including troubleshooting tips and explanations.
  • Where possible, provide cross-platform script examples (e.g., both Bash and PowerShell) side by side, or use neutral tools (like Azure CLI) as the primary example.
  • Avoid assuming PowerShell or Windows scripting as the default; for each Windows-specific tool or pattern, provide a Linux equivalent (e.g., Bash script for startup, Linux environment variable syntax).
  • Present Linux and Windows instructions in parallel or in a consistent order, rather than giving more prominence or detail to Windows.
  • Review for any missing Linux-specific troubleshooting, caveats, or best practices that are present for Windows.
GitHub Create Pull Request

Scan History

Date Scan Status Result
2025-07-12 23:44 #41 cancelled Biased Biased
2025-07-12 00:58 #8 cancelled Clean Clean
2025-07-10 05:06 #7 processing Clean Clean
2025-07-09 23:22 #6 cancelled Clean Clean

Flagged Code Snippets

#### Add the PowerShell configuration script

Next, add the configuration script called *configure.ps1* to the *%HOME%_\site* directory with the following code:

This PowerShell completes the following steps:

1. Check whether a custom Tomcat copy exists already. If it does, the startup script can end here.
2. Copy Tomcat locally.
3. Add shared data sources to the custom Tomcat's configuration using XSL transform.
4. Indicate that configuration was successfully completed.

#### Add XSL transform file

A common use case for customizing the built-in Tomcat installation is to modify the `server.xml`, `context.xml`, or `web.xml` Tomcat configuration files. App Service already modifies these files to provide platform features. To continue to use these features, it's important to preserve the content of these files when you make changes to them. To accomplish this, use an [XSL transformation (XSLT)](https://www.w3schools.com/xml/xsl_intro.asp).

Add an XSL transform file called *configure.ps1* to the *%HOME%_\site* directory. You can use the following XSL transform code to add a new connector node to `server.xml`. The *identity transform* at the beginning  preserves the original contents of the configuration file.

If you created a server-level data source, restart the App Service Linux application. Tomcat resets `CATALINA_BASE` to `/home/tomcat` and uses the updated configuration.

# [Windows](#tab/windows)

You can't directly modify a Tomcat installation for server-wide configuration because the installation location is read-only. To make server-level configuration changes to your Windows Tomcat installation, the simplest way is to do the following on app start: 

1. Copy Tomcat to a local directory (`%LOCAL_EXPANDED%`) and use that as `CATALINA_BASE` (see [Tomcat documentation on this variable](https://tomcat.apache.org/tomcat-10.1-doc/introduction.html)).
1. Add your shared data sources to `%LOCAL_EXPANDED%\tomcat\conf\server.xml` using XSL transform.

#### Add a startup file

Create a file named `startup.cmd` `%HOME%\site\wwwroot` directory. This file runs automatically before the Tomcat server starts. The file should have the following content:

Or, you can manually change the setting in the Azure portal:

1. Go to **Settings** > **Configuration** > **Application settings**.
1. Select **New Application Setting**.
1. Use these values to create the setting:
   1. **Name**: `CATALINA_BASE`
   1. **Value**: `"%LOCAL_EXPANDED%\tomcat"`

#### Finalize configuration

Finally, you place the driver JARs in the Tomcat classpath and restart your App Service. Ensure that the JDBC driver files are available to the Tomcat classloader by placing them in the */home/site/lib* directory. In the [Cloud Shell](https://shell.azure.com), run `az webapp deploy --type=lib` for each driver JAR: