Import a BACPAC file to a new Azure SQL Database

When you need to import a database from an archive or when migrating from another platform, you can import the database schema and data from a BACPAC file. A BACPAC file is a ZIP file with an extension of BACPAC containing the metadata and data from a SQL Server database. A BACPAC file can be imported from Azure blob storage (standard storage only) or from local storage in an on-premises location. To maximize the import speed, we recommend that you specify a higher service tier and compute size, such as a P6, and then scale to down as appropriate after the import is successful. Also, the database compatibility level after the import is based on the compatibility level of the source database.


After you migrate your database to Azure SQL Database, you can choose to operate the database at its current compatibility level (level 100 for the AdventureWorks2008R2 database) or at a higher level. For more information on the implications and options for operating a database at a specific compatibility level, see ALTER DATABASE Compatibility Level. See also ALTER DATABASE SCOPED CONFIGURATION for information about additional database-level settings related to compatibility levels.

Import from a BACPAC file using Azure portal

This article provides directions for creating an Azure SQL database from a BACPAC file stored in Azure blob storage using the Azure portal. Import using the Azure portal only supports importing a BACPAC file from Azure blob storage.

To import a database using the Azure portal, open the page for the server (not the page for the database) to associate the database to and then click Import on the toolbar. Specify the storage account and container and select the BACPAC file you want to import. Select the size of the new database (usually the same as origin) and provide the destination SQL Server credentials.

Database import

To monitor the progress of the import operation, open the page for the logical server containing the database being imported. Scroll down to Operations and then click Import/Export history.


Azure SQL Database Managed Instance supported importing from a BACPAC file using the other methods in this article but does not currently support migrating using the Azure portal.

Monitor the progress of an import operation

To monitor the progress of the import operation, open the page for the logical server into which the database is being imported. Scroll down to Operations and then click Import/Export history.

import import status

To verify the database is live on the server, click SQL databases and verify the new database is Online.

Import from a BACPAC file using SQLPackage

To import a SQL database using the SqlPackage command-line utility, see Import parameters and properties. The SQLPackage utility ships with the latest versions of SQL Server Management Studio and SQL Server Data Tools for Visual Studio, or you can download the latest version of SqlPackage directly from the Microsoft download center.

We recommend the use of the SQLPackage utility for scale and performance in most production environments. For a SQL Server Customer Advisory Team blog about migrating using BACPAC files, see Migrating from SQL Server to Azure SQL Database using BACPAC Files.

See the following SQLPackage command for a script example for how to import the AdventureWorks2008R2 database from local storage to an Azure SQL Database logical server, called mynewserver20170403 in this example. This script shows the creation of a new database called myMigratedDatabase, with a service tier of Premium, and a Service Objective of P6. Change these values as appropriate to your environment.

SqlPackage.exe /a:import /tcs:"Data;Initial Catalog=myMigratedDatabase;User Id=ServerAdmin;Password=<change_to_your_password>" /sf:AdventureWorks2008R2.bacpac /p:DatabaseEdition=Premium /p:DatabaseServiceObjective=P6


An Azure SQL Database logical server listens on port 1433. If you are attempting to connect to an Azure SQL Database logical server from within a corporate firewall, this port must be open in the corporate firewall for you to successfully connect.

This example shows how to import a database using SqlPackage.exe with Active Directory Universal Authentication:

SqlPackage.exe /a:Import /sf:testExport.bacpac /tdn:NewDacFX / /ua:True /tid:""

Import from a BACPAC file using PowerShell

Use the New-AzureRmSqlDatabaseImport cmdlet to submit an import database request to the Azure SQL Database service. Depending on the size of your database, the import operation may take some time to complete.

$importRequest = New-AzureRmSqlDatabaseImport -ResourceGroupName "myResourceGroup" `
   -ServerName $servername `
   -DatabaseName "MyImportSample" `
   -DatabaseMaxSizeBytes "262144000" `
   -StorageKeyType "StorageAccessKey" `
   -StorageKey $(Get-AzureRmStorageAccountKey -ResourceGroupName "myResourceGroup" -StorageAccountName $storageaccountname).Value[0] `
   -StorageUri "http://$" `
   -Edition "Standard" `
   -ServiceObjectiveName "P6" `
   -AdministratorLogin "ServerAdmin" `
   -AdministratorLoginPassword $(ConvertTo-SecureString -String "ASecureP@assw0rd" -AsPlainText -Force)

To check the status of the import request, use the Get-AzureRmSqlDatabaseImportExportStatus cmdlet. Running this immediately after the request usually returns Status: InProgress. When you see Status: Succeeded the import is complete.

$importStatus = Get-AzureRmSqlDatabaseImportExportStatus -OperationStatusLink $importRequest.OperationStatusLink
while ($importStatus.Status -eq "InProgress")
    $importStatus = Get-AzureRmSqlDatabaseImportExportStatus -OperationStatusLink $importRequest.OperationStatusLink
    Start-Sleep -s 10


For another script example, see Import a database from a BACPAC file.


  • Import to a database in elastic pool is not supported. You can import data into a single database and then move the database to a pool.

Import using other methods

You can also use these wizards:

Next steps