Export Database to Storage account - Error "The ImportExport operation failed because the storage blob already exists."

Simona Pantini 65 Reputation points
2024-04-09T14:33:30.73+00:00

I'm trying to export a database, by running the command through an Automation Account. I gave the Automation Account access to the SQL Server and to the storage account.

This is the command:

New-AzSqlDatabaseExport -AuthenticationType Sql -ResourceGroupName $sourceResourceGroupName -ServerName $sourceServerName -DatabaseName $sourceDatabaseName -StorageKeytype "StorageAccessKey" -StorageKey $secureKey -StorageUri $storageUri  -AdministratorLogin $cred.UserName -AdministratorLoginPassword $sourceSecurePassword

When I try to run the runbook with this command, this error appears:

The ImportExport operation failed because the storage blob already exists.

I've already checked that all the parameters are correct and the container is empty: there isn't any blob in the container.
Both the storage account and the database have network restrictions, but they are on the same subnet and there is a private link between their private endopint.

How can I solve this?

Azure SQL Database
Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,538 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,201 questions
0 comments No comments
{count} votes

Accepted answer
  1. RahulRandive 10,486 Reputation points Volunteer Moderator
    2024-04-09T15:47:45.5433333+00:00

    Hi @Simona Pantini

    Is your Storage behind a firewall? if yes, it's currently not supported.

    Please check the below limitations.

    User's image Thank You


1 additional answer

Sort by: Most helpful
  1. Deepanshu katara 16,720 Reputation points MVP Moderator
    2024-04-09T15:17:39.04+00:00

    Hi, Welcome to MS Q&A

    The error message "The Import-export operation failed because the storage blob already exists" indicates that there might be a conflicting blob in the storage container with the same name as the one you're trying to export.

    Here are some steps you can take to troubleshoot and potentially resolve this issue

    Currently, the private link for import/export has the following limitations:

    1. Import or Export of a database from Azure SQL Managed Instance using PowerShell isn't currently supported.
    2. Check for Existing Blobs: Even if the container appears empty, there might be blobs with hidden or system properties. Use Azure Storage Explorer or another tool to inspect the container and ensure that there are no existing blobs with the same name as the one you're trying to export. If you find any, you may need to delete them or choose a different name for your export

    Reference Image and docs are below

    User's image

    https://learn.microsoft.com/en-us/azure/azure-sql/database/database-import-export-private-link?view=azuresql&source=recommendations

    Please check and let us know , kindly accept answer , if it helps, Thankyou!


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.