title | description | services | ms.service | ms.subservice | ms.custom | ms.devlang | ms.topic | author | ms.author | ms.reviewer | ms.date |
---|---|---|---|---|---|---|---|---|---|---|---|
PowerShell: Import BACPAC file (Azure SQL Database) |
Azure PowerShell example script to import a BACPAC file into an Azure SQL Database |
sql-database |
sql-database |
data-movement |
load & move data, sqldbrb=1 |
PowerShell |
sample |
stevestein |
sstein |
carlrab |
05/24/2019 |
This PowerShell script example imports a database from a BACPAC file into an Azure SQL database.
[!INCLUDE quickstarts-free-trial-note] [!INCLUDE updated-for-az] [!INCLUDE cloud-shell-try-it.md]
If you choose to install and use the PowerShell locally, this tutorial requires AZ PowerShell 1.4.0 or later. If you need to upgrade, see Install Azure PowerShell module. If you are running PowerShell locally, you also need to run Connect-AzAccount
to create a connection with Azure.
[!code-powershell-interactivemain]
Use the following command to remove the resource group and all resources associated with it.
Remove-AzResourceGroup -ResourceGroupName $resourcegroupname
This script uses the following commands. Each command in the table links to command specific documentation.
Command | Notes |
---|---|
New-AzResourceGroup | Creates a resource group in which all resources are stored. |
New-AzSqlServer | Creates a server that hosts databases and elastic pools. |
New-AzSqlServerFirewallRule | Creates a server-level firewall rule for a server. |
New-AzSqlDatabaseImport | Imports a BACPAC file and create a new database on the server. |
Remove-AzResourceGroup | Deletes a resource group including all nested resources. |
For more information on the Azure PowerShell, see Azure PowerShell documentation.
Additional SQL Database PowerShell script samples can be found in the Azure SQL Database PowerShell scripts.