|
| 1 | +--- |
| 2 | +title: SqlPackage in development pipelines |
| 3 | +description: Learn how to troubleshoot database development pipelines with SqlPackage.exe by checking the installed build number. |
| 4 | +ms.prod: sql |
| 5 | +ms.prod_service: sql-tools |
| 6 | +ms.technology: tools-other |
| 7 | +ms.topic: conceptual |
| 8 | +ms.assetid: 198198e2-7cf4-4a21-bda4-51b36cb4284b |
| 9 | +author: "dzsquared" |
| 10 | +ms.author: "drskwier" |
| 11 | +ms.reviewer: "maghan; sstein" |
| 12 | +ms.date: 11/4/2020 |
| 13 | +--- |
| 14 | + |
| 15 | +# SqlPackage in Development Pipelines |
| 16 | + |
| 17 | +**SqlPackage.exe** is a command-line utility that automates several database development tasks and can be incorporated into CI/CD pipelines. |
| 18 | + |
| 19 | +## Managed virtual environments for Azure Pipelines and GitHub Actions |
| 20 | + |
| 21 | +The virtual environments used for GitHub Actions hosted runners and Azure Pipelines VM images are managed in the [virtual-environments](https://github.com/actions/virtual-environments) GitHub repository. SqlPackage is included in the `windows-latest` environment and updates to the images are made within a few weeks of each SqlPackage release. |
| 22 | + |
| 23 | +## Checking the SqlPackage version in a virtual environment |
| 24 | + |
| 25 | +During troubleshooting efforts, it is important to know the SqlPackage version in use. Capturing this information can be done by adding a step to the pipeline to run SqlPackage with the `/version` parameter. Examples are given below based on the Microsoft and GitHub managed environments, self-hosted environments may have different installation paths for the working directory. |
| 26 | + |
| 27 | +### Azure Pipelines |
| 28 | + |
| 29 | +By leveraging the [script](https://docs.microsoft.com/azure/devops/pipelines/yaml-schema#script) keyword in an Azure Pipeline, a step can be added to an Azure Pipeline that outputs the SqlPackage version number. |
| 30 | + |
| 31 | +```yaml |
| 32 | +- script: sqlpackage.exe /version |
| 33 | + workingDirectory: C:\Program Files\Microsoft SQL Server\150\DAC\bin\ |
| 34 | + displayName: 'get sqlpackage version' |
| 35 | +``` |
| 36 | +
|
| 37 | +### GitHub Actions |
| 38 | +
|
| 39 | +By leveraging the [run](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions) keyword in a GitHub Action workflow, a step can be added to a GitHub Action that outputs the SqlPackage version number. |
| 40 | +
|
| 41 | +```yaml |
| 42 | +- name: get sqlpackage version |
| 43 | + working-directory: C:\Program Files\Microsoft SQL Server\150\DAC\bin\ |
| 44 | + run: ./sqlpackage.exe /version |
| 45 | +``` |
| 46 | +
|
| 47 | +:::image type="content" source="media/sqlpackage-pipelines-githubaction.png" alt-text="GitHub action output displaying build number 15.0.4897.1"::: |
| 48 | +
|
| 49 | +## Next Steps |
| 50 | +
|
| 51 | +- Learn more about [sqlpackage](sqlpackage.md) |
| 52 | +
|
| 53 | +[Microsoft Privacy Statement](https://go.microsoft.com/fwlink/?LinkId=521839) |
0 commit comments