Tag: Branching Policies

Design and implement controls for deployment pipelines, including branching policies, triggers in approvals, authentication tables, and code owners – Part 3 (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Secure, optimize, and deploy database solutions (35–40%)
   --> Implement CI/CD by using SQL Database Projects
      --> Design and implement controls for deployment pipelines, including branching policies, triggers in approvals, authentication tables, and code owners


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

In Part 1, you learned about branching strategies, pull requests, branch protection policies, and Code Owners. In Part 2, you explored deployment triggers, approvals, authentication, Managed Identity, secrets management, and deployment strategies.

This final part focuses on monitoring deployments, auditing changes, troubleshooting common pipeline issues, DP-800 exam tips, and concludes with 10 practice exam questions with answers and explanations.


Monitoring Deployment Pipelines

Monitoring deployment pipelines ensures deployments execute successfully and helps quickly identify failures.

Organizations should continuously monitor:

  • Pipeline execution status
  • Deployment duration
  • Build success rate
  • Deployment frequency
  • Failed deployments
  • Rollback frequency
  • Security events
  • Approval history

Monitoring improves operational reliability and supports continuous improvement.


Pipeline Logs

Every pipeline execution produces logs that document each step performed.

Typical log entries include:

  • Source code version
  • Build start and end times
  • Compilation results
  • Unit test results
  • Deployment scripts executed
  • SQL errors
  • Authentication events
  • Approval actions

Example:

09:12 Build Started
09:14 SQL Project Compiled Successfully
09:15 Unit Tests Passed
09:17 Deployment Started
09:19 Deployment Completed Successfully

Pipeline logs are the first place administrators should investigate deployment failures.


Auditing Deployment Activities

Auditing provides a permanent record of deployment activities.

Common audit information includes:

  • Who approved deployment
  • Who initiated deployment
  • Date and time
  • Target environment
  • Database version
  • Objects modified
  • Authentication method
  • Pipeline identifier

Auditing supports:

  • Compliance
  • Governance
  • Security investigations
  • Operational reporting

Azure Activity Logs

Azure services record deployment-related events in Activity Logs.

Typical recorded events include:

  • Resource creation
  • Database updates
  • Authentication events
  • Role assignments
  • Managed Identity usage
  • Key Vault access
  • Deployment failures

These logs help administrators investigate operational and security issues.


Azure DevOps Audit Logs

Azure DevOps also records pipeline activities such as:

  • Repository changes
  • Pull request approvals
  • Pipeline executions
  • Variable modifications
  • Permission changes
  • Service connection updates

Audit logs improve accountability and simplify compliance reporting.


Security Monitoring

Security monitoring should detect:

  • Unauthorized deployment attempts
  • Failed authentication
  • Excessive permission changes
  • Secret access
  • Unusual deployment times
  • Unexpected production deployments

Security teams often integrate monitoring with Microsoft Sentinel or other SIEM platforms.


Common Deployment Failures

Several issues commonly prevent successful deployments.

Authentication Failure

Example:

Pipeline
Access Denied
Deployment Stops

Possible causes:

  • Expired credentials
  • Incorrect permissions
  • Disabled Managed Identity
  • Invalid service connection

Approval Timeout

Example:

Deployment Waiting
Approval Not Received
Pipeline Timeout

Possible causes:

  • Missing approver
  • Incorrect approval configuration
  • Vacation or unavailable reviewer

Build Failure

Common causes include:

  • SQL syntax errors
  • Invalid references
  • Missing objects
  • Compilation failures

CI validation should detect these issues before deployment.


Test Failure

Deployment should stop automatically if:

  • Unit tests fail
  • Integration tests fail
  • Security scans fail
  • Static code analysis fails

Stopping deployment early prevents production issues.


Merge Conflicts

Two developers may modify the same SQL object simultaneously.

Example:

Developer A

CREATE PROCEDURE usp_GetOrders

Developer B

ALTER PROCEDURE usp_GetOrders

Git cannot determine which version is correct until the conflict is resolved manually.


Troubleshooting Deployment Problems

A systematic approach helps resolve deployment issues efficiently.

Step 1

Verify pipeline logs.

Step 2

Review build output.

Step 3

Confirm authentication.

Step 4

Check approval status.

Step 5

Review deployment scripts.

Step 6

Validate environment configuration.

Step 7

Retry deployment after correcting the issue.


Common Best Practices

Microsoft recommends several practices for enterprise SQL deployments.

Automate Everything Possible

Automate:

  • Builds
  • Testing
  • Validation
  • Packaging
  • Deployment

Automation reduces human error.


Protect Production

Require:

  • Manual approvals
  • Branch protection
  • Code reviews
  • Environment protection
  • Audit logging

Production should never allow direct deployments from developer workstations.


Use Managed Identity

Whenever Azure services are involved:

  • Prefer Managed Identity.
  • Avoid passwords.
  • Avoid embedded secrets.
  • Minimize credential management.

Store Secrets Securely

Never store:

  • Passwords
  • API keys
  • Connection strings
  • Certificates

inside:

  • Git repositories
  • SQL scripts
  • Configuration files

Instead use:

  • Azure Key Vault
  • Secure pipeline variables

Implement Least Privilege

Deployment identities should receive only the permissions required.

Avoid excessive privileges such as:

  • sysadmin
  • Owner
  • Global Administrator

Smaller permission scopes reduce security risk.


Require Peer Review

Require pull requests before merging into protected branches.

Benefits include:

  • Better quality
  • Better documentation
  • Knowledge sharing
  • Earlier bug detection

DP-800 Exam Tips

Expect scenario-based questions that require selecting the most secure and maintainable solution.

Remember these key concepts:

Branch Protection

Protect production branches using:

  • Required reviews
  • Successful builds
  • Status checks
  • Merge restrictions

Code Owners

Automatically assign reviewers for sensitive SQL objects.


Pull Requests

Never merge directly into protected production branches.


Managed Identity

Microsoft’s preferred authentication method for Azure-hosted resources.


Service Principal

Best for automated deployments when Managed Identity is unavailable.


Azure Key Vault

Store secrets securely instead of embedding credentials.


Deployment Approvals

Require approvals before:

  • Production deployments
  • High-risk schema changes
  • Security-related modifications

Deployment Gates

Prevent deployment unless:

  • Tests pass
  • Security scans succeed
  • Required approvals exist

Audit Logs

Understand where deployment history is recorded and how it supports compliance.


End-of-Topic Summary

A successful SQL deployment pipeline combines automation with governance.

The typical enterprise deployment process follows this sequence:

Developer
Feature Branch
Pull Request
Code Review
Build
Unit Tests
Integration Tests
Security Validation
Approval
Deployment
Monitoring
Audit Logging

Microsoft expects DP-800 candidates to understand not only how to deploy SQL Database Projects, but also how to secure those deployments through proper authentication, approvals, source control policies, and auditing.

Mastering these concepts enables developers to build reliable, compliant, and maintainable database deployment pipelines.


Practice Exam Questions

Question 1

A development team wants every database schema change to be reviewed before it can be merged into the main branch. Which feature should be implemented?

A. Scheduled pipeline triggers

B. Pull requests with required reviewers

C. Incremental deployments

D. Query Store

Correct Answer: B

Explanation

Pull requests combined with required reviewers enforce peer review before code reaches protected branches. Scheduled triggers automate pipeline execution, incremental deployments control deployment scope, and Query Store is used for query performance monitoring.


Question 2

A deployment pipeline must authenticate to Azure SQL Database without storing passwords or secrets. Which authentication method should be recommended?

A. SQL Authentication

B. Windows Authentication

C. Managed Identity

D. Shared administrator account

Correct Answer: C

Explanation

Managed Identity eliminates the need to store credentials and automatically manages authentication through Microsoft Entra ID. It is Microsoft’s preferred authentication mechanism for Azure-hosted services.


Question 3

A company wants deployment pipelines to pause before production deployment until a database administrator approves the release. What should be configured?

A. Branch tags

B. Code Owners

C. Manual deployment approval

D. Incremental deployment

Correct Answer: C

Explanation

Manual approvals pause deployment until authorized personnel approve the release. This provides governance for production environments.


Question 4

A deployment pipeline needs to retrieve database connection strings securely during deployment. Where should these secrets be stored?

A. SQL scripts

B. Git repository

C. Configuration files

D. Azure Key Vault

Correct Answer: D

Explanation

Azure Key Vault securely stores secrets, certificates, and connection strings while providing auditing, encryption, and access control.


Question 5

Why should organizations implement branch protection policies?

A. To improve query execution performance

B. To prevent unauthorized or unreviewed changes from being merged

C. To encrypt database columns

D. To eliminate deployment approvals

Correct Answer: B

Explanation

Branch protection policies require reviews, successful builds, and other validations before changes can be merged into protected branches.


Question 6

A SQL deployment pipeline requires an identity that is independent of individual user accounts and can authenticate to Azure resources. Which option is most appropriate?

A. Service Principal

B. SQL login

C. Database user

D. Shared administrator account

Correct Answer: A

Explanation

A Service Principal provides a dedicated application identity for automated deployments. It supports secure, non-interactive authentication and follows enterprise identity management practices.


Question 7

What is the primary purpose of Code Owners in a SQL Database Project repository?

A. Encrypt deployment artifacts

B. Store deployment secrets

C. Automatically assign reviewers for specific files or folders

D. Execute integration tests

Correct Answer: C

Explanation

Code Owners automatically request reviews from designated experts when specific files or directories are modified, improving governance and code quality.


Question 8

Which deployment strategy minimizes downtime by maintaining two production environments and switching traffic after validation?

A. Rolling deployment

B. Incremental deployment

C. Canary deployment

D. Blue-Green deployment

Correct Answer: D

Explanation

Blue-Green deployment maintains separate production environments. After validating the new version, traffic switches to the updated environment, enabling rapid rollback if necessary.


Question 9

A deployment pipeline repeatedly fails immediately after starting because it cannot authenticate to Azure SQL Database. Which troubleshooting step should be performed first?

A. Review pipeline logs and verify authentication configuration

B. Disable branch protection

C. Rebuild the SQL Database Project

D. Delete the deployment pipeline

Correct Answer: A

Explanation

Authentication failures should first be investigated by reviewing pipeline logs and verifying service connections, Managed Identity configuration, or Service Principal permissions.


Question 10

Why should production deployments require manual approvals even when all automated tests have passed?

A. Automated tests replace governance requirements.

B. Manual approvals allow authorized personnel to verify business readiness and organizational compliance before deployment.

C. Manual approvals improve query performance.

D. Production deployments cannot use automated pipelines.

Correct Answer: B

Explanation

Although automated testing validates technical correctness, manual approvals ensure that organizational, operational, and business requirements have also been satisfied before releasing changes into production.


Final DP-800 Exam Preparation Tips

For this objective, remember these high-value exam concepts:

  • Protect important branches with branch protection policies.
  • Require pull requests and peer reviews before merging changes.
  • Use Code Owners to automatically assign reviewers for sensitive database objects.
  • Configure CI pipelines to validate every change through automated builds and tests.
  • Secure deployments with Managed Identity whenever Azure-hosted services support it, or Service Principals when appropriate.
  • Store secrets in Azure Key Vault, not in source control or configuration files.
  • Apply the principle of least privilege to deployment identities.
  • Protect production with deployment approvals, environment protection rules, and deployment gates.
  • Monitor deployment pipelines using logs and audit records to support troubleshooting, governance, and compliance.

These practices align with Microsoft’s recommended DevOps approach for SQL Database Projects and represent the types of deployment governance scenarios you are likely to encounter on the DP-800 certification exam.


Go to the DP-800 Exam Prep Hub main page

Design and implement controls for deployment pipelines, including branching policies, triggers in approvals, authentication tables, and code owners – Part 2 (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Secure, optimize, and deploy database solutions (35–40%)
   --> Implement CI/CD by using SQL Database Projects
      --> Design and implement controls for deployment pipelines, including branching policies, triggers in approvals, authentication tables, and code owners


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

In Part 1, you learned how branching strategies, pull requests, branch protection policies, and Code Owners help organizations maintain secure and reliable SQL Database Projects. In this section, we focus on how deployment pipelines automatically execute, how approvals and authentication secure deployments, and how organizations protect production environments.


Pipeline Triggers

A pipeline trigger determines when a build or deployment pipeline starts.

Rather than requiring developers to manually start every pipeline, modern CI/CD systems automatically execute pipelines based on predefined events.

Common trigger types include:

  • Source code commits
  • Pull requests
  • Scheduled executions
  • Manual execution
  • Completion of another pipeline
  • Tag creation
  • Release approvals

Choosing the appropriate trigger helps balance automation with governance.


Continuous Integration Triggers

Continuous Integration (CI) pipelines usually start automatically after code changes.

Typical CI trigger:

Developer Commit
Git Repository
Automatic Build
Compile SQL Database Project
Run Validation
Publish Build Artifact

Benefits include:

  • Immediate feedback
  • Early detection of errors
  • Frequent validation
  • Consistent builds
  • Reduced integration problems

Common CI Trigger Events

Commit Trigger

The pipeline starts whenever a developer commits changes.

Example:

Commit to feature branch
Build Pipeline Starts

Useful for:

  • Early validation
  • Fast feedback
  • Developer productivity

Pull Request Trigger

Instead of triggering on every commit, organizations often build whenever a pull request is created or updated.

Example:

Feature Branch
Create Pull Request
Automatic Validation
Review

Benefits:

  • Ensures only validated code reaches protected branches
  • Prevents broken code from being merged
  • Supports branch protection policies

Scheduled Trigger

Some validation pipelines execute on a schedule.

Example:

Every Night
Run Full Test Suite

Useful for:

  • Long-running tests
  • Security scanning
  • Dependency validation
  • Performance testing

Manual Trigger

Certain deployments should never execute automatically.

Example:

Release Manager
Start Production Deployment

Manual triggers provide additional governance before production releases.


Continuous Delivery Triggers

Continuous Delivery (CD) pipelines move validated artifacts through multiple environments.

Example:

Build Artifact
Development
Testing
Staging
Production

Each stage may have different approval requirements.


Deployment Approvals

Approvals ensure that qualified personnel review changes before deployment.

Instead of automatically deploying to production, pipelines pause until an authorized user approves the release.

Example:

Deployment Ready
Approval Required
Manager Approves
Deployment Continues

Types of Deployment Approvals

Manual Approval

A designated reviewer manually approves deployment.

Common reviewers include:

  • Database Administrator
  • Development Lead
  • Security Team
  • Operations Team
  • Product Owner

Multi-Stage Approval

Different environments require different reviewers.

Example:

EnvironmentRequired Approval
DevelopmentNone
TestTeam Lead
StagingDBA
ProductionDBA + Operations Manager

This layered approval process minimizes production risk.


Conditional Approval

Approval requirements may depend on:

  • Database type
  • Environment
  • Change size
  • Security classification
  • Time of deployment

Example:

Production Deployment
Contains Schema Changes?
Yes
Require DBA Approval

Environment Protection

Modern DevOps platforms allow organizations to protect deployment environments.

Environment protection can require:

  • Manual approvals
  • Deployment windows
  • Authentication verification
  • Security policies
  • Health checks

Example:

Pipeline
Staging
Approval
Production

Only authorized deployments can proceed.


Deployment Gates

Deployment gates evaluate conditions before allowing deployment.

Common gates include:

  • Successful testing
  • Security scan completion
  • Vulnerability assessment
  • Performance validation
  • Business approval
  • Service availability

Example:

Security Scan Passed?
Yes
Continue Deployment

If any gate fails, deployment stops automatically.


Authentication in Deployment Pipelines

Authentication verifies the identity of the pipeline when accessing resources.

The deployment pipeline may need to access:

  • SQL Server
  • Azure SQL Database
  • Azure Key Vault
  • Azure Storage
  • Azure AI Services
  • Microsoft Fabric
  • Azure OpenAI
  • Azure Resource Manager

Secure authentication is essential because deployment pipelines often operate without human intervention.


Authentication Methods

Common authentication methods include:

  • Microsoft Entra ID (Azure AD)
  • Managed Identity
  • Service Principal
  • OAuth tokens
  • Personal Access Tokens (PATs)
  • SQL Authentication (legacy scenarios)

Microsoft recommends avoiding passwords whenever possible.


Service Principals

A Service Principal represents an application identity in Microsoft Entra ID.

Instead of using a person’s account, the deployment pipeline authenticates using its own identity.

Example:

Pipeline
Service Principal
Microsoft Entra ID
Azure SQL Database

Benefits:

  • Non-interactive authentication
  • Fine-grained permissions
  • Centralized identity management
  • Easy auditing
  • Supports automation

Managed Identity

A Managed Identity is the preferred authentication method for Azure-hosted services.

Instead of storing credentials, Azure automatically manages authentication.

Example:

Azure DevOps Agent
Managed Identity
Microsoft Entra ID
Azure SQL Database

Advantages include:

  • No stored passwords
  • Automatic credential rotation
  • Improved security
  • Simplified administration
  • Reduced risk of credential leakage

Managed Identity is increasingly emphasized across Microsoft certifications, including DP-800.


System-Assigned vs User-Assigned Managed Identity

System-Assigned Managed Identity

Characteristics:

  • Tied to one Azure resource
  • Automatically created
  • Automatically deleted with the resource
  • Ideal for single-resource scenarios

Example:

App Service
System Managed Identity
Azure SQL

User-Assigned Managed Identity

Characteristics:

  • Independent Azure resource
  • Shared across multiple services
  • Longer lifecycle
  • Reusable

Example:

Managed Identity
Web App
Azure Function
Azure SQL Database

Useful when multiple applications require the same identity.


Least Privilege Principle

Deployment identities should have only the permissions necessary to perform deployments.

Avoid granting:

  • sysadmin
  • db_owner (unless required)
  • Subscription Owner
  • Global Administrator

Instead, assign only the permissions needed.

Example:

Deployment pipeline requires:

  • ALTER TABLE
  • CREATE PROCEDURE
  • CREATE VIEW

It does not require:

  • DROP DATABASE
  • Server Administration
  • Security Administration

Following the principle of least privilege reduces the impact of compromised credentials.


Secrets Management

Pipelines often require sensitive information, such as:

  • Connection strings
  • API keys
  • Certificates
  • Tokens
  • Database credentials

Hardcoding these values in source control is a major security risk.


Azure Key Vault

Azure Key Vault is the recommended solution for storing secrets.

Instead of embedding credentials:

Pipeline
Azure Key Vault
Retrieve Secret
Deploy Database

Benefits include:

  • Centralized secret storage
  • Encryption at rest
  • Access auditing
  • Role-based access control
  • Automatic secret rotation
  • Integration with Azure DevOps and GitHub Actions

Secure Pipeline Variables

CI/CD platforms support secure variables that:

  • Encrypt values
  • Hide secrets in logs
  • Restrict access
  • Limit modification permissions

Examples include:

  • SQL connection strings
  • Azure subscription IDs
  • API tokens
  • Storage account keys

Sensitive values should never be committed to a Git repository.


Environment-Specific Configuration

Different deployment environments often require different configuration values.

Example:

EnvironmentDatabase
DevelopmentDevDB
TestingTestDB
StagingStageDB
ProductionProdDB

Pipelines should dynamically retrieve the correct configuration for each environment rather than hardcoding values.


Deployment Strategies

Different deployment strategies reduce downtime and deployment risk.

Common strategies include:

Incremental Deployment

Deploy only changed objects.

Advantages:

  • Faster deployments
  • Lower risk
  • Reduced downtime

Rolling Deployment

Deploy changes gradually across multiple instances.

Useful for:

  • High availability
  • Large distributed systems

Blue-Green Deployment

Maintain two production environments.

Blue Environment
(Current)
Switch
Green Environment
(New Version)

Advantages:

  • Minimal downtime
  • Fast rollback
  • Lower deployment risk

Canary Deployment

Deploy to a small subset of users first.

If successful:

5%
25%
50%
100%

This strategy helps identify issues before a full rollout.


Best Practices for Secure Deployment Pipelines

Microsoft recommends the following practices:

  • Automate builds whenever possible.
  • Require approvals for production deployments.
  • Use Microsoft Entra ID authentication.
  • Prefer Managed Identity over stored credentials.
  • Store secrets in Azure Key Vault.
  • Apply least privilege permissions.
  • Protect production environments with approval gates.
  • Separate development, test, staging, and production environments.
  • Monitor deployment history and audit logs.
  • Validate deployments before promotion to production.

DP-800 Exam Tips

For the exam, be prepared to identify when to use:

  • Pull request triggers versus commit triggers.
  • Manual approvals for production deployments.
  • Managed Identity instead of passwords or embedded credentials.
  • Service Principals for automated, non-interactive deployments.
  • Azure Key Vault for secure secrets management.
  • Environment protection rules to safeguard production resources.
  • Least privilege permissions for deployment identities.
  • Appropriate deployment strategies such as blue-green, rolling, or incremental deployments based on business requirements.

Part 2 Summary

In this section, you learned how organizations secure and automate SQL deployment pipelines through:

  • Pipeline triggers and CI/CD automation
  • Manual and conditional deployment approvals
  • Environment protection and deployment gates
  • Authentication using Microsoft Entra ID
  • Service Principals and Managed Identity
  • Least privilege access
  • Secrets management with Azure Key Vault
  • Secure pipeline variables
  • Environment-specific configuration
  • Common deployment strategies
  • Microsoft-recommended security and governance practices

Go to the DP-800 Exam Prep Hub main page

Design and implement controls for deployment pipelines, including branching policies, triggers in approvals, authentication tables, and code owners – Part 1 (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Secure, optimize, and deploy database solutions (35–40%)
   --> Implement CI/CD by using SQL Database Projects
      --> Design and implement controls for deployment pipelines, including branching policies, triggers in approvals, authentication tables, and code owners


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Microsoft expects SQL AI Developers to understand not only how to develop database solutions but also how to deploy them safely, consistently, and securely using modern DevOps practices.

Organizations rarely allow developers to deploy SQL changes directly into production. Instead, database changes pass through controlled deployment pipelines that validate the code, enforce security policies, require approvals, and ensure only authorized changes reach production.

Modern SQL development emphasizes:

  • Source-controlled database projects
  • Automated builds
  • Automated testing
  • Controlled deployments
  • Secure authentication
  • Governance through branching policies and approvals
  • Auditable deployment history

Understanding these concepts is essential for both the DP-800 exam and real-world enterprise database development.


What Are Deployment Pipeline Controls?

Deployment pipeline controls are rules and processes that ensure database changes move safely from development to production.

Instead of allowing developers to make direct changes to production databases, organizations require every change to follow a controlled workflow.

A typical workflow looks like this:

Developer
Feature Branch
Pull Request
Code Review
Automated Build
Unit Tests
Integration Tests
Approval
Deployment Pipeline
Development
Test
Staging
Production

Each stage reduces the risk of introducing errors into production.


Why Deployment Controls Matter

Without deployment controls, organizations often experience:

  • Accidental schema changes
  • Lost database objects
  • Unauthorized modifications
  • Production outages
  • Failed deployments
  • Data corruption
  • Compliance violations
  • Security risks

Deployment controls provide:

  • Consistency
  • Repeatability
  • Security
  • Governance
  • Auditability
  • Faster recovery
  • Higher software quality

For enterprise environments, these controls are considered mandatory.


SQL Database Projects and Deployment Pipelines

SQL Database Projects represent an entire database schema as source-controlled code.

Instead of modifying objects directly inside SQL Server Management Studio (SSMS), developers modify project files.

Example:

Tables
Customers.sql
Orders.sql
Products.sql
Views
SalesView.sql
Stored Procedures
usp_CreateOrder.sql
Functions
fn_TotalSales.sql

The deployment pipeline compares the project against the target database and generates the necessary deployment script automatically.

Benefits include:

  • Version history
  • Repeatable deployments
  • Easier collaboration
  • Automated validation
  • Reduced deployment risk

CI/CD Overview

CI/CD stands for:

Continuous Integration (CI)

Developers frequently merge changes into a shared repository.

Every commit automatically triggers:

  • Build validation
  • SQL compilation
  • Static code analysis
  • Unit testing
  • Artifact creation

Example:

Developer Commit
Git Repository
Automatic Build
Database Project Build
Validation
Package Generated

Continuous Delivery (CD)

Continuous Delivery automates deployments through multiple environments.

Example:

Development
QA
Staging
Production

Each deployment can require approvals before continuing.

Benefits include:

  • Faster releases
  • Fewer deployment errors
  • Repeatable deployments
  • Reliable rollback strategies

Understanding Branching Strategies

Branching is one of the most important deployment controls.

A branch is an independent line of development inside source control.

Instead of every developer modifying the main branch directly, developers work in isolated branches.

Example:

Main
├── Feature A
├── Feature B
├── Bug Fix
└── Feature C

Each branch is reviewed before merging.


Why Branching Is Important

Branching allows developers to:

  • Work independently
  • Prevent conflicts
  • Test safely
  • Review code
  • Protect production code
  • Isolate unfinished features

Without branching:

  • Developers overwrite one another’s work.
  • Unfinished code reaches production.
  • Rollbacks become difficult.

Common Branching Strategies

Several branching strategies are commonly used.


Feature Branch Workflow

The most common approach.

Each new feature receives its own branch.

Example:

Main
├── feature/AddOrders
├── feature/AddInvoices
├── feature/SearchCustomers

Advantages:

  • Easy code review
  • Simple testing
  • Low risk
  • Small pull requests

This is one of the most common approaches for SQL Database Projects.


GitFlow

GitFlow introduces several branch types.

Main
Develop
Feature Branches
Release Branches
Hotfix Branches

Typical workflow:

Main
Develop
Feature Branch
Develop
Release
Main

Advantages:

  • Strong release management
  • Good for large teams
  • Stable production releases

Disadvantages:

  • More complex
  • Additional branch management

Trunk-Based Development

Developers merge frequently into a single shared branch.

Main
Developer 1
Developer 2
Developer 3
Developer 4

Developers create very short-lived branches.

Advantages:

  • Small changes
  • Faster integration
  • Less merge complexity

Disadvantages:

  • Requires excellent automated testing
  • Requires disciplined developers

Branch Protection Policies

Branch protection prevents unsafe changes.

The main branch is typically protected.

Developers cannot:

  • Force push
  • Delete the branch
  • Merge without approval
  • Merge failed builds
  • Bypass policies

Example policy:

Main Branch
✓ Build must succeed
✓ Two reviewers required
✓ No direct commits
✓ Status checks pass
✓ Linked work item required
✓ Up-to-date before merge

These policies dramatically reduce deployment mistakes.


Common Branch Protection Rules

Organizations often require:

Required Pull Requests

Direct commits are blocked.

Developers must create a pull request.


Required Reviewers

Example:

Minimum Reviewers = 2

Multiple reviewers reduce errors.


Successful Build Required

If automated validation fails, merging is blocked.

Example:

Build Failed
Merge Blocked

Required Status Checks

Policies verify that:

  • Unit tests passed
  • Integration tests passed
  • Security scans completed
  • SQL build succeeded
  • Code quality passed

Only then is the merge allowed.


Prevent Force Push

Force pushes rewrite Git history.

Most organizations disable them for protected branches.


Prevent Branch Deletion

Important branches should never be accidentally removed.

Branch protection prevents deletion.


Pull Requests (PRs)

A pull request requests permission to merge one branch into another.

Example:

Feature Branch
Pull Request
Review
Approval
Merge

A pull request usually includes:

  • Description
  • Changed files
  • SQL object modifications
  • Reviewer comments
  • Build status
  • Test results

Benefits of Pull Requests

Pull requests improve quality by encouraging:

  • Peer review
  • Knowledge sharing
  • Early defect detection
  • Security review
  • Coding standard enforcement

For SQL projects, reviewers often examine:

  • Table changes
  • Index changes
  • Stored procedures
  • Permissions
  • Migration scripts
  • Performance impacts

Code Reviews

Code reviews help identify issues before deployment.

Reviewers commonly check:

Correctness

Does the SQL produce the expected results?

Performance

Are indexes appropriate?

Will queries scale?

Security

Are permissions appropriate?

Is SQL injection prevented?

Maintainability

Is the code readable?

Are naming standards followed?

Backward Compatibility

Will existing applications continue working?


Code Owners

One important governance feature is Code Owners.

A Code Owners file automatically assigns reviewers based on the files that change.

Example:

Tables/*
→ Database Team
StoredProcedures/*
→ Backend Team
Security/*
→ Security Team

When a developer modifies a protected object, the correct experts are automatically requested to review the change.

Benefits of Code Owners

Code Owners provide several advantages:

  • Automatic reviewer assignment
  • Faster review workflows
  • Consistent governance
  • Improved accountability
  • Better code quality
  • Subject matter expert validation
  • Compliance with organizational policies

For example:

  • Changes to security-related scripts can require approval from the security team.
  • Changes to database schema objects can require approval from database administrators.
  • Changes to deployment scripts can require DevOps team approval.

This ensures that critical database components are always reviewed by the appropriate personnel before deployment.


Best Practices for Branching and Pull Requests

Microsoft recommends following modern DevOps practices when managing SQL Database Projects.

Some recommended best practices include:

  • Create small, focused feature branches.
  • Keep branches short-lived.
  • Merge changes frequently.
  • Require pull requests for protected branches.
  • Require successful builds before merging.
  • Require automated tests before deployment.
  • Require peer reviews.
  • Protect the main branch from direct commits.
  • Use Code Owners for sensitive database objects.
  • Document pull requests with clear descriptions.
  • Resolve merge conflicts promptly.
  • Use descriptive branch names such as:
    • feature/AddCustomerSearch
    • bugfix/FixDeadlockIssue
    • hotfix/CorrectCustomerIndex

Following these practices improves collaboration, reduces deployment risk, and helps maintain a reliable, auditable database development process.


Part 1 Summary

In this first part, you learned the foundational deployment pipeline controls that are central to modern SQL DevOps and the DP-800 exam:

  • The purpose of deployment pipeline controls
  • The role of SQL Database Projects in CI/CD
  • Continuous Integration (CI) and Continuous Delivery (CD)
  • Common branching strategies (Feature Branch, GitFlow, and Trunk-Based Development)
  • Branch protection policies and why they matter
  • Pull requests and peer code reviews
  • Code Owners and automated reviewer assignment
  • Best practices for secure and reliable database development

Go to the DP-800 Exam Prep Hub main page