SqlPackage is a command-line utility that you can use for exporting and importing operations in both on-premises SQL Server databases and in cloud databases. SqlPackage supports the following operations:
- Extract. Creates a database snapshot DACPAC file from a SQL Server database or from Azure SQL Database.
- Publish. Updates the schema in a live database to match the schema in a DACPAC
file. If the database does not exist on the destination server, the publish operation
- Export. Exports both schema and data from a SQL Server database or from Azure SQL Database into a BACPAC file.
- Import. Imports the schema and data from a BACPAC into a new database.
- DeployReport. Creates an XML report that describes the changes that would be made by a publish operation.
- DriftReport. Creates an XML report of the changes that have been made to a registered database.
- Script. Creates a Transact-SQL script that you can use to update the schema of a target database to match the schema of a source database.
Use the /Action: or /a parameter to specify which action to execute.
SqlPackage example to import from bacpac file to Azure
sqlpackage.exe /Action:Import /tsn:tcp:.database.windows.net,1433 /tdn: /tu: /tp: /sf: /p:DatabaseEdition=Premium /p:DatabaseServiceObjective=P4 /p:Storage=File
More about SqlPackage parameters: