Placing toscha in the windows container agent

tarun k 405 Reputation points
2025-07-03T13:51:39.1266667+00:00

I am trying to install tosca in the container agent, Please suggest way

Azure DevOps
{count} votes

Accepted answer
  1. Durga Reshma Malthi 5,650 Reputation points Microsoft External Staff Moderator
    2025-07-07T08:31:27.8533333+00:00

    Hi tarun k

    As we discussed in private message, in your file, there is tosca client file but tosca events.xml file is not there

    firstly, make sure your repo structure should be like this

    Docker-Windows-Agent/
    ├── optionalp/
    │   └── Dockerfile
    ├── install_build_tools/
    ├── Toscha/
    │   ├── ToscaCIClient.exe
    │   ├── ToscaCIClient.log
    │   ├── ToscaCIExecution.dll
    │   ├── TOSCACIEvent.json
    │   ├── ToscaCIJavaClient.jar
    │   └── etc...
    

    Inside optionalp/Dockerfile,

    WORKDIR /scripts
    COPY install_build_tools/* ./
    

    then add this in your docker file,

    # Copy Tosca binaries into container
    COPY ./Toscha/ "C:/Tosca/"
    

    Make sure the script sets environment variables and checks for the main executable:

    Write-Host "Configuring Tosca..."
    $ToscaPath = "C:\Tosca"
    # Set environment vars
    [Environment]::SetEnvironmentVariable("TOSCA_HOME", $ToscaPath, "Machine")
    [Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";$ToscaPath", "Machine")
    # Validate installation
    if (!(Test-Path "$ToscaPath\ToscaCIClient.exe")) {
        Write-Error "ToscaCIClient.exe is missing at $ToscaPath"
        exit 1
    }
    Write-Host "Tosca installed successfully."
    

    The Dockerfile already runs this:

    RUN powershell -ExecutionPolicy Bypass -File install_tosca.ps1 $AUSER $env:AUSER $APASS $env:APASS
    

    So, this script will automatically run inside the container build.

    From the optionalp folder, run this command to create a Windows container image with Tosca preloaded in C:\Tosca.

    docker build -t myagent-with-tosca .
    

    Once your container agent is running and registered with Azure DevOps, use the Tosca tools in your pipeline like this:

    - script: |
        C:\Tosca\ToscaCIClient.exe /run /workspace "C:\Tosca\MyWorkspace" /someOption
      displayName: 'Run Tosca Test'
    

    Hope this helps!

    Please Let me know if you have any queries.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Durga Reshma Malthi 5,650 Reputation points Microsoft External Staff Moderator
    2025-07-04T07:44:11.68+00:00

    Hi tarun k

    Since you’re working with a self-hosted Windows container agent and already have the Tosca binary files locally, here’s how you can structure your Dockerfile to make those files available within the container for pipeline execution:

    # Use Windows base image that supports Tosca components
    FROM mcr.microsoft.com/windows/servercore:ltsc2022
    # Create a working directory inside the container
    WORKDIR C:\ToscaAgent
    # Copy Tosca binary files from your local machine into the container
    # NOTE: Ensure this folder is in the same location as your Dockerfile during build
    COPY TOSCA\* C:\ToscaAgent\
    # Optionally set environment variables
    ENV TOSCA_HOME="C:\ToscaAgent"
    ENV PATH="$PATH;C:\ToscaAgent"
    # (Optional) Run ToscaCIClient.exe for validation or initialization if needed
    # RUN C:\ToscaAgent\ToscaCIClient.exe --help
    # Set default command (you can override in pipeline)
    CMD ["cmd.exe"]
    

    Make sure your local folder (let’s say C:\ToscaInstaller) contains Tosca CLI tools like ToscaCIClient.exe

    Hope this helps!

    Please Let me know if you have any queries.

    0 comments No comments

Your answer

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