Azure SQL DB export to blob issue for container $root.

chrisrdba 471 Reputation points
2025-02-24T13:53:55.5633333+00:00

Greetings. Note this is for an Azure SQL DB, not SQL on Azure VM, but there's no tag for that.

Trying to export a SQL DB bacpac via powershell to a blob container and getting the message "The container $root specified for the operation was not found". Below is my code, thanks for looking.

$sourceServer = "myserver"
$sourceResourceGroup = "myRG"
$sourceDatabase = "awLT"
 
$targetServer = "myserver.database.windows.net"
$targetResourceGroup = "myRG"
$targetDatabase = "awLTDEV"
 
$resourceGroup = "myRG"  # Resource group for backup
$storageAccountName = "mystorageacct"
# Storage account access key that will have the backups
$storageKey = "mystoragekey”
# Container name that will have the backups
$containerName = "container"
# storage blob uri with the datetime
$storageUri = "
#Storage access key type
$storageKeyType = "StorageAccessKey"
#SQL Auth Username
$SQL_username = "myusername"
#SQL Auth Password
$SQL_secure_secret = ConvertTo-SecureString -String "blabla" -AsPlainText -Force
# Run the Export job with the required parameters
New-AzSqlDatabaseExport -ResourceGroupName $resourceGroup -ServerName $sourceServer -DatabaseName $sourceDatabase -StorageKeyType $storageKeyType -StorageKey $storageKey -StorageUri $storageUri -AuthenticationType sql -AdministratorLogin $SQL_username -AdministratorLoginPassword $SQL_secure_secret
SQL Server on Azure Virtual Machines
{count} votes

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.