Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param
- (
- # Desired Azure SQL Database edition {Basic, Standard, Premium}
- [parameter(Mandatory=$true)]
- [string] $Edition,
- # Desired performance level {Basic, S0, S1, S2, P1, P2, P3}
- [parameter(Mandatory=$true)]
- [string] $PerfLevel
- )
- inlinescript
- {
- # I only care about 1 DB so, I put it into variable asset and access from here
- $SqlServerName = Get-AutomationVariable -Name 'SqlServerName'
- $DatabaseName = Get-AutomationVariable -Name 'DatabaseName'
- Write-Output "Begin vertical scaling script..."
- # Establish credentials for Azure SQL Database server
- $Servercredential = new-object System.Management.Automation.PSCredential("yourDBadmin", ("YourPassword" | ConvertTo-SecureString -asPlainText -Force))
- # Create connection context for Azure SQL Database server
- $CTX = New-AzureSqlDatabaseServerContext -ManageUrl “https://$SqlServerName.database.windows.net” -Credential $ServerCredential
- # Get Azure SQL Database context
- $Db = Get-AzureSqlDatabase $CTX –DatabaseName $DatabaseName
- # Specify the specific performance level for the target $DatabaseName
- $ServiceObjective = Get-AzureSqlDatabaseServiceObjective $CTX -ServiceObjectiveName "$Using:PerfLevel"
- # Set the new edition/performance level
- Set-AzureSqlDatabase $CTX –Database $Db –ServiceObjective $ServiceObjective –Edition $Using:Edition -Force
- # Output final status message
- Write-Output "Scaled the performance level of $DatabaseName to $Using:Edition - $Using:PerfLevel"
- Write-Output "Completed vertical scale"
- }
- ALTER DATABASE [database_name] MODIFY (EDITION = 'standard', SERVICE_OBJECTIVE = 'S3', MAXSIZE = 250 GB)
Add Comment
Please, Sign In to add comment