Why am i getting "New-AzSqlDatabaseImport : Not found: Entity not found to invoke import"

by Mathias Wrobel   Last Updated June 13, 2019 08:26 AM

I have a script to handle some parameters and deploy an arm template with those parameters, and then create a database using a bacpac file in my storage account. When my script is trying to invoke the cmdlet "New-AzSqlDatabaseImport" i'm getting "NotFound: Entity not found to invoke import"

I have trying updating all of my Az modules, and tried to run the cmdlet manually and fill in the parameters manually.

Write-Host "Creating database and importing data"
$bloblink = (Get-AzStorageAccount -ResourceGroupName $ResourceGroup -Name $StorageName).PrimaryEndpoints.Blob
$uri = $bloblink + $containerName + "/" + $bacpacFile
$importRequest = New-AzSqlDatabaseImport `
    -ResourceGroupName $ResourceGroup `
    -ServerName $SQLServer `
    -DatabaseName $database_ql_name `
    -DatabaseMaxSizeBytes $databaseMaxSizeBytes `
    -StorageKeyType "StorageAccessKey" `
    -StorageKey $(Get-AzStorageAccountKey -ResourceGroupName $ResourceGroup -StorageAccountName $StorageName).Value[0] `
    -StorageUri $uri `
    -Edition $DatabaseEdition `
    -ServiceObjectiveName $DatabaseSize `
    -AdministratorLogin $dbUsername `
    -AdministratorLoginPassword $dbPassword

I expect it to start a job on Azure to create the database and start the import job.

This is the error im getting instead (i replaced the full path).

At *PATH*/Deployment.ps1:262 char:18
+ $importRequest = New-AzSqlDatabaseImport `
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzSqlDatabaseImport], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.NewAzureSqlDatabaseImport
Tags : azure powershell

Answers 1

I just encountered the same error. I found that the -ServerName argument is case-sensitive. So check your $SQLServer-variable.

June 13, 2019 08:25 AM

Related Questions

Updated September 19, 2018 11:26 AM

Updated March 29, 2018 07:26 AM

Updated May 21, 2015 01:11 AM

Updated January 11, 2018 21:26 PM

Updated August 09, 2019 02:26 AM