Docs/CI/CD Integration/Azure DevOps

Azure DevOps

Publish npm packages, NuGet packages, and Docker images to DepAegis from your Azure DevOps pipelines. This guide covers service connections, pipeline variables, and complete YAML examples.

Setting Up Your DepAegis Token

There are two ways to provide your DepAegis token to Azure Pipelines:

Option A: Pipeline Variable (Simple)

  1. Create a token in the DepAegis dashboard under Settings → Access Tokens.
  2. In Azure DevOps, navigate to Pipelines → Library → Variable groups.
  3. Create a variable group (e.g. depaegis-creds) and add a variable named DEPAEGIS_TOKEN with your token value.
  4. Mark the variable as secret.

Option B: Service Connection (Recommended)

  1. In Azure DevOps, go to Project Settings → Service connections.
  2. Click New service connection and select Generic (or NuGet for .NET workflows).
  3. Fill in the details:
    • Connection name: depaegis-npm (or depaegis-nuget)
    • Server URL: https://app.depaegis.com/ (or NuGet feed URL)
    • Username: your DepAegis username or service account
    • Password/Token: your DepAegis PAT
  4. Grant access to all pipelines (or restrict to specific pipelines).
Service connections are the recommended approach because they separate credentials from pipeline definitions and support granular permission scoping.

Publishing npm Packages

A pipeline that publishes an npm package on tag push:

# azure-pipelines.yml
trigger:
  tags:
    include:
      - "v*"

variables:
  - group: depaegis-creds

pool:
  vmImage: "ubuntu-latest"

steps:
  - task: NodeTool@0
    inputs:
      versionSpec: "20.x"
    displayName: "Install Node.js"

  - script: npm ci
    displayName: "Install dependencies"

  - script: npm run build
    displayName: "Build"

  - script: |
      cat > .npmrc <<EOF
      //app.depaegis.com/:_authToken=$(DEPAEGIS_TOKEN)
      @my-org:registry=https://app.depaegis.com/api/v1/npm/
      EOF
    displayName: "Configure .npmrc"
    env:
      DEPAEGIS_TOKEN: $(DEPAEGIS_TOKEN)

  - script: npm publish
    displayName: "Publish to DepAegis"
    env:
      NODE_AUTH_TOKEN: $(DEPAEGIS_TOKEN)
The .npmrc is generated at build time from the secret variable. Do not commit .npmrc files containing tokens to the repository.

Publishing NuGet Packages

Build and push .NET packages using the built-in NuGet task:

# azure-pipelines.yml
trigger:
  tags:
    include:
      - "v*"

variables:
  - group: depaegis-creds

pool:
  vmImage: "ubuntu-latest"

steps:
  - task: UseDotNet@2
    inputs:
      packageType: "sdk"
      version: "10.0.x"
    displayName: "Install .NET SDK"

  - script: dotnet pack MyPackage.csproj -c Release -o $(Build.ArtifactStagingDirectory)
    displayName: "Pack NuGet package"

  - task: NuGetCommand@2
    inputs:
      command: "push"
      packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg"
      publishVstsFeed: false
      externalEndpoint: "depaegis-nuget"
    displayName: "Push to DepAegis"
The externalEndpoint references the service connection you created earlier. If you prefer variable-based auth, use a script task with dotnet nuget push --api-key $(DEPAEGIS_TOKEN) instead.

Pushing Docker Images

Build and push a Docker image to the DepAegis container registry:

# azure-pipelines.yml
trigger:
  tags:
    include:
      - "v*"

variables:
  - group: depaegis-creds
  imageName: "app.depaegis.com/my-org/my-app"

pool:
  vmImage: "ubuntu-latest"

steps:
  - task: Docker@2
    displayName: "Log in to DepAegis Container Registry"
    inputs:
      command: login
      containerRegistry: "depaegis-docker"

  - task: Docker@2
    displayName: "Build image"
    inputs:
      command: build
      repository: "app.depaegis.com/my-org/my-app"
      tags: |
        $(Build.SourceBranchName)
        latest

  - task: Docker@2
    displayName: "Push image"
    inputs:
      command: push
      repository: "app.depaegis.com/my-org/my-app"
      tags: |
        $(Build.SourceBranchName)
        latest
Create a Docker Registry service connection (not Generic) for Docker tasks. Go to Project Settings → Service connections → New → Docker Registry and enter your DepAegis container registry URL and credentials.

Full Pipeline Example

A multi-stage pipeline with build, test, and publish:

# azure-pipelines.yml
trigger:
  tags:
    include:
      - "v*"

variables:
  - group: depaegis-creds
  NPM_REGISTRY: "https://app.depaegis.com/"
  NUGET_SOURCE: "https://nuget.app.depaegis.com/api/v1/nuget/v3/index.json"

stages:
  - stage: Test
    jobs:
      - job: test_node
        pool:
          vmImage: "ubuntu-latest"
        steps:
          - task: NodeTool@0
            inputs:
              versionSpec: "20.x"
          - script: npm ci
          - script: npm test

      - job: test_dotnet
        pool:
          vmImage: "ubuntu-latest"
        steps:
          - task: UseDotNet@2
            inputs:
              packageType: "sdk"
              version: "10.0.x"
          - script: dotnet test

  - stage: Publish
    dependsOn: Test
    jobs:
      - job: publish_npm
        pool:
          vmImage: "ubuntu-latest"
        steps:
          - task: NodeTool@0
            inputs:
              versionSpec: "20.x"
          - script: npm ci
          - script: npm run build
          - script: |
              cat > .npmrc <<EOF
              //app.depaegis.com/:_authToken=$(DEPAEGIS_TOKEN)
              @my-org:registry=https://app.depaegis.com/api/v1/npm/
              EOF
            env:
              DEPAEGIS_TOKEN: $(DEPAEGIS_TOKEN)
          - script: npm publish
            env:
              NODE_AUTH_TOKEN: $(DEPAEGIS_TOKEN)

      - job: publish_nuget
        pool:
          vmImage: "ubuntu-latest"
        steps:
          - task: UseDotNet@2
            inputs:
              packageType: "sdk"
              version: "10.0.x"
          - script: dotnet pack MyPackage.csproj -c Release -o $(Build.ArtifactStagingDirectory)
          - task: NuGetCommand@2
            inputs:
              command: "push"
              packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg"
              externalEndpoint: "depaegis-nuget"

      - job: publish_docker
        pool:
          vmImage: "ubuntu-latest"
        steps:
          - task: Docker@2
            inputs:
              command: login
              containerRegistry: "depaegis-docker"
          - task: Docker@2
            inputs:
              command: buildAndPush
              repository: "app.depaegis.com/my-org/my-app"
              tags: |
                $(Build.SourceBranchName)
                latest

Service Connection Summary

For the full pipeline above, create three service connections in Azure DevOps:

Connection NameTypeServer URLUsed By
depaegis-nugetNuGethttps://nuget.app.depaegis.com/api/v1/nuget/v3/index.jsonNuGetCommand@2 push
depaegis-dockerDocker Registryhttps://app.depaegis.comDocker@2 login/push
depaegis-npm (optional)Generichttps://app.depaegis.com/Custom script auth
For npm publishing, variable-group auth with a generated .npmrc is the most common pattern. A Generic service connection is useful if you want to call the DepAegis REST API directly from a script task.