0

I need to create powershell script that will increase Azure SQL database storage space with 10%. With GB its not a problem, but I don't have an idea how to do it with %. I have something like that:

$1 = Get-AzSqlDatabase -ResourceGroupName "testRG" -ServerName "test-sql" -DatabaseName "test-sqldb"
$2 = $1.MaxSizeBytes

But how to point that MAxSizeBytes will be 100% and add 10% more ?

1 Answer 1

1

You have to use Set-AzSqlDatabase and set the parameter -MaxSizeBytes to the desired value.

Should be something like:

$db = Get-AzSqlDatabase -ResourceGroupName "testRG" -ServerName "test-sql" -DatabaseName "test-sqldb" 

Set-AzSqlDatabase -ResourceGroupName "testRG" -ServerName "test-sql" -DatabaseName "test-sqldb" -MaxSizeBytes $($db.MaxSizeBytes*1.1)

You probably have to check the valid sizes in Azure Portal. According to this post the values are limited to specific sizes.

Sign up to request clarification or add additional context in comments.

1 Comment

Check size, check if actually found actual database, etc. 😂

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.