SQL SERVER DEPLOYMENTS
Made easy with DACPACs
Sanil Mhatre
@SQLSuperGuru
thank you dev up Conference 2016 Sponsors !
About me
■ Database SolutionsArchitect in the Financial Services domain
■ Oracle & SQL Server DBA
■ Java , Big Data , C# , SQL Development
■ Speaker
■ Blogger : http://sqlwithsanil.com
■ Twitter : @SQLSuperGuru
Agenda
■ SQL Server DataTools
■ Legacy deployment scripts
■ What is a DACPAC
■ Benefits of DACPAC Deployments
■ SQLPACKAGE
■ Demos – Physical SQL Server and SQL Azure
■ Q&A
SQL Server DataTools (SSDT)
■ Modern Database Development tooling
■ Declarative Model
■ Connected or Disconnected Mode of Database Development inVisual Studio
■ Build, Debug, Maintain & Refactor Databases
■ VisualTable Designer
■ Advanced Schema compare & Publish Features
DeploymentWith Scripts
■ Manual/Custom built
■ Tedious to maintain and deploy
■ Error Prone & susceptible to tampering
■ Static against a target environment
■ Disparate deployment methods
■ Disparate logging techniques
■ Rollback
Data-tierApplication Component
■ Data-tierApplicationComponent (DAC)
■ Logical Database Management entity that defines all SQL Sever objects
■ Self contained unit of SQL Server Database Deployment
■ Modern Framework - DacFx
■ Portable Deployment artifact – DAC package (DACPAC, .dacpac file)
DACPAC –What and why
■ DAC Package is a portable deployment artifact
■ Declarative Model, independent of target environment
■ Robust and tamper resistant
■ Ability to perform script-less deployments
■ Works with multiple deployment tools (SqlPackage, MSDeploy, Powershell, etc.)
■ Works with various versions of SQL Server on premise and in the cloud
■ Easy rollback
SQLPACKAGE
■ SqlPackage.exe – command line tool
■ Built into SQL Server & SSMS Install
■ No additional purchase, licensing or install
■ Robust & easy to use
■ Performs all DAC Operations
■ Control deployment options via publish profile and/or Command line parameters
DAC Options/Operations
■ Extract a dacpac (Schema only)
■ Export a bacpac (Schema + Data)
■ Register a DAC
■ Drift Report
■ Demo
DAC Deployments
■ Physical SQL Server – on permise
■ Deployment Report
■ Deployment Script
■ Publish
■ Rollback
■ Demo
DAC Deployments
■ SQLAzure - PaaS
■ Visual StudioTeam Services
■ Build definition
■ Release definition
■ Execute Azure SQL : DacpacTask (SqlPackage.exe)
■ Demo
Summary
■ SSDT
■ DACPAC Deployments
■ Implementation details
■ Benefits
■ Questions ?
Appendix – Build Definition
Appendix – Release Definition
Appendix – Release
Appendix – References
■ SQL Server DataTools (SSDT) - https://msdn.microsoft.com/en-
us/library/hh272686(v=vs.103).aspx
■ DAC Framework (DacFx) - https://msdn.microsoft.com/en-
us/library/dn645454(v=sql.120).aspx
■ SQL Package - https://msdn.microsoft.com/library/hh550080(vs.103).aspx#Anchor_5
■ Publish profile with Advanced options -
https://blogs.msdn.microsoft.com/ssdt/2015/02/23/new-advanced-publish-options-to-
specify-object-types-to-exclude-or-not-drop/
■ Visual StudioTeam services - https://www.visualstudio.com/team-services/
■ Build and deploy a DACPAC usingVSTS - https://www.visualstudio.com/en-
us/docs/release/examples/azure/azure-web-apps-and-sql-db

SQL Server Deployments made easy with DACPAC

  • 1.
    SQL SERVER DEPLOYMENTS Madeeasy with DACPACs Sanil Mhatre @SQLSuperGuru
  • 2.
    thank you devup Conference 2016 Sponsors !
  • 3.
    About me ■ DatabaseSolutionsArchitect in the Financial Services domain ■ Oracle & SQL Server DBA ■ Java , Big Data , C# , SQL Development ■ Speaker ■ Blogger : http://sqlwithsanil.com ■ Twitter : @SQLSuperGuru
  • 4.
    Agenda ■ SQL ServerDataTools ■ Legacy deployment scripts ■ What is a DACPAC ■ Benefits of DACPAC Deployments ■ SQLPACKAGE ■ Demos – Physical SQL Server and SQL Azure ■ Q&A
  • 5.
    SQL Server DataTools(SSDT) ■ Modern Database Development tooling ■ Declarative Model ■ Connected or Disconnected Mode of Database Development inVisual Studio ■ Build, Debug, Maintain & Refactor Databases ■ VisualTable Designer ■ Advanced Schema compare & Publish Features
  • 6.
    DeploymentWith Scripts ■ Manual/Custombuilt ■ Tedious to maintain and deploy ■ Error Prone & susceptible to tampering ■ Static against a target environment ■ Disparate deployment methods ■ Disparate logging techniques ■ Rollback
  • 7.
    Data-tierApplication Component ■ Data-tierApplicationComponent(DAC) ■ Logical Database Management entity that defines all SQL Sever objects ■ Self contained unit of SQL Server Database Deployment ■ Modern Framework - DacFx ■ Portable Deployment artifact – DAC package (DACPAC, .dacpac file)
  • 8.
    DACPAC –What andwhy ■ DAC Package is a portable deployment artifact ■ Declarative Model, independent of target environment ■ Robust and tamper resistant ■ Ability to perform script-less deployments ■ Works with multiple deployment tools (SqlPackage, MSDeploy, Powershell, etc.) ■ Works with various versions of SQL Server on premise and in the cloud ■ Easy rollback
  • 9.
    SQLPACKAGE ■ SqlPackage.exe –command line tool ■ Built into SQL Server & SSMS Install ■ No additional purchase, licensing or install ■ Robust & easy to use ■ Performs all DAC Operations ■ Control deployment options via publish profile and/or Command line parameters
  • 10.
    DAC Options/Operations ■ Extracta dacpac (Schema only) ■ Export a bacpac (Schema + Data) ■ Register a DAC ■ Drift Report ■ Demo
  • 11.
    DAC Deployments ■ PhysicalSQL Server – on permise ■ Deployment Report ■ Deployment Script ■ Publish ■ Rollback ■ Demo
  • 12.
    DAC Deployments ■ SQLAzure- PaaS ■ Visual StudioTeam Services ■ Build definition ■ Release definition ■ Execute Azure SQL : DacpacTask (SqlPackage.exe) ■ Demo
  • 13.
    Summary ■ SSDT ■ DACPACDeployments ■ Implementation details ■ Benefits ■ Questions ?
  • 15.
  • 16.
  • 17.
  • 18.
    Appendix – References ■SQL Server DataTools (SSDT) - https://msdn.microsoft.com/en- us/library/hh272686(v=vs.103).aspx ■ DAC Framework (DacFx) - https://msdn.microsoft.com/en- us/library/dn645454(v=sql.120).aspx ■ SQL Package - https://msdn.microsoft.com/library/hh550080(vs.103).aspx#Anchor_5 ■ Publish profile with Advanced options - https://blogs.msdn.microsoft.com/ssdt/2015/02/23/new-advanced-publish-options-to- specify-object-types-to-exclude-or-not-drop/ ■ Visual StudioTeam services - https://www.visualstudio.com/team-services/ ■ Build and deploy a DACPAC usingVSTS - https://www.visualstudio.com/en- us/docs/release/examples/azure/azure-web-apps-and-sql-db