- DacFramework this will install sqlpackage in
C:\Program Files\Microsoft SQL Server\150\DAC\bin
- SourceServerName
- SourceDatabaseName
- SourceEncryptConnection
- TargetFile
- SourceUser
- SourcePassword
chdir /d C:\Program Files\Microsoft SQL Server\150\DAC\bin\
-> It changes current performance to folder with sql packageSQLPackage.exe /Action:Export ^
-> Indicates Export action(From Azure to .bacpac file)/SourceServerName: ^
-> Server Name/SourceDatabaseName: ^
-> Database Name/SourceEncryptConnection: ^
-> Enabling encrypted connection/TargetFile: ^
-> Set where to write bacpac file locally/SourceUser: ^
-> Database User/SourcePassword:
-> Database Passwordchdir /d %~dp0
-> It changes from utility folder to bacpac file folder
For start running it and importing database, you should to open your azure database firewall for allowing connections for this ip.
./ExportFromAzureSQLDb.bat myserver.database.windows.net MyDatabase D:\ImportSQLFromAzure\MyDatabase.bacpac DatabaseUser DatabasePassword
- TargetServerName
- TargetDatabaseName
- SourceFile
chdir /d C:\Program Files\Microsoft SQL Server\150\DAC\bin\
-> It changes current performance to folder with sql packageSQLPackage.exe /Action:Import ^
-> Indicates Import action(From .bacpac file to sql database)/TargetServerName: ^
-> .\MySQLServer is your sql database instance/TargetDatabaseName: ^
-> MyDatabase is desired database/SourceFile: ^
-> Source file which you get usingExportFromAzureSQLDb.bat
filechdir /d %~dp0
-> It changes from utility folder to script directory
Import might throw some warnings because you are migrating from cloud version to your local sql version(e.g. 2014/2016 etc.) but if you are not using any special feature from cloud version, just press enter and migration will continue normally.
./ImportToSQLServer.bat .\MySQLServer MyDatabase D:\ImportSQLFromAzure\MyDatabase.bacpac