Complete Azure DevOps Tutorial with Usage Examples

Table of Contents

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:

2. Azure DevOps Services

Azure DevOps is comprised of several distinct, yet integrated, services:

3. Getting Started with Azure DevOps

A. Create an Azure DevOps Organization:

  1. Go to dev.azure.com.
  2. Sign in with your Microsoft account (personal or work/school).
  3. Click **Create new organization**.
  4. Provide a **name** for your organization (e.g., `my-devops-org-2025`).
  5. Choose a **hosting geography** (e.g., `South India`).
  6. 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.

  1. 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).
  2. Project name: Enter a unique name (e.g., `MyWebAppProject`).
  3. Description: (Optional) `Project for my web application development`.
  4. Visibility: Choose `Public` (anyone on the internet can view) or `Private` (only users you grant access to). For most tutorials, `Private` is fine.
  5. Advanced (Version control): `Git` (recommended) or `Team Foundation Version Control (TFVC)`.
  6. Advanced (Work item process): `Agile` (recommended), `Scrum`, `Basic`, or `CMMI`. This defines your Boards workflow.
  7. 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:

**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:

  1. 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**.
  2. Clone to your local machine:
    • After creation, on the "Files" tab, click **Clone**.
    • Select **HTTPS** or **SSH**. For HTTPS, click "Generate Git Credentials" if using a personal access token (PAT) or use your Azure AD account.
    • Copy the clone URL.
    • Open your local terminal and run:
      git clone <your_repo_clone_url>
      cd <your_repo_name>
      echo "My first code commit!" > README.md
      git add .
      git commit -m "Initial commit"
      git push origin main # Or master, depending on default branch name

C. Manage Branches & Pull Requests:

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.

  1. Click **Pipelines** > **+ New pipeline**.
  2. Where is your code?: Select your source control (e.g., `Azure Repos Git`).
  3. Select your repository (e.g., `my-web-app-git`).
  4. Configure: Choose a template (e.g., `Node.js`).
  5. An `azure-pipelines.yml` file will be generated in an inline editor. This is your pipeline definition.
  6. 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')
  7. Click **Save and run**. Add a commit message and click **Save and run** again.

C. Monitor Pipeline Runs:

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.

  1. Click **Pipelines** > **Releases** > **+ New pipeline**.
  2. Select an empty template or a predefined one.
  3. 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**.
  4. 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.
  5. 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:

  1. Click **Test Plans** > **+ New Test Plan**.
  2. Provide a **Name** (e.g., `Sprint X - Feature A Testing`).
  3. Set **Area path** and **Iteration** (sprint). Click **Create**.

C. Add Test Suites and Test Cases:

  1. In your Test Plan, click **+ New Suite** to organize tests (e.g., `User Login Test Suite`).
  2. 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:

  1. Select your test case(s) in the Test Plan.
  2. Click **Run** > **Run for web application**. This opens the Azure Test Runner.
  3. Manually execute steps, mark them as **Pass/Fail**, add **Comments**, and capture **Screenshots**.
  4. 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.
  5. 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:

  1. Click **+ Create Feed**.
  2. Name: (e.g., `my-private-feed`).
  3. Visibility: `Organization` or `Project`.
  4. Upstream sources: Enable if you want to proxy public registries (e.g., `npmjs.com`, `nuget.org`).
  5. Click **Create**.

C. Publish/Consume Packages:

  1. 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).
  2. 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
  3. 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:

  1. Go to the **Automation rules** tab (or **Process** > **Backlogs** in older versions).
  2. 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."
  3. 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):

  1. Navigate to Organization Settings:
    Azure DevOps Organization Home > Organization settings (bottom left) > Permissions
  2. 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.
  3. 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.

  1. Variable Groups: Store reusable sets of variables, including secrets.
    • **Navigate:**
      Azure DevOps Project > Pipelines > Library
    • Click **+ Variable group**.
    • **Name:** (e.g., `MySecrets`).
    • Add variables and check "Keep this value secret" for sensitive data.
    • **Link to Azure Key Vault:** You can also link a variable group directly to an Azure Key Vault to pull secrets dynamically.
  2. 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.

  1. Enable Advanced Security:
    • **Navigate:**
      Azure DevOps Project > Project settings > Repos > Repositories
    • Select a repository. Go to **Settings** > **Advanced Security**.
    • Toggle **Enable Advanced Security** on.
  2. 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`).

  1. Navigate:
    Azure DevOps Project > Repos > Branches
  2. Right-click on the `main` branch (or other protected branch) > **Branch policies**.
  3. 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.

  1. Create an Azure Key Vault: (See Azure tutorial if needed). Store a secret (e.g., `MyDbConnectionString`).
  2. Create a Service Connection: This allows Azure DevOps to authenticate to Azure.
    • **Navigate:**
      Azure DevOps Project > Project settings > Service connections
    • Click **+ New service connection**.
    • Select `Azure Resource Manager` > `Service principal (automatic)`.
    • Select your **Subscription** and **Resource Group**.
    • **Service connection name:** (e.g., `AzureForPipelines`).
    • Check "Grant access permission to all pipelines."
    • Click **Save**.
  3. Link Key Vault to Variable Group:
    • **Navigate:**
      Azure DevOps Project > Pipelines > Library
    • Click **+ Variable group**.
    • **Name:** (e.g., `AppSecretsFromKV`).
    • Check "Link secrets from an Azure key vault as variables."
    • Select your **Azure subscription** (the service connection you created).
    • Select your **Key Vault**.
    • Click **+ Add** and select the secrets you want to expose as variables.
    • Click **Save**.
  4. 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

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.