Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>AI PR Reviewer AT
AI PR Reviewer AT

AI PR Reviewer AT

Aniket Tiwari

|
1 install
| (0) | Free
Automatically review pull requests using Azure OpenAI for intelligent code analysis and suggestions
Get it free

🤖 AI PR Reviewer - Azure DevOps Extension

An intelligent Azure DevOps extension that automatically reviews pull requests using Azure OpenAI, providing comprehensive code analysis, security insights, and improvement suggestions.

AI PR Reviewer Banner

✨ Features

  • 🔍 Automated Code Review: AI-powered analysis of pull request changes
  • 🔒 Security Scanning: Identifies potential security vulnerabilities
  • ⚡ Performance Analysis: Suggests performance improvements and optimizations
  • 🎨 Code Style Guidance: Ensures consistent coding standards
  • 🧠 Logic Review: Detects logical errors and suggests improvements
  • 📊 Comprehensive Reporting: Detailed feedback with actionable insights
  • 🔄 Real-time Processing: Instant reviews on PR creation and updates
  • ⚙️ Configurable Settings: Customizable review depth and focus areas

🏗️ Architecture

graph TD
    A[Azure DevOps PR] --> B[Service Hook]
    B --> C[Azure Functions]
    C --> D[Azure OpenAI]
    C --> E[Azure DevOps API]
    D --> F[AI Analysis]
    F --> G[Review Comments]
    G --> E
    E --> A

🚀 Quick Start

Prerequisites

  • Azure subscription
  • Azure DevOps organization
  • Azure CLI installed
  • Node.js 18+ installed

1. Clone and Setup

git clone <your-repo-url>
cd ai-pr-reviewer
npm install

2. Deploy Backend Infrastructure

# Login to Azure
az login

# Initialize Azure Developer CLI
azd init

# Deploy infrastructure and application
azd up

3. Configure Azure DevOps

  1. Install Extension: Upload the .vsix package to your Azure DevOps organization
  2. Configure Service Hook:
    • Go to Project Settings → Service hooks
    • Create new "Web Hooks" service hook
    • Select PR events: "Pull request created" and "Pull request updated"
    • Set URL to your Azure Function endpoint
  3. Set Environment Variables in your Function App:
    • AZURE_DEVOPS_ORG_URL: Your Azure DevOps organization URL
    • AZURE_DEVOPS_PAT: Personal Access Token with Code (read & write) permissions

4. Start Using

Create a pull request in any repository where the extension is enabled, and watch the AI provide intelligent code reviews automatically!

📖 Detailed Setup Guide

Backend Deployment

The backend consists of Azure Functions that handle webhook events and integrate with Azure OpenAI:

# Navigate to backend directory
cd backend

# Install dependencies
npm install

# Build the project
npm run build

# Deploy with Azure Developer CLI
azd up

Extension Development

To work on the extension locally:

# Install dependencies
npm install

# Build the extension
npm run build

# Package the extension
tfx extension create --manifest-globs vss-extension.json

Configuration Options

The extension provides several configuration options:

  • Review Trigger: All PRs, Draft PRs only, or Ready PRs only
  • AI Model: Choose between GPT-4, GPT-4 Turbo, or GPT-3.5 Turbo
  • Review Depth: Quick, Standard, or Thorough analysis
  • Focus Areas: Security issues, Performance optimizations
  • Custom Prompts: Tailor AI responses to your team's needs

🔧 Development

Project Structure

ai-pr-reviewer/
├── src/                    # Extension source code
│   ├── extension.ts        # Main extension entry point
│   └── hub/               # Configuration hub
│       ├── hub.html       # Hub interface
│       ├── hub.css        # Hub styles
│       └── hub.ts         # Hub logic
├── backend/               # Azure Functions backend
│   ├── src/
│   │   └── index.ts       # Function app code
│   ├── package.json
│   └── host.json
├── infra/                 # Infrastructure as Code
│   ├── main.bicep         # Main Bicep template
│   └── main.parameters.json
├── vss-extension.json     # Extension manifest
├── azure.yaml            # Azure Developer CLI config
└── package.json

Building and Testing

# Build the extension
npm run build

# Run tests
npm test

# Lint code
npm run lint

# Watch for changes
npm run watch

Local Development

  1. Backend Development:

    cd backend
    npm run watch
    func start
    
  2. Extension Development:

    npm run watch
    # Use F5 in VS Code to test the extension
    

📋 Configuration

Environment Variables

Set these in your Azure Function App:

Variable Description Required
AZURE_OPENAI_ENDPOINT Azure OpenAI service endpoint ✅
AZURE_DEVOPS_ORG_URL Azure DevOps organization URL ✅
AZURE_DEVOPS_PAT Personal Access Token ✅
AZURE_CLIENT_ID Managed Identity Client ID ✅

Personal Access Token Permissions

Your PAT needs these permissions:

  • Code (read & write): To read PR content and post comments
  • Project and team (read): To access project information

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and add tests
  4. Run tests: npm test
  5. Commit your changes: git commit -am 'Add new feature'
  6. Push to the branch: git push origin feature-name
  7. Submit a pull request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Links

  • Azure DevOps Extension Documentation
  • Azure OpenAI Service
  • Azure Functions Documentation

🆘 Support

For support and questions:

  • 📧 Create an issue in this repository
  • 💬 Discussion forums
  • 📖 Check the documentation

Made with ❤️ for better code reviews

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft