Long running operation failed with status 'Failed'. Additional Info:'The sku 'ElasticPool' specified is invalid.'

Viewed 2180

I'm trying to clone an Azure SQL Database using the PSCmdlet New-AzSqlDatabaseCopy (after being told that Restore-AzSqlDatabase won't let me do cross-server copies). My command is as follows:

New-AzSqlDatabaseCopy   -ServerName $SourceDatabase.ServerName `
                        -ResourceGroupName $SourceDatabase.ResourceGroupName `
                        -DatabaseName $SourceDatabase.DatabaseName `
                        -ServiceObjectiveName $SourceDatabase.CurrentServiceObjectiveName `
                        -CopyServerName $TargetServerName `
                        -CopyResourceGroupName $TargetResourceGroupName `
                        -CopyDatabaseName $TargetDBName `
                        -ElasticPoolName $ElasticPoolName`
                        -ErrorAction stop

The source database is in a different server and resource group than the target, and in a different elastic pool than the target will be.

I've checked and double-checked all of my parameters to make sure they are correct, and I ran it with -whatif and everything looks good (except the creation date is 1/1/0001 but i'm not super concerned about that yet)

However, when I run the command, I get New-AzSqlDatabaseCopy : Long running operation failed with status 'Failed'. Additional Info:'The sku 'ElasticPool' specified is invalid.' Any input would be appreciated

2 Answers

Make sure that the new Elastic Pool has the same name and as the old Elastic Pool. Also make sure the sku are same for both the elastic pools. If the resource groups are in different regions, the sku for elastic pools may differ causing issues while copying the database.

SQL server - sql_server_A --- Elastic Pool - elastic_pool_1 ----- database - template_db

SQL server - sql_server_B --- Elastic Pool - elastic_pool_1 (name equal to Elastic Pool from sql_server_A)

References:

https://github.com/Azure/azure-libraries-for-net/issues/41

https://docs.microsoft.com/en-us/azure/sql-database/scripts/sql-database-move-database-between-pools-powershell

https://docs.microsoft.com/en-us/rest/api/sql/databases/createorupdate

https://docs.microsoft.com/en-us/rest/api/sql/elasticpools/createorupdate

Remove the "-ServiceObjectiveName" parameter. Only -elasticpool OR -ServiceObjectiveName can be used.

Related