Given Microsoft is deprecating the previous method of exporting a SQL DB they have put up a suggested example here:
$subscriptionId = \"YOUR AZURE SUBSCRIPT
It appears that the database name is case sensitive when using az sql db export. Correcting the casing on the database name and resource group solved this issue in my case.
This has just come out from MS/Azure and helps greatly with DB Export.
https://github.com/Microsoft/sql-server-samples/tree/master/samples/manage/azure-automation-automated-export
Seems really stupid but the error for me was because my "DatabaseName" parameter was case sensitive.
I was sending in the value "database" but the actual database name was "Database"
seems crazy but might help someone out
The PowerShell script example in your question above is tested working as expected for me.
However, I am not able to reproduce the same error message as yours even try to use non-existent resource group, database server or database.
Important Note:
$serverAdmin
and $serverPassword
, their values should be single-quoted instead of double-quoted for the script to workAzureRm.Sql
module. Mine tested working is 2.5.0New-AzureRmSqlDatabaseExport
command line to see the details