Azure DevOps Integration
Integrate Toggly with Azure DevOps Build and Release pipelines to automate feature flag management, release tracking, and deployment workflows.
Overviewâ
The Toggly Azure DevOps extension provides custom pipeline tasks that enable you to:
- đ Create and manage releases with feature flag changes
- đ Associate builds with releases for complete traceability
- đī¸ Create and update feature flags from pipelines
- đ Configure feature flags per environment
- â Activate releases with automated quality gates
- âŠī¸ Automatically roll back features on deployment failures
- đ Display rich release information in build summaries
Installationâ
From Azure DevOps Marketplaceâ
- Visit the Azure DevOps Marketplace
- Search for "Toggly Feature Flags"
- Click Get it free
- Select your Azure DevOps organization
- Click Install
The extension will be available in all projects within your organization.
Configurationâ
Step 1: Get OAuth2 Credentialsâ
- Log in to Toggly
- Navigate to Team Settings â API Credentials
- Click Create New Credential
- Set the following:
- Name: "Azure DevOps Integration"
- Scopes: Select
apiAccess
- Click Create
- Copy the Client ID and Client Secret (you won't see the secret again!)
Step 2: Create Service Connectionâ
- In Azure DevOps, go to your project
- Navigate to Project Settings â Service connections
- Click New service connection
- Search for and select Toggly Feature Flags
- Fill in the connection details:
- Service connection name:
Toggly-Production(or your preferred name) - Client ID: Paste your OAuth2 Client ID
- Client Secret: Paste your OAuth2 Client Secret
- Authority URL:
https://auth.toggly.io(default) - API URL:
https://app.toggly.io/api(default)
- Service connection name:
- Click Verify connection to test
- Click Save
Create separate service connections for different environments (e.g., Toggly-Staging, Toggly-Production)
Available Tasksâ
1. Toggly - Create Releaseâ
Creates a new Toggly release to track feature flag changes and deployments.
- task: TogglyCreateRelease@1
inputs:
connectedService: 'Toggly-Production'
applicationId: 'your-app-id'
name: 'Release $(Build.BuildNumber)'
releaseNotes: |
## Release $(Build.BuildNumber)
Changes deployed in this release.
Inputs:
connectedService(required): Service connection nameapplicationId(required): Your Toggly application IDname(required): Release name (supports Azure DevOps variables)releaseNotes(optional): Markdown-formatted notesfeatureChanges(optional): JSON array of feature changes
Outputs:
Toggly.ReleaseId: The created release IDToggly.ReleaseUrl: URL to view the release in Toggly
2. Toggly - Associate Buildâ
Associates the current Azure DevOps build with a Toggly release, providing complete traceability.
- task: TogglyAssociateBuild@1
inputs:
connectedService: 'Toggly-Production'
projectKey: 'your-app-id'
environment: 'Production'
mode: 'use-latest-draft-or-create'
Inputs:
connectedService(required): Service connection nameprojectKey(required): Application ID or project nameenvironment(required): Target environment (Production, Staging, etc.)mode(required): How to find/create releaseuse-latest-draft-or-create: Use latest draft release or create newcreate-new: Always create a new releaseuse-latest-draft: Use latest draft only (fail if none exists)
releaseTemplateKey(optional): Template for creating releasesnamePattern(optional): Pattern for release name (e.g.,Release ${branch} - ${buildNumber})
Outputs:
Toggly.ReleaseId: The associated release IDToggly.ReleaseUrl: URL to view the release
3. Toggly - Create Featureâ
Creates a new feature flag in Toggly.
- task: TogglyCreateFeature@1
inputs:
connectedService: 'Toggly-Production'
applicationId: 'your-app-id'
featureName: 'New Dashboard'
featureKey: 'new-dashboard'
description: 'Redesigned user dashboard'
tags: 'ui, dashboard, v2'
Inputs:
connectedService(required): Service connection nameapplicationId(required): Application IDfeatureName(required): Display name for the featurefeatureKey(required): Unique identifier (used in code)description(optional): Markdown descriptioncategory(optional): Feature categorytags(optional): Comma-separated tags
Outputs:
Toggly.FeatureKey: The created feature key
4. Toggly - Update Featureâ
Updates metadata for an existing feature flag.
- task: TogglyUpdateFeature@1
inputs:
connectedService: 'Toggly-Production'
applicationId: 'your-app-id'
featureKey: 'new-dashboard'
description: 'Updated: Dashboard with real-time updates'
Inputs:
connectedService(required): Service connection nameapplicationId(required): Application IDfeatureKey(required): Feature to updatefeatureName(optional): New display namedescription(optional): New descriptioncategory(optional): New categorytags(optional): New comma-separated tags
5. Toggly - Update Feature Environmentâ
Enable, disable, or configure a feature flag on a specific environment.
# Enable a feature
- task: TogglyUpdateFeatureEnv@1
inputs:
connectedService: 'Toggly-Production'
applicationId: 'your-app-id'
environment: 'Production'
featureKey: 'new-dashboard'
action: 'enable'
# Gradual rollout (20%)
- task: TogglyUpdateFeatureEnv@1
inputs:
connectedService: 'Toggly-Production'
applicationId: 'your-app-id'
environment: 'Production'
featureKey: 'new-checkout'
action: 'custom'
filters: |
[{
"name": "PercentageFilter",
"parameters": { "Value": 20 }
}]
Inputs:
connectedService(required): Service connection nameapplicationId(required): Application IDenvironment(required): Target environmentfeatureKey(required): Feature to configureaction(required):enable,disable, orcustomfilters(optional): JSON array of filters (required when action iscustom)
6. Toggly - Activate Releaseâ
Activates a release, applying all feature flag changes. Can wait for quality gates.
- task: TogglyActivateRelease@1
inputs:
connectedService: 'Toggly-Production'
releaseId: '$(Toggly.ReleaseId)'
waitForGates: true
gateTimeout: 600
Inputs:
connectedService(required): Service connection namereleaseId(optional): Release ID (defaults to$(Toggly.ReleaseId))waitForGates(optional): Wait for gates to pass (default: false)gateTimeout(optional): Max wait time in seconds (default: 300)gatePollInterval(optional): Poll interval in seconds (default: 10)
7. Toggly - Rollback Releaseâ
Rolls back a release, restoring feature flags to their previous state.
- task: TogglyRollbackRelease@1
condition: failed() # Only run on failure
inputs:
connectedService: 'Toggly-Production'
releaseId: '$(Toggly.ReleaseId)'
reason: 'Deployment failed - automatic rollback'
Inputs:
connectedService(required): Service connection namereleaseId(optional): Release ID (defaults to$(Toggly.ReleaseId))reason(optional): Reason for rollback (for audit trail)
Common Scenariosâ
Scenario 1: Basic Deployment with Release Trackingâ
Track deployments and feature changes:
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
variables:
TogglyConnection: 'Toggly-Production'
AppId: 'app-12345'
stages:
- stage: Build
jobs:
- job: Build
steps:
# Create release
- task: TogglyCreateRelease@1
inputs:
connectedService: '$(TogglyConnection)'
applicationId: '$(AppId)'
name: 'Release $(Build.BuildNumber)'
releaseNotes: |
## Release $(Build.BuildNumber)
Branch: $(Build.SourceBranchName)
Commit: $(Build.SourceVersion)
# Associate build
- task: TogglyAssociateBuild@1
inputs:
connectedService: '$(TogglyConnection)'
projectKey: '$(AppId)'
environment: 'Production'
# Your build steps
- script: |
npm install
npm run build
npm test
- stage: Deploy
dependsOn: Build
jobs:
- deployment: DeployProd
environment: Production
strategy:
runOnce:
deploy:
steps:
# Deploy your application
- script: |
kubectl apply -f deployment.yaml
# Activate release
- task: TogglyActivateRelease@1
inputs:
connectedService: '$(TogglyConnection)'
Scenario 2: Deployment with Quality Gates and Rollbackâ
Use gates to validate deployment quality and automatically rollback on failure:
- stage: Deploy
jobs:
- deployment: DeployProduction
environment: Production
strategy:
runOnce:
deploy:
steps:
# Deploy application
- script: |
echo "Deploying to production..."
kubectl apply -f k8s/deployment.yaml
kubectl wait --for=condition=ready pod -l app=myapp --timeout=300s
# Activate with gates
- task: TogglyActivateRelease@1
inputs:
connectedService: 'Toggly-Production'
releaseId: '$(Toggly.ReleaseId)'
waitForGates: true
gateTimeout: 600 # 10 minutes
gatePollInterval: 15
# Post-deployment validation
- script: |
echo "Running smoke tests..."
npm run smoke-tests
on:
failure:
steps:
# Automatic rollback on any failure
- task: TogglyRollbackRelease@1
inputs:
connectedService: 'Toggly-Production'
releaseId: '$(Toggly.ReleaseId)'
reason: 'Deployment or validation failed - automatic rollback'
Scenario 3: Progressive Feature Rolloutâ
Gradually roll out a feature to users:
- stage: ProgressiveRollout
jobs:
- job: Phase1
displayName: 'Rollout to 10%'
steps:
- task: TogglyUpdateFeatureEnv@1
inputs:
connectedService: 'Toggly-Production'
applicationId: 'app-12345'
environment: 'Production'
featureKey: 'new-checkout-flow'
action: 'custom'
filters: |
[{
"name": "PercentageFilter",
"parameters": { "Value": 10 }
}]
# Monitor for 30 minutes
- script: sleep 1800
- job: Phase2
displayName: 'Rollout to 50%'
dependsOn: Phase1
steps:
- task: TogglyUpdateFeatureEnv@1
inputs:
connectedService: 'Toggly-Production'
applicationId: 'app-12345'
environment: 'Production'
featureKey: 'new-checkout-flow'
action: 'custom'
filters: |
[{
"name": "PercentageFilter",
"parameters": { "Value": 50 }
}]
# Monitor for 30 minutes
- script: sleep 1800
- job: Phase3
displayName: 'Full Rollout'
dependsOn: Phase2
steps:
- task: TogglyUpdateFeatureEnv@1
inputs:
connectedService: 'Toggly-Production'
applicationId: 'app-12345'
environment: 'Production'
featureKey: 'new-checkout-flow'
action: 'enable'
Scenario 4: Multi-Environment Deploymentâ
Deploy to multiple environments with different configurations:
stages:
- stage: DeployStaging
jobs:
- deployment: Staging
environment: Staging
strategy:
runOnce:
deploy:
steps:
- task: TogglyAssociateBuild@1
inputs:
connectedService: 'Toggly-Staging'
projectKey: 'app-12345'
environment: 'Staging'
# Enable all features in staging
- task: TogglyUpdateFeatureEnv@1
inputs:
connectedService: 'Toggly-Staging'
applicationId: 'app-12345'
environment: 'Staging'
featureKey: 'experimental-feature'
action: 'enable'
- task: TogglyActivateRelease@1
inputs:
connectedService: 'Toggly-Staging'
- stage: DeployProduction
dependsOn: DeployStaging
jobs:
- deployment: Production
environment: Production
strategy:
runOnce:
deploy:
steps:
- task: TogglyAssociateBuild@1
inputs:
connectedService: 'Toggly-Production'
projectKey: 'app-12345'
environment: 'Production'
# Keep experimental features disabled in production
- task: TogglyUpdateFeatureEnv@1
inputs:
connectedService: 'Toggly-Production'
applicationId: 'app-12345'
environment: 'Production'
featureKey: 'experimental-feature'
action: 'disable'
- task: TogglyActivateRelease@1
inputs:
connectedService: 'Toggly-Production'
waitForGates: true
Build Summaryâ
The extension automatically adds rich release information to your Azure DevOps build summary:
- đ Release name and status
- đ¯ Feature flag changes
- â Gate status and evaluation results
- đ CI/CD build links
- đ Direct link to view release in Toggly
This provides complete visibility of feature flag changes directly in your pipeline results.
Pipeline Variablesâ
The extension sets these variables that can be used in subsequent tasks:
| Variable | Description | Set By Tasks |
|---|---|---|
Toggly.ReleaseId | The release ID | Create Release, Associate Build |
Toggly.ReleaseUrl | URL to view release in Toggly | Create Release, Associate Build |
Toggly.FeatureKey | The feature key | Create Feature |
Use these variables in subsequent tasks:
- task: TogglyCreateRelease@1
inputs:
# ... inputs ...
# Use the release ID in a later task
- task: TogglyActivateRelease@1
inputs:
connectedService: 'Toggly-Production'
releaseId: '$(Toggly.ReleaseId)' # Uses variable from previous task
Best Practicesâ
1. Use Service Connections per Environmentâ
Create separate service connections for each environment:
Toggly-DevelopmentToggly-StagingToggly-Production
This provides better security and isolation.
2. Always Use Rollback Tasksâ
Add rollback tasks to your deployment jobs:
strategy:
runOnce:
deploy:
steps:
# ... deployment steps ...
on:
failure:
steps:
- task: TogglyRollbackRelease@1
inputs:
connectedService: 'Toggly-Production'
3. Use Gates for Productionâ
Enable gates for production deployments:
- task: TogglyActivateRelease@1
inputs:
connectedService: 'Toggly-Production'
waitForGates: true
gateTimeout: 600
4. Track All Deploymentsâ
Always associate builds with releases:
- task: TogglyAssociateBuild@1
inputs:
connectedService: 'Toggly-Production'
projectKey: 'your-app'
environment: 'Production'
5. Use Release Notesâ
Include meaningful release notes:
- task: TogglyCreateRelease@1
inputs:
connectedService: 'Toggly-Production'
applicationId: 'your-app'
name: 'Release $(Build.BuildNumber)'
releaseNotes: |
## Release $(Build.BuildNumber)
### Changes
$(Build.SourceVersionMessage)
### Build
- Branch: $(Build.SourceBranchName)
- Commit: $(Build.SourceVersion)
- Build: $(Build.BuildNumber)
Troubleshootingâ
Authentication Errorsâ
Problem: "Service connection not found" or "Authentication failed"
Solutions:
- Verify the service connection name matches exactly
- Check OAuth2 credentials are valid and haven't expired
- Ensure the API token has
apiAccessscope - Test the service connection in Azure DevOps settings
Application Not Foundâ
Problem: "Application not found" or "Access denied"
Solutions:
- Verify the Application ID is correct
- Check your API credentials have access to the application
- Ensure you're a member of the team that owns the application
Gate Timeoutâ
Problem: Gates timeout before passing
Solutions:
- Increase the
gateTimeoutvalue - Check gate configurations in Toggly UI
- Review gate evaluation logs in Toggly
- Verify metrics are being collected properly
Variable Not Setâ
Problem: $(Toggly.ReleaseId) is empty
Solutions:
- Ensure a previous task (Create Release or Associate Build) ran successfully
- Check task execution order in your pipeline
- Verify the tasks are in the same job (variables don't persist across jobs)
Further Readingâ
Supportâ
Need help with the Azure DevOps integration?
- đ Documentation
- đŦ Community Forum
- đ§ Email Support
- đ Report Issues