Search code examples
azure-powershellazure-automationazure-runbook

Update VCore by database in power shell


best regards!

i've this code in powersheel in Runbook from Azure.

Connect-AzAccount -Identity
Get-AzSubscription



Select-AzSubscription -SubscriptionId "xxxxxxxxxxxxxx"

# Definir variáveis
$resourceGroupName = "XXXXXX" 
$serverName = "XXXXXX" 
$elasticPoolName = "XXXXXX" 
$vCoreCount = 4                     
$edition = "GeneralPurpose"          
$computeGeneration = "Gen5"         
$dtuMax = 4
$dtuMin = 0



echo "Obtendo informações do pool elástico..."
Get-AzSqlElasticPool -ResourceGroupName $resourceGroupName -ServerName $serverName -ElasticPoolName $elasticPoolName



echo "Atualizando as configurações do pool elástico..."
Set-AzSqlElasticPool -ResourceGroupName $resourceGroupName `
                     -ServerName $serverName `
                     -ElasticPoolName $elasticPoolName `
                     -Edition $edition `
                     -ComputeGeneration $computeGeneration `
                     -VCore $vCoreCount `


echo "Atualização concluída. Informações atualizadas do pool elástico:"
Get-AzSqlElasticPool -ResourceGroupName $resourceGroupName -ServerName $serverName -ElasticPoolName $elasticPoolName

This code updates the elastic pool VCore to four vcore elastic pool.

But it doesn't update this part settings by database, how can i update this? what is the parameter, i want to set it to 4 which is the maximum How i update this?

i tried with the parameters -MinCapacity 0 -MaxCapacity 4 -DatabaseCapacityMax 4 -DatabaseCapacityMin 0 DatabaseDtuMax 4 DatabaseDtuMin 0

but it still continued with 2

i need it to stay this way enter image description here


Solution

  • But it doesn't update this part settings by database, how can I update this?

    Firstly, updating the elastic pool vcore cores does not reflect the per database settings vcores in SQL elastic pool. Both are different according to their functionality.

    By referring to the Set-Azsqlelasticpool MS Doc, it is mentioned that there is a specific parameter for configuring per database max or min vcores with -DatabaseVCoreMin and -DatabaseVCoreMax. And also, the VCore max per database for the elastic pool should not exceed more than (2.0) cores for service tier General Purpose.

    Before configuration, the vcores per database settings in my elastic pool is 0.5 as shown in the below image.

    enter image description here

    Now, I have modified your script as below with the required parameters, and it was successfully updated the per database cores along with the vcores limit clearly.

    Connect-AzAccount -identity
    $resourceGroupName = "Jahnavi" 
    $serverName = "newserj" 
    $elasticPoolName = "vcorepool " 
    $vCoreCount = 4                 
    $edition = "GeneralPurpose"          
    $computeGeneration = "Gen5"
    $databasevcoremaxcount = 2         
    
    echo "get elastic pool"
    Get-AzSqlElasticPool -ResourceGroupName $resourceGroupName -ServerName $serverName -ElasticPoolName $elasticPoolName
    echo "configuring to v4"
    Set-AzSqlElasticPool -ResourceGroupName $resourceGroupName `
                         -ServerName $serverName `
                         -ElasticPoolName $elasticPoolName `
                         -Edition $edition `
                         -ComputeGeneration $computeGeneration `
                         -VCore $vCoreCount `
                         -DatabaseVCoreMax $databasevcoremaxcount
    
    echo "After configuration"
    Get-AzSqlElasticPool -ResourceGroupName $resourceGroupName -ServerName $serverName -ElasticPoolName $elasticPoolName
    

    enter image description here

    enter image description here

    enter image description here

    enter image description here