-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.ps1
More file actions
15 lines (11 loc) · 645 Bytes
/
script.ps1
File metadata and controls
15 lines (11 loc) · 645 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
param (
[Parameter(Mandatory=$true)]$server,
[Parameter(Mandatory=$true)]$username
)
$password = Read-Host "Azure SQL Password" -asSecureString
$sqlPackage="C:\SqlPackage\sqlpackage.exe"
$dacpac="../dacpac/bus-db.dacpac"
$PwdPointer = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($password)
$PlainTextPassword = [Runtime.InteropServices.Marshal]::PtrToStringAuto($PwdPointer)
[Runtime.InteropServices.Marshal]::ZeroFreeBSTR($PwdPointer)
Invoke-Expression "$sqlPackage /a:script /op:script.sync.sql /sf:$dacpac /tcs:""Data Source=$server.database.windows.net;Initial Catalog=bus-db;UID=$username;PWD=$PlainTextPassword"""