24

Export Azure SQL Database | Advanced Scenarios

 2 years ago
source link: https://techcommunity.microsoft.com/t5/azure-database-support-blog/export-azure-sql-database-advanced-scenarios/ba-p/3125132?WT_mc_id=DOP-MVP-4025064
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Export Azure SQL Database

Export Azure SQL Database | Advanced Scenarios

Published Feb 21 2022 04:31 AM 914 Views

Introduction:

Export Azure SQL Database is a common request for Azure SQL DB customers, in this article we are going to list down some advanced scenarios, on how this can be achievable through various tools not limited to Azure Portal, Azure CLI and PowerShell. In addition, this article will provide alternative methods when it comes to private endpoints and deny public access.



Scenarios:

In this section, we are going through the scenarios and provide a thoughtful insights on each one. 



This can be a seamless solution to do the database export when the SQL server allows the public access, untoggled the Deny public access option on SQL DB Azure portal, otherwise you might get error like:



An unexpected error was returned by the SQL engine while preparing the operation inputs. Error: 47073, State: 1.

To overcome such error, you can TEMPORARY set deny public access to NO during the export operation.  Note:- You don’t need to worry, if you set “Deny public access” to “No” it doesn’t mean that everyone will be able to connect from outside; you still can restrict the access using the database firewall. You can find more information at:  

Connectivity settings for Azure SQL Database and Azure Synapse Analytics - Azure SQL Database and Az...



You can use Export REST API  to export the database, this can be done programmatically, or from tools like Postman, Also you can try this from Azure Documentation using the >try it button, More information can be found at: Databases - Export - REST API (Azure SQL Database) | Microsoft Docs



Here is an example using postman:





Request Body:



{
  "storageKeyType": "StorageAccessKey",
  "storageKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= =",
  "storageUri": https://xxxxxxxxxxxxxxxxx.blob.core.windows.net/testc,
  "administratorLogin": "xxxxxxxxxxxx",
  "administratorLoginPassword": "xxxxxxxxxxxxxx",
  "authenticationType": "Sql",
  "networkIsolation": {
    "sqlServerResourceId": "/subscriptions/xxxxxxxxxxxxx/resourceGroups/customer/providers/Microsoft.Sql/servers/xxxxxxxxx",
"storageAccountResourceId": "/subscriptions/xxxxxxxxxxx/resourceGroups/customer/providers/Microsoft.Storage/storageAccounts/xxxxxxxxx"
  }
}


Below error may occur if the Deny public access is enabled, the solution is to enable the public access temporarily  

{"error":{"code":"ResourceNotFound","message":"The specified resource 'https://management.northeurope.control.database.windows.net/modules/AzureResourceManager.dsts/subscriptions/<yoursubscriptionid>/resourceGroups/customer/providers/Microsoft.Sql/servers/<servername>/databases/<dbname>/export?api-version=2021-02-01-preview ' was not found."}}



Note:- networkisolation setting, this feature is currently under development and not ready for public consumption. More information can be found at:

New-AzSqlDatabaseExport with network isolation · Discussion #13937 · Azure/azure-powershell · GitHub

Error when calling New-AzSqlDatabaseExport with UseNetworkIsolation on $true · Issue #13964 · Azure/...



This can be a best bet solution for many scenarios to overcome limitations on the database size and also to export SQL DB via private endpoint through a VM running in the same VNET. 



Note:- you can export to local disk or Azure File Share, but you cannot use Azure Blob, for details can be found at Lesson Learned #25: Export/Import Azure SQL Database using Azure File Service? - Microsoft Tech Comm... 



Therefore, you can export the .bacpac locally/File share on the VM in the same VNET as the private endpoint of the SQL Server using SQLPackage.exe/SSMS then copy the bacpac to Azure blob (if required).



You can make use SQL Server Management Studio Export data-tier application wizard to export the Azure SQL database to a .bacpac file. The .bacpac can be stored into Azure blob storage or file share.



Right click on the SQL Database on logical SQL Server from SSMS --> Tasks --> Select 'Export data-tier application' wizard.



Select the location to store the BACPAC file 





You can select the subset of the tables from export setting in Advance tab --> Click Next to view the summary of export. One you click finish. And up on completion of the process you will be able to view the BACPAC file in the specified destination.







More information at blog:

Using data-tier applications (BACPAC) to migrate a database from Managed Instance to SQL Server - Mi...



The New-AzSqlDatabaseExport cmdlet can be used to export database request to the Azure SQL Database service. Make a note that you have to enable public access to export the database via this method. With Deny public access set to YES, you might encounter below error.



PowerShell command to export the database. 



Command to export the database via PS : 
New-AzSqlDatabaseExport -ResourceGroupName "customer" -ServerName "<your server name>" -DatabaseName "<your db name>" -StorageKeyType "StorageAccessKey" -StorageKey "<your storage access key>" -StorageUri "https://xxxxxxxxxxxxxxxxx.blob.core.windows.net/testc/database01.bacpac"  -AdministratorLogin "<your login name>"


To check the status of the export request, use the Get-AzSqlDatabaseImportExportStatus cmdlet.



Get-AzSqlDatabaseImportExportStatus -OperationStatusLink https://management.azure.com/subscriptions/71095335-fafc-4b21-a692-5a7723553133/providers/Microsoft.Sql/locations/northeurope/importExportOperationResults/xxxxxxx-xxxxxxx?api-version=2021-02-01-preview


Use the Database Operations - Cancel API or the PowerShell Stop-AzSqlDatabaseActivity command to cancel an export request.



Stop-AzSqlDatabaseActivity -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName -OperationId $Operation.OperationId


Please make a note of some of the considerations when using PowerShell method. Also check Azure SQL CLI at: az sql db | Microsoft Docs



You can use copy database from Azure portal to copy the database to the different server, then perform the export to Azure Blob, later on you can clean up the copied database 



This can also be automated as well, more information can be found at Blog: How to automate Export Azure SQL DB to blob storage use Automation account - Microsoft Tech Communit...



Additional References:

Export a database to a BACPAC file - Azure SQL Database & Azure SQL Managed Instance | Microsoft Doc...

Using Azure Import/Export to transfer data to and from Azure Storage | Microsoft Docs

Configure Azure Storage firewalls and virtual networks | Microsoft Docs

Connectivity settings for Azure SQL Database and Azure Synapse Analytics - Azure SQL Database and Az...

Automate native database backup of Azure SQL Managed instance to Azure blob storage - Microsoft Tech...



Disclaimer

Please note that products and options presented in this article are subject to change. This article reflects the database export options available for Azure SQL database in February, 2022.



Closing remarks

We hope you find this article helpful. If you have any feedback, please do not hesitate to provide it in the comment section below.



Abhishek Shaha (Author)

Ahmed Mahmoud (Co-Author)

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

%3CLINGO-SUB%20id%3D%22lingo-sub-3125132%22%20slang%3D%22en-US%22%3EExport%20Azure%20SQL%20Database%20%7C%20Advanced%20Scenarios%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3125132%22%20slang%3D%22en-US%22%3E%3CP%3E%3CFONT%20size%3D%225%22%3EIntroduction%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EExport%20Azure%20SQL%20Database%20is%20a%20common%20request%20for%20Azure%20SQL%20DB%20customers%2C%20in%20this%20article%20we%20are%20going%20to%20list%20down%20some%20advanced%20scenarios%2C%20on%20how%20this%20can%20be%20achievable%20through%20various%20tools%20not%20limited%20to%20Azure%20Portal%2C%20Azure%20CLI%20and%20PowerShell.%20In%20addition%2C%20this%20article%20will%20provide%20alternative%20methods%20when%20it%20comes%20to%20private%20endpoints%20and%20deny%20public%20access.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EScenarios%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIn%20this%20section%2C%20we%20are%20going%20through%20the%20scenarios%20and%20provide%20a%20thoughtful%20insights%20on%20each%20one.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EExport%20via%20Azure%20Portal%20to%20Storage%20Account%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThis%20can%20be%20a%20seamless%20solution%20to%20do%20the%20database%20export%20when%20the%20SQL%20server%20allows%20the%20public%20access%2C%20untoggled%20the%20Deny%20public%20access%20option%20on%20SQL%20DB%20Azure%20portal%2C%20otherwise%20you%20might%20get%20error%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23870C25%22%3E%3CEM%3EAn%20unexpected%20error%20was%20returned%20by%20the%20SQL%20engine%20while%20preparing%20the%20operation%20inputs.%20%3CSTRONG%3EError%3A%2047073%2C%20State%3A%201%3C%2FSTRONG%3E.%3C%2FEM%3E%3C%2FFONT%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3ETo%20overcome%20such%20error%2C%20you%20can%26nbsp%3B%3CEM%3ETEMPORARY%26nbsp%3B%3C%2FEM%3Eset%20deny%20public%20access%20to%20NO%20during%20the%20export%20operation.%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3E%3CSTRONG%3ENote%3A-%3C%2FSTRONG%3E%20You%20don%E2%80%99t%20need%20to%20worry%2C%20if%20you%20set%20%E2%80%9CDeny%20public%20access%E2%80%9D%20to%20%E2%80%9CNo%E2%80%9D%20it%20doesn%E2%80%99t%20mean%20that%20everyone%20will%20be%20able%20to%20connect%20from%20outside%3B%20you%20still%20can%20restrict%20the%20access%20using%20the%20database%20firewall.%20You%20can%20find%20more%20information%20at%3A%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fdatabase%2Fconnectivity-settings%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EConnectivity%20settings%20for%20Azure%20SQL%20Database%20and%20Azure%20Synapse%20Analytics%20-%20Azure%20SQL%20Database%20and%20Azure%20Synapse%20Analytics%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EExport%20via%20REST%20API%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20data-unlink%3D%22true%22%3EYou%20can%20use%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Frest%2Fapi%2Fsql%2F2021-08-01-preview%2Fdatabases%2Fexport%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EExport%20REST%20API%3C%2FA%3E%26nbsp%3B%20to%20export%20the%20database%2C%20this%20can%20be%20done%20programmatically%2C%20or%20from%20tools%20like%20Postman%2C%20Also%20you%20can%20try%20this%20from%20Azure%20Documentation%20using%20the%20%3CFONT%20color%3D%22%23008000%22%3E%3CSTRONG%3E%26gt%3Btry%20it%3C%2FSTRONG%3E%20%3C%2FFONT%3Ebutton%2C%20More%20information%20can%20be%20found%20at%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Frest%2Fapi%2Fsql%2F2021-08-01-preview%2Fdatabases%2Fexport%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EDatabases%20-%20Export%20-%20REST%20API%20(Azure%20SQL%20Database)%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20is%20an%20example%20using%20postman%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Ahmed_S_Mahmoud_0-1644234395285.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F345810i0741C4E5347913D9%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Ahmed_S_Mahmoud_0-1644234395285.png%22%20alt%3D%22Ahmed_S_Mahmoud_0-1644234395285.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERequest%20Body%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%22storageKeyType%22%3A%20%22StorageAccessKey%22%2C%0A%20%20%22storageKey%22%3A%20%22xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%3D%20%3D%22%2C%0A%20%20%22storageUri%22%3A%20https%3A%2F%2Fxxxxxxxxxxxxxxxxx.blob.core.windows.net%2Ftestc%2C%0A%20%20%22administratorLogin%22%3A%20%22xxxxxxxxxxxx%22%2C%0A%20%20%22administratorLoginPassword%22%3A%20%22xxxxxxxxxxxxxx%22%2C%0A%20%20%22authenticationType%22%3A%20%22Sql%22%2C%0A%20%20%22networkIsolation%22%3A%20%7B%0A%20%20%20%20%22sqlServerResourceId%22%3A%20%22%2Fsubscriptions%2Fxxxxxxxxxxxxx%2FresourceGroups%2Fcustomer%2Fproviders%2FMicrosoft.Sql%2Fservers%2Fxxxxxxxxx%22%2C%0A%22storageAccountResourceId%22%3A%20%22%2Fsubscriptions%2Fxxxxxxxxxxx%2FresourceGroups%2Fcustomer%2Fproviders%2FMicrosoft.Storage%2FstorageAccounts%2Fxxxxxxxxx%22%0A%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBelow%20error%20may%20occur%20if%20the%20Deny%20public%20access%20is%20enabled%2C%20the%20solution%20is%20to%20enable%20the%20public%20access%26nbsp%3B%3CFONT%20color%3D%22%23333333%22%3Etemporarily%3C%2FFONT%3E%20%3CBR%20%2F%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20data-unlink%3D%22true%22%3E%3CFONT%20color%3D%22%23800000%22%3E%7B%22error%22%3A%7B%22code%22%3A%22%3CSTRONG%3EResourceNotFound%22%2C%22message%22%3A%22%3C%2FSTRONG%3EThe%20specified%20resource%20'https%3A%2F%2Fmanagement.northeurope.control.database.windows.net%2Fmodules%2FAzureResourceManager.dsts%2Fsubscriptions%2F%3CYOURSUBSCRIPTIONID%3E%2FresourceGroups%2Fcustomer%2Fproviders%2FMicrosoft.Sql%2Fservers%2F%3CSERVERNAME%3E%2Fdatabases%2F%3CDBNAME%3E%2Fexport%3Fapi-version%3D2021-02-01-preview%26nbsp%3B'%20was%20not%20found.%22%7D%7D%3C%2FDBNAME%3E%3C%2FSERVERNAME%3E%3C%2FYOURSUBSCRIPTIONID%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20data-unlink%3D%22true%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20data-unlink%3D%22true%22%3E%3CSTRONG%3ENote%3A-%26nbsp%3B%3C%2FSTRONG%3Enetworkisolation%20setting%2C%20this%20feature%20is%20currently%20under%20development%20and%20not%20ready%20for%20public%20consumption.%20More%20information%20can%20be%20found%20at%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fazure-powershell%2Fdiscussions%2F13937%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ENew-AzSqlDatabaseExport%20with%20network%20isolation%20%C2%B7%20Discussion%20%2313937%20%C2%B7%20Azure%2Fazure-powershell%20%C2%B7%20GitHub%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fazure-powershell%2Fissues%2F13964%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EError%20when%20calling%20New-AzSqlDatabaseExport%20with%20UseNetworkIsolation%20on%20%24true%20%C2%B7%20Issue%20%2313964%20%C2%B7%20Azure%2Fazure-powershell%20%C2%B7%20GitHub%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EExport%20via%20SQLPackage%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThis%20can%20be%20a%20best%20bet%20solution%20for%20many%20scenarios%20to%20overcome%20limitations%20on%20the%20database%20size%20and%20also%20to%20export%20SQL%20DB%20via%20private%20endpoint%20through%20a%20VM%20running%20in%20the%20same%20VNET.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENote%3A-%3C%2FSTRONG%3E%20you%20can%20export%20to%20local%20disk%20or%20Azure%20File%20Share%2C%20but%20you%20cannot%20use%20Azure%20Blob%2C%20for%20details%20can%20be%20found%20at%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-database-support-blog%2Flesson-learned-25-export-import-azure-sql-database-using-azure%2Fba-p%2F368872%22%20target%3D%22_blank%22%3ELesson%20Learned%20%2325%3A%20Export%2FImport%20Azure%20SQL%20Database%20using%20Azure%20File%20Service%3F%20-%20Microsoft%20Tech%20Community%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETherefore%2C%20you%20can%20export%20the%20.bacpac%20locally%2FFile%20share%20on%20the%20VM%20in%20the%20same%20VNET%20as%20the%20private%20endpoint%20of%20the%20SQL%20Server%20using%20SQLPackage.exe%2FSSMS%20then%20copy%20the%20bacpac%20to%20Azure%20blob%20(if%20required).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EExport%20via%26nbsp%3BSQL%20server%20Management%20Studio%20%3A%26nbsp%3B%3C%2FSTRONG%3E%3CFONT%20color%3D%22%23000000%22%3EExport%20using%20SSMS%20from%20the%20VM%20running%20in%20the%20same%20VNET%20as%20a%20private%20endpoint%20from%20SQL%20to%20blob%20storage%2F%20file%20share%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%20color%3D%22%23000000%22%3EYou%20can%20make%20use%20SQL%20Server%20Management%20Studio%20Export%20data-tier%20application%20wizard%20to%20export%20the%20Azure%20SQL%20database%20to%20a%20.bacpac%20file.%20The%20.bacpac%20can%20be%20stored%20into%20Azure%20blob%20storage%20or%20file%20share.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23000000%22%3ERight%20click%20on%20the%20SQL%20Database%20on%20logical%20SQL%20Server%20from%20SSMS%20--%26gt%3B%20Tasks%20--%26gt%3B%20Select%20'Export%20data-tier%20application'%20wizard.%3CBR%20%2F%3E%3C%2FFONT%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22abhishekshaha_0-1645200192190.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F349507i30A1A3AAB5F08001%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22abhishekshaha_0-1645200192190.png%22%20alt%3D%22abhishekshaha_0-1645200192190.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESelect%20the%20location%20to%20store%20the%20BACPAC%20file%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22abhishekshaha_2-1645200707114.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F349509iFCCB1E435060F590%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22abhishekshaha_2-1645200707114.png%22%20alt%3D%22abhishekshaha_2-1645200707114.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20select%20the%20subset%20of%20the%20tables%20from%20export%20setting%20in%20Advance%20tab%20--%26gt%3B%20Click%20Next%20to%20view%20the%20summary%20of%20export.%20One%20you%20click%20finish.%20And%20up%20on%20completion%20of%20the%20process%20you%20will%20be%20able%20to%20view%20the%20BACPAC%20file%20in%20the%20specified%20destination.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22abhishekshaha_4-1645200829384.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F349513iF1434A664FC4331E%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22abhishekshaha_4-1645200829384.png%22%20alt%3D%22abhishekshaha_4-1645200829384.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMore%20information%20at%20blog%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sql-blog%2Fusing-data-tier-applications-bacpac-to-migrate-a-database-from%2Fba-p%2F2335643%22%20target%3D%22_blank%22%3EUsing%20data-tier%20applications%20(BACPAC)%20to%20migrate%20a%20database%20from%20Managed%20Instance%20to%20SQL%20Server%20-%20Microsoft%20Tech%20Community%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EExport%20via%20Powershell%2F%20CLI%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20New-AzSqlDatabaseExport%20cmdlet%20can%20be%20used%20to%20export%20database%20request%20to%20the%20Azure%20SQL%20Database%20service.%20Make%20a%20note%20that%20you%20have%20to%20enable%20public%20access%20to%20export%20the%20database%20via%20this%20method.%26nbsp%3BWith%20Deny%20public%20access%20set%20to%20YES%2C%20you%20might%20encounter%20below%20error.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Ahmed_S_Mahmoud_1-1644235189436.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F345813iD0932B7E36AECDC4%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Ahmed_S_Mahmoud_1-1644235189436.png%22%20alt%3D%22Ahmed_S_Mahmoud_1-1644235189436.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EPowerShell%20command%20to%20export%20the%20database.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3ECommand%20to%20export%20the%20database%20via%20PS%20%3A%20%0ANew-AzSqlDatabaseExport%20-ResourceGroupName%20%22customer%22%20-ServerName%20%22%3CYOUR%20server%3D%22%22%20name%3D%22%22%3E%22%20-DatabaseName%20%22%3CYOUR%20db%3D%22%22%20name%3D%22%22%3E%22%20-StorageKeyType%20%22StorageAccessKey%22%20-StorageKey%20%22%3CYOUR%20storage%3D%22%22%20access%3D%22%22%20key%3D%22%22%3E%22%20-StorageUri%20%22https%3A%2F%2Fxxxxxxxxxxxxxxxxx.blob.core.windows.net%2Ftestc%2Fdatabase01.bacpac%22%20%20-AdministratorLogin%20%22%3CYOUR%20login%3D%22%22%20name%3D%22%22%3E%22%0A%3C%2FYOUR%3E%3C%2FYOUR%3E%3C%2FYOUR%3E%3C%2FYOUR%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20check%20the%20status%20of%20the%20export%20request%2C%20use%20the%20Get-AzSqlDatabaseImportExportStatus%20cmdlet.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EGet-AzSqlDatabaseImportExportStatus%20-OperationStatusLink%20https%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F71095335-fafc-4b21-a692-5a7723553133%2Fproviders%2FMicrosoft.Sql%2Flocations%2Fnortheurope%2FimportExportOperationResults%2Fxxxxxxx-xxxxxxx%3Fapi-version%3D2021-02-01-preview%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUse%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Frest%2Fapi%2Fsql%2Fdatabaseoperations%2Fcancel%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EDatabase%20Operations%20-%20Cancel%20API%3C%2FA%3E%26nbsp%3Bor%20the%20PowerShell%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faz.sql%2FStop-AzSqlDatabaseActivity%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EStop-AzSqlDatabaseActivity%20command%3C%2FA%3E%26nbsp%3Bto%20cancel%20an%20export%20request.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EStop-AzSqlDatabaseActivity%20-ResourceGroupName%20%24ResourceGroupName%20-ServerName%20%24ServerName%20-DatabaseName%20%24DatabaseName%20-OperationId%20%24Operation.OperationId%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20make%20a%20note%20of%20some%20of%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fdatabase%2Fdatabase-export%23considerations%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Econsiderations%3C%2FA%3E%20when%20using%20PowerShell%20method.%20Also%20check%20Azure%20SQL%20CLI%20at%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Fsql%2Fdb%3Fview%3Dazure-cli-latest%23az-sql-db-export%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eaz%20sql%20db%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EDatabase%20Copy%26nbsp%3B%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EYou%20can%20use%20copy%20database%20from%20Azure%20portal%20to%20copy%20the%20database%20to%20the%20different%20server%2C%20then%20perform%20the%20export%20to%20Azure%20Blob%2C%20later%20on%20you%20can%20clean%20up%20the%20copied%20database%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20can%20also%20be%20automated%20as%20well%2C%20more%20information%20can%20be%20found%20at%20Blog%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-database-support-blog%2Fhow-to-automate-export-azure-sql-db-to-blob-storage-use%2Fba-p%2F368864%22%20target%3D%22_blank%22%3EHow%20to%20automate%20Export%20Azure%20SQL%20DB%20to%20blob%20storage%20use%20Automation%20account%20-%20Microsoft%20Tech%20Community%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3E%3CEM%3EAdditional%20References%3A%3C%2FEM%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fdatabase%2Fdatabase-export%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EExport%20a%20database%20to%20a%20BACPAC%20file%20-%20Azure%20SQL%20Database%20%26amp%3B%20Azure%20SQL%20Managed%20Instance%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20style%3D%22font-family%3A%20inherit%3B%20background-color%3A%20%23ffffff%3B%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fimport-export%2Fstorage-import-export-service%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EUsing%20Azure%20Import%2FExport%20to%20transfer%20data%20to%20and%20from%20Azure%20Storage%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Fcommon%2Fstorage-network-security%3Ftabs%3Dazure-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EConfigure%20Azure%20Storage%20firewalls%20and%20virtual%20networks%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fdatabase%2Fconnectivity-settings%23deny-public-network-access%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EConnectivity%20settings%20for%20Azure%20SQL%20Database%20and%20Azure%20Synapse%20Analytics%20-%20Azure%20SQL%20Database%20and%20Azure%20Synapse%20Analytics%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-database-support-blog%2Fautomate-native-database-backup-of-azure-sql-managed-instance-to%2Fba-p%2F3067092%22%20target%3D%22_blank%22%3EAutomate%20native%20database%20backup%20of%20Azure%20SQL%20Managed%20instance%20to%20Azure%20blob%20storage%20-%20Microsoft%20Tech%20Community%3C%2FA%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20SegoeUI%3B%20font-size%3A%2018.0pt%3B%20color%3A%20%23333333%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20SegoeUI%3B%20font-size%3A%2018.0pt%3B%20color%3A%20%23333333%3B%22%3E%3CFONT%20size%3D%225%22%3E%3CSPAN%20style%3D%22background%3A%20white%3B%22%3EDisclaimer%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20SegoeUI%3B%20font-size%3A%2012.0pt%3B%20color%3A%20%23333333%3B%22%3E%3CSPAN%20style%3D%22background%3A%20white%3B%22%3EPlease%20note%20that%20products%20and%20options%20presented%20in%20this%20article%20are%20subject%20to%20change.%20This%20article%20reflects%20the%20database%20export%20options%20available%20for%20Azure%20SQL%20database%20in%20February%2C%202022.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3E%3CSPAN%20style%3D%22background%3A%20white%3B%22%3EClosing%20remarks%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EWe%20hope%20you%20find%20this%20article%20helpful.%20If%20you%20have%20any%20feedback%2C%20please%20do%20not%20hesitate%20to%20provide%20it%20in%20the%20comment%20section%20below.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAbhishek%20Shaha%20(Author)%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAhmed%20Mahmoud%20(Co-Author)%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3125132%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESQL%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESQL%20Azure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESQL%20DB%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E

Version history
Last update:

‎Feb 21 2022 04:31 AM

Updated by:

Share


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK