I've written a PowerShell script that copies a local bacpac file to an Azure storage account container. After the bacpac file has been copied from the local file system to the Azure blob container, I provide the storage account key and URI to the bacpac file to the New-AzSqlDatabaseImport command.
However, it never succeeds. I always get a 0: The storage account cannot be accessed. Please check the storage account name and key and try again error message. Unfortunately, no matter what I've tried, I cannot get it to work, and that error message isn't very descriptive or helpful at all. In the details response, I see severity "16" code "0" and the message of "The storage account cannot be accessed. Please check the storage account name and key and try again."
Does the -ResourceGroupName for the New-AzSqlDatabaseImport have to contain both the SQL server and the storage account? What permissions need to be enabled in order to allow the New-AzSqlDatabaseImport command to successfully access the storage account?
I do not understand what I'm doing wrong. I use the same key for the Set-AzStorageBlobContent command which works without a problem, so I know the key is correct. The URI to the bacpac file is correct as well. So what am I doing incorrectly? Does it matter that the Resource Group Name is not the same for the storage account and SQL server instance? Is there something in the firewall for the storage account I need to change?
Any help is appreciated!