22 DevOps automation

 

The previous chapters have given you a grounding in dbatools in various areas that relate to a classic database administrator’s role. This chapter will show some examples of ways that you can use dbatools within a DevOps process. First, though, we need to define DevOps. You can find a hundred different definitions and understandings of the term, but we like this one from Microsoft (sqlps.io/whatdevops):

A compound of development (Dev) and operations (Ops), DevOps is the union of people, processes, and technology to continually provide value to customers.

The quote resonates with us because we believe that being able to continually provide value to customers requires people and processes and technology. dbatools is not going to be able to solve DevOps for you, but it is a tool (technology) that you (a person) can use within your processes to provide that value.

Overall, though, DevOps means different things to different people, which is why you’ll often find varying definitions. In a conversation with PowerShell MVP and DevOps engineer Chris Gardner, Chris said, “I see a DevOps engineer as kind of a one-size-fits-all title, but the actual work involved will vary.”

22.1 When should you use dbatools in DevOps?

22.2 DACPAC

22.2.1 Exporting a DACPAC from an existing database

22.2.2 Publishing a DACPAC

22.2.3 DACPAC options

22.3 Running dbatools (and PowerShell) on a CI/CD system

22.3.1 Creating a task

22.3.2 Ensuring the dbatools module is available

22.3.3 Understanding how to add parameters to the script

22.4 Hands-on lab