I finally get it working via Github Actions, by install Postgres/MSSQL AdventureWorksLT testing database on Windows runner:
DevOps: Windows runner with Linux database container
I'm working on a .Net open source project which multi-targets net472/netstandard2.0/net8.0/net10.0. To run test with code coverage analysis, I need to run the pipeline on Windows runner, otherwise the tests targets net472 will fail. However, there are some tests are integration tests which require SQL Server/PostgresSql testing database (AdventureWorksLT). These database servers are running as Linux docker containers. GitHub actions does not support this kind of mixed runner, is it supported by Azure pipeliine (free)?
Here is a sample repo:
https://github.com/weifenluo/CITest/
There are two GitHub actions implemented: coverage.yml and coverage.windows.yml. The coverage.yml uses Linux runner end up with 1 out 3 tests failed (targeting net472); The coverage.windows.yml uses Windows runner end up with all tests failed because the linux database containers cannot be connected.
Azure DevOps
3 answers
Sort by: Most helpful
-
-
Siddhesh Desai 4,030 Reputation points Microsoft External Staff Moderator
2026-02-16T19:49:29.37+00:00 Hi @Weifen Luo
Thank you for reaching out to Microsoft Q&A.
In your case, the issue is not related to test configuration or code coverage tooling, but to fundamental platform constraints around operating systems and container runtimes. Your project multi‑targets
net472,netstandard2.0,net8.0, andnet10.0. Tests targetingnet472must run on Windows, because .NET Framework is Windows‑only. At the same time, your integration tests depend on SQL Server and PostgreSQL instances that are started as Linux Docker containers. Hosted CI systems (both GitHub Actions and Azure Pipelines) do not provide a runner that can simultaneously act as a Windows host and run Linux containers. When you use a Linux runner,net472fails; when you use a Windows runner, the Linux containers cannot be started or connected to. This is an expected limitation of hosted CI infrastructure rather than a misconfiguration. Azure Pipelines documentation explicitly states that Linux containers run only on Linux pools and Windows containers only on Windows pools, so a hosted Windows pool for Linux containers is not supported.Refer below points to resolve this issue or this is the workaround
1) Hosted Windows pool cannot run Linux containers (not supported) Azure Pipelines behaves the same as GitHub Actions in this respect.
- Hosted Windows pools → support Windows containers only
- Hosted Linux pools → support Linux containers only
- There is no hosted option that allows Linux containers to run on a Windows agent Because of this, your desired setup (“Windows runner + Linux DB containers”) is not supported on Azure Pipelines either.
2) Use a multi‑job Azure Pipeline (recommended and supported, even on free tier) The supported solution is to split the pipeline by OS instead of trying to mix them in one job.
- Windows job
- Runs unit tests and coverage for
net472- Runs any tests that do not require containerized databases
- Runs unit tests and coverage for
- Linux job
- Starts SQL Server and PostgreSQL as Linux Docker containers
- Runs integration tests targeting
netstandard2.0,net8.0,net10.0Azure Pipelines free tier supports multiple jobs in a single pipeline; they just run sequentially when you have one free parallel job.
3) Separate integration tests from Windows‑only tests Mark integration tests explicitly (for example, using traits or categories).
- Windows job: exclude integration tests
- Linux job: include only integration tests This avoids cross‑platform failures and aligns each test group with the OS it actually requires.
4) Optional workaround: self‑hosted Windows agent with Docker/WSL2 If you truly need Windows + Linux containers in the same job, the only option is a self‑hosted Windows agent configured with Docker Desktop and WSL2.
- This is technically supported by Azure Pipelines
- It is not a hosted/free managed runner scenario
- It introduces infrastructure maintenance and cost For most open‑source projects, this is usually not desirable.
Summary: You are correct in your assumption: a hosted Windows pool running Linux containers is not supported in Azure DevOps, just like GitHub Actions. The supported and recommended approach on Azure Pipelines (including the free tier) is to split the workflow into separate Windows and Linux jobs, each running the tests appropriate to that platform.
-
Q&A Assist2026-02-15T14:59:47.5766667+00:00 AI generated content. This question contains an answer created with AI from Q&A Assist. Learn moreAzure Pipelines does support running mixed environments, which means you can use a Windows runner for your .NET tests while also utilizing Linux containers for your SQL Server or PostgreSQL databases. This allows you to run your integration tests that require these databases without the limitations you encountered in GitHub Actions.
To achieve this, you can define your pipeline in Azure DevOps to use a Windows agent for the main tasks and then specify service containers for your database needs. This setup allows the Windows agent to connect to the Linux containers running your databases. You can define the service containers in your YAML pipeline configuration.
Here’s a brief outline of how you might set up your Azure Pipeline:
- Use a Windows agent for your .NET tests.
- Define the Linux database containers as service containers in the pipeline.
- Ensure that your integration tests can connect to these containers.
This way, you can run your tests targeting net472 on a Windows runner while still accessing your Linux-based database containers for integration tests.
References: