This repository contains the necessary files to build a Docker container for running Azure Pipelines agents on Windows Server Core LTSC 2022. The container includes pre-installed tools like PowerShell and is configured to run Azure Pipelines agents effectively.
- Dockerfile: Defines the Docker image configuration, including the installation of required software and setup of the Azure Pipelines agent.
- start.ps1: PowerShell script to configure and start the Azure Pipelines agent within the container.
- Azure DevOps Organization: Ensure you have an Azure DevOps organization and have generated a Personal Access Token (PAT) with appropriate permissions.
- Docker: Install Docker on your machine or server.
- PowerShell: Ensure PowerShell is available for script execution.
-
Clone the Repository
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name
-
Build the Docker Image
docker build -t azure-pipelines-agent .
-
Run the Docker Container
docker run -e ARM_CLIENT_ID= -e ARM_CLIENT_SECRET= -e ARM_SUBSCRIPTION_ID= -e ARM_TENANT_ID= -e AZURE_DEVOPS_PAT= -e AZURE_DEVOPS_ORG_URL= azure-pipelines-agent
Replace
ARM_CLIENT_ID
,ARM_CLIENT_SECRET
,ARM_SUBSCRIPTION_ID
,ARM_TENANT_ID
,AZURE_DEVOPS_PAT
, andAZURE_DEVOPS_ORG_URL
with your actual Azure service principal credentials and Azure DevOps details.
- Dockerfile: Configures the image with Windows Server Core LTSC 2022, installs PowerShell, Git, and the Azure Pipelines agent.
- start.ps1: Sets up and starts the Azure Pipelines agent. Ensure to replace placeholder values with your Azure DevOps organization URL and PAT in the script.
- Personal Access Token (PAT): Store your PAT securely and avoid hardcoding it directly into scripts or Dockerfiles. Use environment variables or secure vault solutions to manage this sensitive information.
- Azure DevOps Organization Name: Similarly, store your Azure DevOps organization URL as a secret to prevent exposure of your organization details.
- Generate Personal Access Token (PAT): Follow Azure DevOps documentation to create a PAT with the necessary scopes.
- Configure Azure DevOps Organization: Ensure your organization URL and PAT are securely configured in the
start.ps1
script and Docker container environment variables.
This setup is designed for running Azure Pipelines agents in various environments, including personal PCs, virtual machines, and Azure Container Instances. Modify the Dockerfile and start.ps1
script as needed to fit your specific use case or environment requirements.
Contributions are welcome! Please submit a pull request or open an issue if you have suggestions or improvements.
This project is licensed under the MIT License. See the LICENSE
file for details.