Azure OpenAI Code Reviewer for Azure DevOps
The Azure OpenAI Code Reviewer is an intelligent extension that brings AI-powered code review to your Azure DevOps Pull Requests. Using OpenAI's GPT models or Azure OpenAI, it provides GitHub Copilot-style code review feedback directly within your development workflow.
🎯 What It Does
This extension automatically reviews code changes in Pull Requests and provides intelligent feedback on:
- Code Quality - Identifies potential bugs, code smells, and improvement opportunities
- Best Practices - Suggests better coding patterns and standards
- Security Issues - Flags potential security vulnerabilities
- Performance - Recommends optimizations where applicable
✨ Key Features
🔄 Incremental Review System
- Smart Tracking - Only reviews files that have changed since the last review
- Cost Efficient - Significantly reduces OpenAI API usage for large PRs
- Clean Comments - Automatically removes outdated reviews when files change
- Preserves Context - Keeps relevant existing comments while updating others
🤖 AI-Powered Intelligence
- Multiple Models - Support for GPT-4, GPT-3.5-turbo, and GPT-3.5-turbo-16k
- Context Aware - Reviews changes in context using git diffs
- Accurate Analysis - Focuses only on added, modified, or deleted lines
- Intelligent Filtering - Automatically excludes binary files and irrelevant changes
🌐 Enterprise Ready
- Cross-Platform - Works on Linux, Windows, and macOS build agents
- Azure OpenAI - Full support for Azure OpenAI service
- Self-Signed Certificates - Enterprise certificate support
- Secure Integration - Uses Azure DevOps security tokens
🚀 How It Works
- Trigger - Runs automatically when a Pull Request is created or updated
- Analysis - Compares changes against the target branch using git diff
- Review - Sends code changes to GPT model for intelligent analysis
- Feedback - Posts review comments directly to the Pull Request
- Tracking - Maintains metadata to enable incremental reviews
📋 Setup Requirements
Build Service Permissions
Grant your build service permission to contribute to Pull Requests:

System Token Access
For YAML Pipelines:
steps:
- checkout: self
persistCredentials: true
For Classic Pipelines:
Enable "Allow scripts to access the OAuth token" in Agent job properties:

⚙️ Configuration Options
OpenAI Integration
- API Key - Your OpenAI API key (stored as secret variable)
- Model Selection - Choose from available GPT models
- Custom Instructions - Tailored prompts for code review
Azure OpenAI Integration
- Endpoint URL - Your Azure OpenAI deployment endpoint
- API Key - Azure OpenAI resource key
- Model Deployment - Your specific model deployment name
Example Azure OpenAI endpoint format:
https://{resource-name}.openai.azure.com/openai/deployments/{model-name}/chat/completions?api-version=2024-02-15-preview
🎛️ Task Configuration
- task: AOAICodeReview@3
displayName: 'AI Code Review'
inputs:
api_key: $(OPENAI_API_KEY) # Required: API key
model: 'gpt-4' # Optional: Model choice
aoi_endpoint: $(AZURE_OPENAI_ENDPOINT) # Optional: Azure OpenAI endpoint
enable_incremental_review: true # Optional: Enable smart incremental mode
support_self_signed_certificate: false # Optional: Enterprise certificate support
condition: eq(variables['Build.Reason'], 'PullRequest')
💡 Best Practices
Cost Optimization
- Use Incremental Mode - Reduces API calls by up to 80% on subsequent reviews
- Choose Right Model - Use gpt-3.5-turbo for cost efficiency, gpt-4 for quality
- Filter File Types - Extension automatically excludes binary and irrelevant files
Team Adoption
- Start Small - Begin with smaller repositories to test and tune
- Review Settings - Adjust model and prompts based on your code standards
- Monitor Usage - Track API costs and adjust frequency as needed
🔧 Installation
- Install Extension - Get it from the Azure DevOps Marketplace
- Configure API Keys - Set up OpenAI or Azure OpenAI credentials
- Add to Pipeline - Include the task in your build definition
- Test with PR - Create a Pull Request to see it in action
🌟 Benefits
- Faster Reviews - Instant feedback on code changes
- Consistent Quality - AI applies consistent review standards
- Learning Tool - Helps developers learn best practices
- Time Savings - Reduces manual review time for maintainers
- Early Detection - Catches issues before they reach production
Ready to enhance your code review process with AI? Install the extension and start getting intelligent feedback on your Pull Requests today!