0

I'm having trouble using the -vCore param for the Restore-AzSqlDatabase function.

I have the below query, which works fine and duplicates the compute gen and vCore settings of the sourceDB.

Restore-AzSqlDatabase -FromPointInTimeBackup -PointInTime $dateTime -ResourceGroupName $database.ResourceGroupName -ServerName $database.ServerName -TargetDatabaseName $targetDB -Edition $edition -ServiceObjectiveName $database.CurrentServiceObjectiveName -ResourceId $database.ResourceID 

However, when I add the -VCore param (as per the below) the query fails (via an azure devops pipeline).

Restore-AzSqlDatabase -FromPointInTimeBackup -PointInTime $dateTime -ResourceGroupName $database.ResourceGroupName -ServerName $database.ServerName -TargetDatabaseName $targetDB -Edition $edition -ServiceObjectiveName $database.CurrentServiceObjectiveName -ResourceId $database.ResourceID -VCore 1

The error I see is.

System.Management.Automation.ParameterBindingException: Parameter set cannot be resolved using the specified named parameters.

I've also tried adding the -ComputeGeneration param with no luck.

Restore-AzSqlDatabase -FromPointInTimeBackup -PointInTime $dateTime -ResourceGroupName $database.ResourceGroupName -ServerName $database.ServerName -TargetDatabaseName $targetDB -Edition $edition -ServiceObjectiveName $database.CurrentServiceObjectiveName -ResourceId $database.ResourceID -ComputeGeneration "Gen5" -VCore 1

Also note that $edition = 'GeneralPurpose', the source db is General Purpose + serverless and the azure pipeline task is 'AzurePowerShell@5'.

Does anyone know how to successfully use the -VCore param to set the max number of vcores?

The MS provided doco, isn't giving me any clues.

noddy
  • 185
  • 1
  • 10

1 Answers1

1

Have a look again at the syntax on the Docs page https://learn.microsoft.com/en-us/powershell/module/az.sql/restore-azsqldatabase?WT.mc_id=DP-MVP-5001259&view=azps-5.5.0

Each of the possible parameter groups are listed - but there is NO combination that includes both of -ServiceObjectiveName and -vCore.

The most likely parameter set if you want to set the vCores is:

Restore-AzSqlDatabase
   [-FromPointInTimeBackup]
   -PointInTime <DateTime>
   -ResourceId <String>
   -ServerName <String>
   -TargetDatabaseName <String>
   -Edition <String>
   [-AsJob]
   -ComputeGeneration <String>
   -VCore <Int32>
   [-LicenseType <String>]
   [-BackupStorageRedundancy <String>]
   [-ResourceGroupName] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Martin Cairney
  • 1,714
  • 1
  • 6
  • 18
  • Thanks for the answer Martin. I feel like a bit of a goose but I hadn't understood the significance of the parameter groups listed in this (or any) ms doco until just now. I've now got a problem with getting the param values correct (Error now is: The sku 'SQLDB_GP_Gen5_1' specified is invalid. ), but you have addressed my immediate question perfectly – noddy Feb 16 '21 at 07:32