Complete Azure DevOps Tutorial with Usage Examples
1. What is Azure DevOps?
Azure DevOps is a suite of integrated services from Microsoft that provides an end-to-end solution for the software development lifecycle. It supports teams in planning, coding, building, testing, deploying, and monitoring applications, embracing core DevOps principles like collaboration, automation, and continuous delivery.
Azure DevOps offers a centralized platform that unifies various tools and functionalities needed for modern software delivery, regardless of the programming language, platform, or cloud provider you use.
Key Benefits:
- Comprehensive Suite: All essential DevOps tools under one roof.
- Scalability: Scales from small teams to large enterprises.
- Cloud-Native: Fully managed service in Azure.
- Language & Platform Agnostic: Supports Windows, Linux, macOS, and various programming languages (.NET, Java, Python, Node.js, etc.).
- Extensibility: Integrates with a vast marketplace of extensions and other services.
- Collaboration: Fosters teamwork and communication across development, operations, and QA.
2. Azure DevOps Services
Azure DevOps is comprised of several distinct, yet integrated, services:
- Azure Boards: Agile planning, tracking work items, backlogs, sprints, and dashboards.
- Azure Repos: Unlimited, cloud-hosted private Git repositories for source code management.
- Azure Pipelines: Cloud-hosted pipelines for continuous integration (CI) and continuous delivery (CD) across any platform.
- Azure Test Plans: Manual, exploratory, and automated test management.
- Azure Artifacts: Package management (NuGet, npm, Maven, Python, Universal Packages) for sharing and consuming packages.
3. Getting Started with Azure DevOps
A. Create an Azure DevOps Organization:
- Go to dev.azure.com.
- Sign in with your Microsoft account (personal or work/school).
- Click **Create new organization**.
- Provide a **name** for your organization (e.g., `my-devops-org-2025`).
- Choose a **hosting geography** (e.g., `South India`).
- Click **Continue**.
**Organization URL:** Your organization will be accessible at `https://dev.azure.com/your-devops-org-2025`.
B. Create an Azure DevOps Project:
Within an organization, you create projects to manage your work.
- After creating your organization, you'll be prompted to "Create a project to get started." Click **+ New project**. (Alternatively, from your organization's home page, click **+ New project** in the top right).
- Project name: Enter a unique name (e.g., `MyWebAppProject`).
- Description: (Optional) `Project for my web application development`.
- Visibility: Choose `Public` (anyone on the internet can view) or `Private` (only users you grant access to). For most tutorials, `Private` is fine.
- Advanced (Version control): `Git` (recommended) or `Team Foundation Version Control (TFVC)`.
- Advanced (Work item process): `Agile` (recommended), `Scrum`, `Basic`, or `CMMI`. This defines your Boards workflow.
- Click **Create**.
You'll be redirected to your new project's welcome page.
4. Azure Boards (Plan & Track)
Azure Boards provides a rich set of agile tools to plan, track, and discuss work across your team. It integrates directly with your code repositories and pipelines.
A. Navigate to Boards:
Azure DevOps Project > Boards (left navigation menu)
B. Key Features & Usage:
- Work Items: Fundamental units of work. Types depend on your process (e.g., Agile: Epic, Feature, User Story, Bug, Task).
- Click **Boards** > **Work Items**.
- Click **+ New Work Item** > Select a type (e.g., `User Story`).
- Provide a **Title** (e.g., `As a user, I want to log in to the application`).
- Add **Description**, **Acceptance Criteria**, **Assigned To**, **Area**, **Iteration (Sprint)**.
- Click **Save & Close**.
- Backlogs: Prioritized lists of work items.
- Click **Boards** > **Backlogs**.
- You'll see your backlog items. Drag and drop to reorder their priority.
- You can filter by `Epics`, `Features`, `User Stories`, etc.
- Sprints: Plan and track work for specific timeboxes (iterations).
- Click **Boards** > **Sprints**.
- Click **Set dates** to define start/end dates for your current sprint.
- Drag items from your backlog into the sprint.
- Use the "Taskboard" view to see tasks, update their status (New, Approved, Committed, Done), and view burndown charts.
- Queries: Create custom queries to find work items.
- Click **Boards** > **Queries**.
- Click **+ New query**. Define criteria (e.g., `Work Item Type = 'Bug'` and `State = 'Active'`).
- Click **Run query**. Save it for reuse.
- Dashboards: Create custom dashboards with widgets to visualize progress.
- Click **Dashboards**.
- Click **+ New Dashboard**.
- Add widgets (e.g., Work Item Chart, Burndown, Velocity).
**Integration with GitHub:** Azure Boards can link directly to GitHub commits, pull requests, and issues, providing end-to-end traceability for your work items.
5. Azure Repos (Version Control)
Azure Repos provides unlimited, free, private Git repositories. It's fully compatible with standard Git clients.
A. Navigate to Repos:
Azure DevOps Project > Repos (left navigation menu)
B. Clone/Initialize a Repository:
- Create a new repository:
- In the "Repos" section, from the repository dropdown, select **New repository**.
- Enter a **Repository name** (e.g., `my-web-app-git`).
- Choose **Git** as the type.
- (Optional) Initialize with a README, add a `.gitignore`.
- Click **Create**.
- Clone to your local machine:
C. Manage Branches & Pull Requests:
- Branches:
- In **Repos** > **Branches**, you can see all branches.
- Apply **Branch policies** (e.g., require PRs, require code reviews, CI builds to pass) for main branches to protect code quality.
- Pull Requests:
- After pushing a new branch (e.g., `feature/login`), go to **Repos** > **Pull requests**.
- Click **+ New pull request**.
- Select source and target branches, provide a title and description, and add reviewers.
- Click **Create**.
6. Azure Pipelines (CI/CD)
Azure Pipelines enables continuous integration (CI) and continuous delivery (CD) for any language, platform, and cloud. You can define pipelines using YAML or the Classic editor.
A. Navigate to Pipelines:
Azure DevOps Project > Pipelines (left navigation menu)
B. Create a New Pipeline (YAML - Recommended):
This example sets up a simple CI pipeline for a Node.js application.
- Click **Pipelines** > **+ New pipeline**.
- Where is your code?: Select your source control (e.g., `Azure Repos Git`).
- Select your repository (e.g., `my-web-app-git`).
- Configure: Choose a template (e.g., `Node.js`).
- An `azure-pipelines.yml` file will be generated in an inline editor. This is your pipeline definition.
- Example `azure-pipelines.yml` for Node.js CI:
# azure-pipelines.yml
# Trigger the pipeline on changes to the 'main' branch
trigger:
- main
# Define the environment where the pipeline will run
pool:
vmImage: 'ubuntu-latest' # Use a Microsoft-hosted agent (e.g., Ubuntu, Windows, macOS)
# Variables (optional, for reusable values or secrets)
variables:
npm_config_cache: $(Pipeline.Workspace)/.npm # Cache npm packages
# Steps define the tasks that the pipeline will execute
steps:
- task: NodeTool@0 # Install Node.js
displayName: 'Install Node.js'
inputs:
versionSpec: '18.x' # Specify Node.js version
- script: | # Run npm install
npm install
displayName: 'Install Dependencies'
- script: | # Run tests
npm test
displayName: 'Run Unit Tests'
# Set --coverage or --ci for detailed test results reporting
- script: | # Build the application (e.g., for production deployment later)
npm run build
displayName: 'Build Application'
- task: PublishBuildArtifacts@1 # Publish build artifacts for subsequent stages/releases
displayName: 'Publish Build Artifacts'
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)' # Default path where artifacts are placed
artifactName: 'drop' # Name of the artifact (e.g., 'drop' or 'dist')
- Click **Save and run**. Add a commit message and click **Save and run** again.
C. Monitor Pipeline Runs:
- After running, you'll see the pipeline execution. Click on a specific run to view its details.
- Click on individual **Jobs** and **Tasks** to view their console output logs for debugging.
- The "Summary" tab shows overall status, linked commits, and published artifacts.
D. Create a New Release Pipeline (Classic Editor - for CD/Deployment):
While YAML is preferred for builds, release pipelines are often managed with the Classic editor for stage-based deployments.
- Click **Pipelines** > **Releases** > **+ New pipeline**.
- Select an empty template or a predefined one.
- Artifacts:
- Click **+ Add an artifact**.
- **Source type:** `Build`.
- **Project:** Select your current project.
- **Source (build pipeline):** Select the CI pipeline you created earlier.
- Click **Add**.
- Stages:
- Click **+ Add a stage** > **Empty job**.
- Rename the stage (e.g., `Deploy to Staging`).
- Click **1 job, 0 task** link within the stage.
- Add tasks (e.g., `Azure App Service Deploy`, `SSH`, `Azure CLI`). Configure them to deploy your artifact to the staging environment.
- Add a new stage for "Deploy to Production", and add a "Pre-deployment approval" for manual gates.
- Click **Save** and then **Create release** to manually trigger a release.
7. Azure Test Plans (Testing)
Azure Test Plans provides comprehensive manual, exploratory, and automated test management capabilities.
A. Navigate to Test Plans:
Azure DevOps Project > Test Plans (left navigation menu)
B. Create a Test Plan:
- Click **Test Plans** > **+ New Test Plan**.
- Provide a **Name** (e.g., `Sprint X - Feature A Testing`).
- Set **Area path** and **Iteration** (sprint). Click **Create**.
C. Add Test Suites and Test Cases:
- In your Test Plan, click **+ New Suite** to organize tests (e.g., `User Login Test Suite`).
- Within a test suite, click **+ New Test Case**.
- Provide a **Title** (e.g., `Verify user can log in with valid credentials`).
- Add **Test Steps** (e.g., `1. Navigate to login page. 2. Enter username. 3. Enter password. 4. Click login button`).
- Provide **Expected Result** for each step.
- Link to a **Work Item** (e.g., a User Story).
- Click **Save & Close**.
D. Run Manual Tests:
- Select your test case(s) in the Test Plan.
- Click **Run** > **Run for web application**. This opens the Azure Test Runner.
- Manually execute steps, mark them as **Pass/Fail**, add **Comments**, and capture **Screenshots**.
- If a step fails, you can **Create bug** directly from the Test Runner. The bug will be pre-populated with steps to reproduce and screenshots.
- Click **Save and close** when done testing.
E. Automated Test Results:
For automated tests run in Azure Pipelines, ensure your build task publishes test results in a supported format (e.g., JUnit, VSTest). These results will automatically appear under **Pipelines > Test Plans > Runs**. You can link automated tests to work items as well.
# Example: Publish JUnit test results in Azure Pipelines
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/test-results.xml' # Path to your test results file
# Merge test results with work items based on test case ID or title
8. Azure Artifacts (Package Management)
Azure Artifacts allows developers to publish and consume various types of packages (NuGet, npm, Maven, Python, Universal Packages) from feeds. It provides secure, private feeds and can act as a proxy for public registries.
A. Navigate to Artifacts:
Azure DevOps Project > Artifacts (left navigation menu)
B. Create a Feed:
- Click **+ Create Feed**.
- Name: (e.g., `my-private-feed`).
- Visibility: `Organization` or `Project`.
- Upstream sources: Enable if you want to proxy public registries (e.g., `npmjs.com`, `nuget.org`).
- Click **Create**.
C. Publish/Consume Packages:
- Connect to feed: Click **Connect to feed** on your feed's page. Select your package type (e.g., `npm`, `NuGet`). Instructions will be provided to configure your local client (e.g., `.npmrc` file, NuGet sources).
- Publishing (e.g., npm package from Azure Pipelines):
# Example Azure Pipelines task to publish an npm package
- task: Npm@1
displayName: 'Publish npm package'
inputs:
command: 'publish'
publishRegistry: 'AzureArtifacts' # Use Azure Artifacts feed
# Add other inputs like `package_json_path` if needed
- Consuming (e.g., npm package): After configuring your local npm client to use your Azure Artifacts feed, you can use `npm install ` to install packages from your private feed.
9. Automation Rules (Work Items)
Azure Boards allows you to define automation rules for work item state transitions. This helps enforce workflow and reduce manual updates.
A. Navigate to Team Settings:
Azure DevOps Project > Boards > Backlogs > Configure team settings (gear icon)
B. Set Automation Rules:
- Go to the **Automation rules** tab (or **Process** > **Backlogs** in older versions).
- You'll see options to automate state transitions for parent work items based on their children.
- Check "Automate the state of parent work items" for stories, features, or epics.
- Configure rules like:
- "When all children are set to Done, set the parent to Done."
- "When a child is activated (e.g., set to In Progress), activate the parent."
- Click **Save**.
**Example Scenario:** If you have a User Story, and you create several Tasks under it. When all Tasks for that User Story are marked as "Done", this automation rule can automatically set the User Story's status to "Done" as well, improving backlog accuracy.
10. Security & Compliance
Azure DevOps provides robust security features to protect your code, pipelines, and data.
A. User & Group Management (Permissions):
- Navigate to Organization Settings:
Azure DevOps Organization Home > Organization settings (bottom left) > Permissions
- Manage Groups:
- Azure DevOps uses built-in groups (e.g., Project Administrators, Contributors, Readers) and can integrate with Microsoft Entra ID (Azure AD) groups.
- Assign users to appropriate groups with the principle of least privilege.
- Manage Permissions:
- You can set permissions at the organization, project, repository, pipeline, or work item level.
- Example: To set repository permissions: **Project settings (bottom left) > Repos > Repositories**. Select a repo, go to **Security** tab.
B. Secure Pipeline Variables & Secrets:
Never hardcode sensitive information (API keys, passwords) directly in your YAML pipelines.
- Variable Groups: Store reusable sets of variables, including secrets.
- Using in Pipelines:
# azure-pipelines.yml
variables:
- group: MySecrets # Link the variable group
steps:
- script: |
echo "Connecting to service..."
echo "API Key: $(MyApiKey)" # Use $(VariableName) syntax for variables/secrets
displayName: 'Use Secret'
**Caution:** Secrets are masked in logs, but `echo`ing them directly in scripts should be avoided in production. Use them directly in tasks or pass securely.
C. Advanced Security for Azure DevOps:
Integrates GitHub Advanced Security features for proactive security scanning.
- Secret Scanning: Detects exposed secrets (credentials, API keys) in code.
- Dependency Scanning: Identifies known vulnerabilities in open-source dependencies.
- Code Scanning: Uses CodeQL static analysis to find code-level vulnerabilities (e.g., SQL injection, XSS).
- Enable Advanced Security:
- Integrate into Pipelines: Advanced Security tasks can be added to your CI pipelines to run scans automatically. Findings appear in the **Advanced Security** section of your repository.
D. Branch Policies:
Enforce quality gates on important branches (e.g., `main`).
- Navigate:
Azure DevOps Project > Repos > Branches
- Right-click on the `main` branch (or other protected branch) > **Branch policies**.
- Enable policies like:
- **Require a minimum number of reviewers.**
- **Require successful build validation.** (Link your CI pipeline).
- **Require linked work items.**
11. Integrations
Azure DevOps offers extensive integration capabilities with Microsoft services, third-party tools, and custom applications.
Usage Example: Integrating Azure Pipelines with Azure Key Vault (GUI & YAML):
This allows your pipelines to securely fetch secrets from Azure Key Vault.
- Create an Azure Key Vault: (See Azure tutorial if needed). Store a secret (e.g., `MyDbConnectionString`).
- Create a Service Connection: This allows Azure DevOps to authenticate to Azure.
- Link Key Vault to Variable Group:
- Use in Pipeline YAML:
# azure-pipelines.yml
variables:
- group: AppSecretsFromKV # Link the variable group
steps:
- script: |
echo "Using database connection string: $(MyDbConnectionString)" # The secret name from Key Vault
displayName: 'Access Key Vault Secret'
12. Cost Management
Azure DevOps is generally free for up to 5 users (basic plan), with costs primarily coming from additional users, hosted CI/CD minutes beyond free tiers, and advanced features.
13. Best Practices
- Start with a Project Template: Use `Agile` or `Scrum` process templates for a good starting point.
- Branch Policies: Implement strict branch policies (e.g., requiring pull requests, successful builds, minimum reviewers) on your main branches.
- YAML Pipelines: Favor YAML pipelines for CI/CD as they are version-controlled, auditable, and easier to manage across multiple projects.
- Modularize Pipelines: Break down complex pipelines into reusable templates for stages, jobs, and steps.
- Secure Secrets: Always use Variable Groups (linked to Azure Key Vault) for secrets, never hardcode them.
- Use Service Connections: Manage connections to external services (Azure, GitHub, etc.) securely via Service Connections.
- Automated Testing: Integrate unit, integration, and UI tests into your CI pipelines. Publish test results for visibility.
- Automate Deployments: Use release pipelines (classic or multi-stage YAML) for automated deployments to environments.
- Leverage Built-in Analytics: Use Boards dashboards and Pipeline analytics to gain insights into your team's performance and pipeline efficiency.
- Implement DevSecOps: Integrate security scanning tools (e.g., Azure DevOps Advanced Security) into your pipelines.
- Monitor Pipeline Health: Regularly review pipeline logs and dashboards.
- Consistent Naming Conventions: For projects, repositories, pipelines, and variable groups.
- Clean Up Old Builds/Artifacts: Configure retention policies for pipeline runs and artifacts to manage storage costs.
- Use the Marketplace: Explore the Azure DevOps Marketplace for extensions that enhance functionality.
Azure DevOps: Your Unified DevOps Platform!
Azure DevOps provides a powerful, integrated, and cloud-native platform for implementing DevOps practices from end-to-end. By mastering its core services—Boards, Repos, Pipelines, Test Plans, and Artifacts—and applying best practices, your team can achieve faster, more reliable, and more secure software delivery, driving continuous value for your organization.