Import Export Service is now Generally Available on Azure SQL Hyperscale Database

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Community Hub.

We are excited to announce General Availability of Import Export service for Azure SQL Database Hyperscale service tier. In this blog we are going to see how to perform Import and Export operations on a Azure SQL Hyperscale database using Import Export service.

 

Import Export service is available on all service tiers of Azure SQL Database except for Hyperscale. With a recent upgrade to the service, it is now available on Hyperscale service tier. Users can now import their existing .bacpac files as Hyperscale databases and also export their existing Hyperscale database as .bacpac files into external storage.

 

On Hyperscale service tier, Import Export service offers same set of capabilities and experience that are available on other service tiers of Azure SQL Database.  

 

Steps to perform Import and Export operations on a Hyperscale database

Import Export service's existing Portal, PowerShell and Azure CLI experiences can be used to perform import and export operations on Hyperscale databases as well. Here are the steps to perform Import and Export operations:

 

Portal

Below are the steps to perform Import and Export operations using Azure Portal:

Import

  • To import from a BACPAC file into a new single database using the Azure portal, open the appropriate server page and then, on the toolbar, select Import database.

Sudhir_Raparla_0-1666778897502.png

 

 

  • Select the storage account and the container for the BACPAC file and then select the BACPAC file from which to import.
  • Click on Configure database and select Hyperscale (On-Demand scalable storage) for Service tier parameter. Provide the destination SQL Server credentials. For a list of possible values for a new database in Azure SQL Database, see Create Database.

Sudhir_Raparla_1-1666778897510.png

 

  • Click OK
  • To monitor an import's progress, open the database's server page, and, under Settings, select Import/Export history. When successful, the import has a Completed status.

Sudhir_Raparla_2-1666778897514.png

 

 

Export

  • To export a database using the Azure portal, open the page for your Hyperscale database and select Export on the toolbar.

Sudhir_Raparla_3-1666778897528.png

 

 

  • Specify the BACPAC filename, select an existing Azure storage account and container for the export, and then provide the appropriate credentials for access to the source database. A SQL Server admin login is needed here even if you are the Azure admin, as being an Azure admin does not equate to having admin permissions in Azure SQL Database

Sudhir_Raparla_4-1666778897531.png

 

  • Select OK
  • To monitor the progress of the export operation, open the page for the server containing the database being exported. Under Data management, select Import/Export history.

 

PowerShell

Below are PowerShell commands to perform Import and export operations.

Import

You can use New-AzSqlDatabaseImport PowerShell command to perform Import operation on a Hyperscale database. Here is a sample command:

 

$importRequest = New-AzSqlDatabaseImport -ResourceGroupName "<resourceGroupName>" ` -ServerName "<serverName>" -DatabaseName "<databaseName>" ` -DatabaseMaxSizeBytes "<databaseSizeInBytes>" -StorageKeyType "StorageAccessKey" ` -StorageKey $(Get-AzStorageAccountKey ` -ResourceGroupName "<resourceGroupName>" -StorageAccountName "<storageAccountName>").Value[0] ` -StorageUri "https://myStorageAccount.blob.core.windows.net/importsample/sample.bacpac" ` -Edition "Standard" -ServiceObjectiveName "P6" ` -AdministratorLogin "<userId>" ` -AdministratorLoginPassword $(ConvertTo-SecureString -String "<password>" -AsPlainText -Force)

 

 

You can use the Get-AzSqlDatabaseImportExportStatus cmdlet to check the import's progress. Running the cmdlet immediately after the request usually returns Status: InProgress. The import is complete when you see Status: Succeeded.

 

$importStatus = Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $importRequest.OperationStatusLink [Console]::Write("Importing") while ($importStatus.Status -eq "InProgress") { $importStatus = Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $importRequest.OperationStatusLink [Console]::Write(".") Start-Sleep -s 10 } [Console]::WriteLine("") $importStatus

 

 

Export

You can use New-AzSqlDatabaseExport PowerShell command to perform Export operation on a Hyperscale database. Here is a sample command:

 

$exportRequest = New-AzSqlDatabaseExport -ResourceGroupName $ResourceGroupName -ServerName $ServerName ` -DatabaseName $DatabaseName -StorageKeytype $StorageKeytype -StorageKey $StorageKey -StorageUri $BacpacUri ` -AdministratorLogin $creds.UserName -AdministratorLoginPassword $creds.Password

 

 

 

 

To check the status of the export request, use the Get-AzSqlDatabaseImportExportStatus cmdlet. Running this cmdlet immediately after the request usually returns Status: InProgress. When you see Status: Succeeded the export is complete. Here is a sample command to check status of Export operation:

 

 

$exportStatus = Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $exportRequest.OperationStatusLink [Console]::Write("Exporting") while ($exportStatus.Status -eq "InProgress") { Start-Sleep -s 10 $exportStatus = Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $exportRequest.OperationStatusLink [Console]::Write(".") } [Console]::WriteLine("") $exportStatus

 

 

Azure CLI

Below are Azure CLI commands to perform Import and Export operations:

Import

Use the az-sql-db-import command to submit an import database request. Depending on database size, the import may take some time to complete. Here is a sample CLI command to run import:

 

az sql db import -s myserver -n mydatabase -g mygroup -p password -u login --storage-key MYKEY== \ --storage-key-type StorageAccessKey \ --storage-uri https://myAccountName.blob.core.windows.net/myContainer/myBacpac.bacpac

 

 

Export

Use the az-sql-db-export command to submit an export database request. Depending on database size, the export may take some time to complete. Here is a sample CLI command to run export:

 

az sql db export -s myserver -n mydatabase -g mygroup -p password -u login \ --storage-key MYKEY== --storage-key-type StorageAccessKey \ --storage-uri https://myAccountName.blob.core.windows.net/myContainer/myBacpac.bacpac

 

 

More details on Import Export service, can be found in the documentation:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.