Share via

Database transfer to my local system

Ajay Prajapati 0 Reputation points
2026-04-22T07:26:59.3766667+00:00

I need to transfer a database from Azure to my local system, but I’m facing some issues. Could you please help me with this?

Azure SQL Database

2 answers

Sort by: Most helpful
  1. Manoj Kumar Boyini 13,930 Reputation points Microsoft External Staff Moderator
    2026-04-22T22:42:05.1266667+00:00

    Hi Ajay Prajapati

    Transferring an Azure SQL Database down to your local SQL Server is pretty common and there are a few different ways to go about it. The most popular approach is to export a BACPAC (schema + data) from Azure, download it to your machine, and then import it into your local instance. Here’s a quick rundown of the main options:

    Export/Import a BACPAC via SSMS or the Azure portal
    • In SSMS (connected to your Azure SQL DB):
    – Right-click the database > Tasks > Export Data-tier Application > follow the wizard to save a .bacpac to an Azure storage account.
    – Download the .bacpac locally (e.g. with Azure Storage Explorer).
    • In SSMS (connected to your local SQL Server):
    – Right-click your target server > Tasks > Import Data-tier Application > pick the .bacpac file and go through the wizard.

    Use SqlPackage.exe on the command line
    • Export from Azure:
    SqlPackage /Action:Export /SourceServerName: /SourceDatabaseName: /TargetFile:"C:\temp<dbName>.bacpac" …
    • Import to local:
    SqlPackage /Action:Import /SourceFile:"C:\temp<dbName>.bacpac" /TargetServerName:localhost /TargetDatabaseName: …

    Generate scripts in SSMS (schema + data)
    • Right-click the Azure DB > Tasks > Generate Scripts > choose both schema and data.
    • Run the resulting script against your local SQL instance.

    Bulk-copy with bcp or Azure Data Factory
    • Use the bcp utility to dump table data into files and then bulk-load into your local instance.
    • Or set up a simple Copy Activity in Azure Data Factory with a Self-Hosted Integration Runtime pointing at your on-prem server.

    A few things to watch out for:

    • Make sure your Azure SQL server firewall allows either your client IP (for SSMS/SqlPackage) or the storage account (for exporting bacpac).
    • Port 1433 needs to be open if you’re connecting directly.
    • If you hit errors during export/import (timeout, permission, TDE key mismatch, etc.), share the exact message—there are well-documented troubleshooting steps for each.

    Hope this helps you get the database down locally! If you’re still seeing errors, could you let us know:

    • Which method you tried (BACPAC, SqlPackage, bcp, etc.)
    • The exact error message you’re seeing
    • Your local SQL Server version and SSMS version

    References
    • Export/Import a BACPAC: https://learn.microsoft.com/azure/azure-sql/database/database-export
    • SqlPackage command-line: https://learn.microsoft.com/sql/tools/sqlpackage
    • Generate Scripts in SSMS: https://learn.microsoft.com/sql/ssms/scripting/generate-scripts
    • bcp utility: https://learn.microsoft.com/sql/tools/bcp-utility
    • Azure Data Factory Copy activity: https://learn.microsoft.com/azure/data-factory/copy-activity-overview

    Hope this helps, Please let us know if you have any questions and concerns.


  2. Q&A Assist
    2026-04-22T07:27:13.2366667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To transfer a database from Azure SQL Database to a local SQL Server instance, use one of the supported export/import methods based on BACPAC or bulk tools.

    A practical end-to-end approach is:

    1. Export the Azure SQL Database to a BACPAC file
      • In the Azure portal, open the Azure SQL Database.
      • Select Export.
      • Choose a Storage account and container where the BACPAC file will be stored.
      • Provide authentication as required (the portal uses the Azure SQL Import/Export service; Managed Identity authentication is in preview).
      • Wait for the export to complete. Status and history are visible under Import/Export history on the logical server.
    2. Download the BACPAC file
      • In the Azure portal, go to the Storage account and container selected during export.
      • Download the BACPAC file to the local machine where SQL Server is installed.
    3. Import the BACPAC into local SQL Server
      • On the local machine, open SQL Server Management Studio (SSMS).
      • Connect to the local SQL Server instance.
      • Right-click DatabasesImport Data-tier Application.
      • Select the downloaded BACPAC file.
      • Follow the wizard to create a new database from the BACPAC.
    4. Consider performance and resource limits
      • Import/export operations consume DTUs/CPU on Azure SQL Database and can be throttled if the database is at its resource limits. If needed, temporarily upgrade the Azure SQL Database service tier to add more resources before export.
      • For large databases, run client tools (for example, sqlpackage or SSMS) from a VM in the same Azure region as the database to reduce network latency during export.
      • Large tables without clustered indexes can export very slowly or fail; adding appropriate clustered indexes before export can improve reliability.
    5. Alternative tooling options
      • Instead of the Azure portal, export/import can also be done using:
        • sqlpackage (command-line) to create and import BACPAC files.
        • Visual Studio Code with the mssql extension.
        • Custom code using the DacFx API (Microsoft.SqlServer.Dac).

    If the target is an on-premises SQL Server instance, ensure the SQL Server version is compatible with the schema and features used in Azure SQL Database. For complex databases or when encountering compatibility issues, review T-SQL differences and discontinued features, or consider Azure SQL Managed Instance for higher compatibility.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.