Created
June 9, 2022 06:54
-
-
Save rollendxavier/087f3714020e6a4ce806d3c70f5ed035 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger: | |
branches: | |
include: | |
- main | |
- releases/* | |
paths: | |
include: | |
- /Scripts/Migration/* | |
variables: | |
azureSubscription: 'dev-subscription' | |
server_name: 'test-sqlserver' | |
database_name: 'test-sql-database' | |
agent: 'ps-win-agent1' | |
stages: | |
- stage:Migrate | |
displayName: Migrate SQL Scripts | |
variables: | |
- group: migrator-variables | |
jobs: | |
- job: Initialize | |
displayName: 'Initialize' | |
pool: $(agent) | |
steps: | |
- script: | | |
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "Install-PackageProvider NuGet -Scope CurrentUser -Force" | |
displayName: 'Powershell Install NuGet' | |
- script: | | |
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "Install-Module -Name SqlServer -AllowClobber -Scope CurrentUser -Force" | |
displayName: 'Install SqlServer Tool' | |
- deployment: Migration | |
displayName: 'SQL Data Migration' | |
dependsOn: [Initialize] | |
pool: $(agent) | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- task: PowerShell@2 | |
displayName: 'SQL Migration' | |
inputs: | |
targetType: 'filePath' | |
filePath: $(System.DefaultWorkingDirectory)/Scripts/sqlcmdmigrator.ps1 | |
arguments: > | |
-Server "$(server_name).database.windows.net" | |
-Database "$(database_name)" | |
-UserName "$(SQLAdminUser)" | |
-Password "$(SQLAdminPassword)" | |
-Scriptpath "$(System.DefaultWorkingDirectory)/Scripts/SQL" | |
-Includesubfolders true | |
errorActionPreference: 'stop' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment