Solved

Azure SQL Database backup fails with "The storage account cannot be accessed"

  • 8 January 2021
  • 1 reply
  • 3570 views

Userlevel 2
Badge +4

Hi CV!

I have an Azure SQL Database backup failing with the below errors in the Job Details: 
Error Code: [30:414] Description: Failed to export Azure database [AzureDbName] to Azure storage. Please look at the SQLiDA log for more details. Source: AzureSQLProxyCilent, Process: SQLiDA 
 

Checking the SQLiDA.log I can see that the database copy operation in the SQL Instance is succeeding, however exporting the BACPAC to the Azure Storage account configured in the agent properties is failing with the below error: 
The storage account cannot be accessed. Please check the storage account name and key and try again. 

 

SQLiDA.log shows errors trying to access the storage account. 

10332 4     10/27 20:00:25 412305 ### CvAzureSQL.AzureSQL.LoggerDebug - Starting to copy from db [AzureDbName] to copied db [cv_copy_1603854025346_AzureDbName] in server [SQLAZUREVM]. 

10332 4     10/27 20:01:47 412305 ### CvAzureSQL.AzureSQL.LoggerDebug - Finished copying from db [AzureDbName] to copied db [cv_copy_1603854025346_AzureDbName] in server [SQLAZUREVM]. 

10332 4     10/27 20:01:47 412305 ### CvAzureSQL.AzureSQL.LoggerDebug - Starting to export from db [cv_copy_1603854025346_AzureDbName] to bacpac [AzureDbName.1603854025346.1603854107882.0.bacpac] in server [SQLAZUREVM.database.windows.net]. 

10332 2568  10/27 20:02:04 412305 CAzureSQLBackup::doAzureDBBackup(148): -Error-: Do SQL DB Backup Failed with error [The storage account cannot be accessed. Please check the storage account name and key and try again. 

System.Net.WebException: The remote server returned an error: (400) Bad Request. 

   at System.Net.HttpWebRequest.GetResponse() 

   at CvAzureSQL.AzureSQLRM.requestRESTAPI(String sMethod, String sRequest, String sBody) 

  at CvAzureSQL.AzureSQLRM.requestExportDB(String sFullyQualifiedServerName, ExportRequest export Req, String sDBName, String& sStatusURL) ]. 

10332 2568  10/27 20:02:04 412305 CAzureSQLCommon::initializeCOM() -  - Already initialized. 

10332 2568  10/27 20:02:04 412305 CAzureSQLCommon::setAzureADAccount(1928): -Debug-: Active Direcotry authentication credentials are not set for clientId [69]. 

10332 2568  10/27 20:02:04 412305 CSQLBackup::runAzureDBBackupInThread(2140): -Error-: Failed to backup database[AzureDbName]. 

 

Any ideas on how to fix this please? 

icon

Best answer by Daniel Brouwer 8 January 2021, 16:15

View original

1 reply

Userlevel 1
Badge +4

This could be due to a Microsoft limitation when attempting to export from SQL on Azure to an Azure Storage account which has firewall enabled.

As per the Microsoft documentation article on exporting to a BACPAC file

  • Storage behind a firewall is currently not supported.

At this time, we need to make sure that the Storage Account is set to allow All Networks through its firewall.

By default, Azure SQL Database does not get a private network to operate on and so cannot be added to the allowed networks in the Storage Account firewall.

Similarly, allowing Microsoft Trusted Services to access storage does not seem to allow access to the storage account.

Note: This does not apply to Azure SQL Managed Instance, which is assigned a private network IP by default.

Reply