Getting error while exporting azure db using powershell

1.7k views Asked by At

Followed Export SQL database example using link :

https://learn.microsoft.com/en-us/azure/sql-database/sql-database-export-powershell#export-sql-database-example

Getting below error:

New-AzureRmSqlDatabaseExport : ResourceNotFound: The Resource 'Microsoft.Sql/servers/XXX.database.windows.net/databases/[DBNAME]' under resource group 'Default-SQL-SoutheastAsia' was not found. At [FilePath]\sample.ps1:24 char:18 + $exportRequest = New-AzureRmSqlDatabaseExport –ResourceGroupName $ResourceGroupN ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [New-AzureRmSqlDatabaseExport], CloudException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.NewAzureSqlDatabaseExport

Get-AzureRmSqlDatabaseImportExportStatus : Cannot bind argument to parameter 'OperationStatusLink' because it is null. At [FilePath]\sample.ps1:30 char:63 + Get-AzureRmSqlDatabaseImportExportStatus -OperationStatusLink $exportRequest.Ope ... + CategoryInfo : InvalidData: (:) [Get-AzureRmSqlDatabaseImportExportStatus], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.GetAzureSqlDatabaseImportExportStatus

Any help?

2

There are 2 answers

1
Ben On BEST ANSWER

I had this same issue today, actually. I think if you change your server name to not use the fully-qualified name, that might do it. So, just use "xxxxx."

At least that's what worked for me.

0
Vishal On

You need to verify that your Automation account has latest modules imported and are up to date (AzureRM.Automation – AzureRM.Profile – AzureRM.Sql) atleast to Version: 2.5.0. If modules show a different version, i.e. 1.0.3 then: navigate to assets in the automation account, select modules and click on Update Azure Modules

. Update the Azure PS modules

Wait for the modules to get updated it normally takes a few minutes