#7735·keda

Azure Pipeline Scaler sometime do not Scale

Author: tiwarishrijanCreated May 13, 2026Updated Sep 25, 2026
Labelsbugscalerscaler-azure-pipelines

Report

I am using below configuration to create azure devops agents in very dynamic enviornment, our agent spin up time is 40 Second in total as of now, We observed that sometime randomly job is queued and waits. We observed following:

  1. No agents is requested in Kubernetes (No Job is created)
  2. Azure devops API returns pending jobs

Keda logs displays that pending jobs are 0

yaml
apiVersion: keda.sh/v1alpha1
kind: ScaledJob
metadata:
  labels:
    app.kubernetes.io/instance: scaler-job
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: scaler-job
    app.kubernetes.io/version: 1.16.0
    helm.sh/chart: scaler-job-0.1.0
  name: azure-beta-job
spec:
  failedJobsHistoryLimit: 20
  jobTargetRef:
    backoffLimit: 0
    completions: 1
    parallelism: 1
    template:
      metadata:
        creationTimestamp: null
        labels:
          app: keda-scaledjob
          app.kubernetes.io/instance: scaler-job
          app.kubernetes.io/managed-by: Helm
          app.kubernetes.io/name: scaler-job
          app.kubernetes.io/version: 1.16.0
          azure.workload.identity/use: "true"
          helm.sh/chart: scaler-job-0.1.0
      spec:
        containers:
        - env:
          - name: AZP_POOL
            value: POOL_NAME_HERE
          - name: java
            value: path
          - name: npm
            value: path
          - name: maven
            value: path
          - name: sh
            value: path
          - name: JDK
            value: path
          envFrom:
          - secretRef:
              name: keda-oidc-secret
          image: xxxxxxxxxxxxxxx:xxxxxxx/azdevops-agent:latest
          imagePullPolicy: IfNotPresent
          name: azdevops-agent-job
          resources:
            limits:
              cpu: 3
              ephemeral-storage: 45G
              memory: 11Gi
            requests:
              cpu: 3
              ephemeral-storage: 45G
              memory: 11Gi
          securityContext:
            allowPrivilegeEscalation: false
            runAsNonRoot: true
        restartPolicy: Never
        serviceAccountName: oidc-sa
    ttlSecondsAfterFinished: 3600
  maxReplicaCount: 10
  minReplicaCount: 0
  pollingInterval: 60
  rollout:
    strategy: gradual
  scalingStrategy:
    strategy: default
  successfulJobsHistoryLimit: 5
  triggers:
  - authenticationRef:
      name: workload-identity-auth
    metadata:
      demands: azure-beta
      fetchUnfinishedJobsOnly: "true"
      poolName: POOL_NAME_HERE
      requireAllDemands: "true"
      targetPipelinesQueueLength: "1"
    type: azure-pipelines
  - authenticationRef:
      name: workload-identity-auth
    metadata:
      demands: azure-beta,java
      fetchUnfinishedJobsOnly: "true"
      poolName: POOL_NAME_HERE
      requireAllDemands: "true"
      targetPipelinesQueueLength: "1"
    type: azure-pipelines
  - authenticationRef:
      name: workload-identity-auth
    metadata:
      demands: azure-beta,npm
      fetchUnfinishedJobsOnly: "true"
      poolName: POOL_NAME_HERE
      requireAllDemands: "true"
      targetPipelinesQueueLength: "1"
    type: azure-pipelines
  - authenticationRef:
      name: workload-identity-auth
    metadata:
      demands: azure-beta,maven
      fetchUnfinishedJobsOnly: "true"
      poolName: POOL_NAME_HERE
      requireAllDemands: "true"
      targetPipelinesQueueLength: "1"
    type: azure-pipelines
  - authenticationRef:
      name: workload-identity-auth
    metadata:
      demands: azure-beta,sh
      fetchUnfinishedJobsOnly: "true"
      poolName: POOL_NAME_HERE
      requireAllDemands: "true"
      targetPipelinesQueueLength: "1"
    type: azure-pipelines
  - authenticationRef:
      name: workload-identity-auth
    metadata:
      demands: azure-beta,JDK
      fetchUnfinishedJobsOnly: "true"
      poolName: POOL_NAME_HERE
      requireAllDemands: "true"
      targetPipelinesQueueLength: "1"
    type: azure-pipelines

Expected Behavior

Jobs must be polled in defined period and agent must be requested from kubernetes as soon as polling api response is recieved.

Actual Behavior

Job is queued and keeps on waiting on random periods, sometime observed that after finishing previous jobs new agent is requested.

Note:

  1. Azure parallel pipeline count is within limits.
  2. No depdendency between jobs

Steps to Reproduce the Problem

  1. Create Scaler and run pipeline in azure devops (run it in scale)

Logs from KEDA operator

No response

KEDA Version

2.19.0

Kubernetes Version

1.34

Platform

Amazon Web Services

Scaler Details

No response

Would you be open to contributing a fix?

None

Anything else?

No response