Published: August 2025

Ubuntu or Windows revisited

When running custom tools in a pipeline, it is best to choose Windows as the virtual machine image. There's one catch: unlike many of the standard Azure-related tasks is the task to publish to a Static Web App designed for Linux only. Bummer, Microsoft definitely wants to discourage the use of Windows images. But there is a workaround!

Of course we could reconsider to use Ubuntu for the custom tools, but that is not necessary. There are other situations where we need to resolve conflicting demands for the execution context, and the answer is: multiple jobs in the pipeline. Here we can do the same thing: create two jobs:

# Put the trigger/schedules here

jobs:

- job: RunCustomTools
  pool:
    vmImage: windows-latest

  steps:
    - checkout: self

    # Put the steps to run the custom tool(s) here
    
    - publish: $(System.DefaultWorkingDirectory)/wwwroot
      artifact: Website

- job: PublishToAzure
  dependsOn: RunCustomTools

  pool:
    vmImage: ubuntu-latest

  steps:
    - checkout: none

    - download: 'current'
      artifact: Website

    - task: AzureStaticWebApp@0
      inputs:
        workingDirectory: $(Pipeline.Workspace)
        app_location: 'Website'
        azure_static_web_apps_api_token: $(deployment_token)

Some remarks:

  • The RunCustomTools job has vmImage: windows-latest for the steps involving the custom tools
  • One of the last steps should be a publish step to store the website. Jobs do not share storage!
  • The second job, PublishToAzure, depends on the first and has vmImage: ubuntu-latest because of the Azure publication tool
  • There is no need to check out any git repository. Even if the RunCustomTools would have committed changes, the second job would still check out the same commit as the first one.
  • Download the created website. The files will be stored in $(Pipeline.Workspace)/Workspace (that cannot be changed).
  • Finally the Azure publication tool can be run.