0

I am trying to do the following:

  1. Capture the original Edition and RequestedServiceObjectiveName of an Azure sql database using the following PS script:
$OriginalScale= Get-AzSqlDatabase `
                    -ResourceGroupName "POC_Scale" `
                    -ServerName "scaledb" `
                    -DatabaseName "scaleME"

2.Scale up this database to a particular edition and tier using:

Set-AzSqlDatabase `
                    -ResourceGroupName "POC_Scale" `
                    -ServerName "scaledb" `
                    -DatabaseName "scaleME" `
            -Edition "Standard" `
            -RequestedServiceObjectiveName "S3" `

3.After deployment, scale it back to the original scale that I had captured prior to step 2 using:

Set-AzSqlDatabase `
                    -ResourceGroupName "POC_Scale" `
                    -ServerName "scaledb" `
                    -DatabaseName "scaleME" `
            -Edition "$OriginalScale.Edition" `
            -RequestedServiceObjectiveName "$OriginalScale.RequestedServiceObjectiveName" `

I get the following error:

Error

I have tried the following:

  1. Tried to use single quotes around the -Edition and -RequestedServiceObjectName being passed in but I get the same error.

  2. Checked that the $OriginalScale.Edition does indeed return "Standard". Also checked docs and found that .Edition is actually a string which should theoretically work.

Can someone please guide me on what I'm doing wrong here. Seems simple but not sure what I'm doing wrong.

0

1 Answer 1

3

The quotes are the problem. Either don't use the quotes, or do it like this:

-Edition "$($OriginalScale.Edition)"

The syntax you're currently trying is ignoring the .Edition and only outputting the PSObject name.

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

Comments

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.