error while export database to a storage account

Ravi Deva 6 Reputation points
2020-07-27T09:14:25.093+00:00

Hi,

I am getting an while exporting the database to a storage account, allowed azure services to access the SQL in firewall rules
Below is the error ;

New-AzSqlDatabaseExport : 0: There was an error that occurred during this operation : '<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Error encountered during the service operation. ; Exception Microsoft.SqlServer.Management.Dac.Services.ServiceException:Unexpected exception encountered while retrieving metadata for blob 'https://dbstorage.blob.core.windows.net/cont1/27072020-1006.bacpac'.; Inner exception Microsoft.WindowsAzure.Storage.StorageException:The remote server returned an error: (403) Forbidden.; Inner exception System.Net.WebException:The remote server returned an error: (403) Forbidden.; </string>' At line:1 char:1 + New-AzSqlDatabaseExport -ResourceGroupName $ResourceGroupName -Server ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [New-AzSqlDatabaseExport], CloudException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.NewAzureSqlDatabaseExport

Azure SQL Database
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ravi Deva 6 Reputation points
    2020-07-29T07:06:08.693+00:00

    Hi,

    Issue is resolved, I have added the "-AuthenticationType Sql " parameter and it certainly resolved the issue.

    New-AzSqlDatabaseExport -AuthenticationType Sql -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName -StorageKeytype $StorageKeytype -StorageKey $StorageKey -StorageUri $bloburi -AdministratorLogin $creds.UserName -AdministratorLoginPassword $creds.Password

    1 person found this answer helpful.
    0 comments No comments

  2. Navtej Singh Saini 4,226 Reputation points Microsoft Employee Moderator
    2020-07-27T22:49:27.157+00:00

    @ravideva-7719

    Based on case verbatim we understood you are trying to export the database with network restrictions in storage account.

    We checked the previous issues raised with similar error and found this is not supported and we need to enable all networks in storage account to be able to export the Azure SQL database. This happens as IP address for Azure SQL is dynamic.

    There are list of IP ranges for Azure SQL databases but adding them to the network list will not be helpful as Database Export/Import operations will occur on the back end and it uses other Azure SQL services in the back end to process these requests. Hence only option here is to allow all networks in storage account firewalls. Apologize for the inconvenience but unfortunately that is by design limitation for now.

    Please try and if successful also post your feedback here - https://feedback.azure.com/forums/217298-storage as storage team will be able to see this and take action.

    Regards
    Navtej S


Your answer

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