Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jul 20th, 2018 51 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. param
  2. (
  3.     # Desired Azure SQL Database edition {Basic, Standard, Premium}
  4.     [parameter(Mandatory=$true)]
  5.     [string] $Edition,
  6.  
  7.     # Desired performance level {Basic, S0, S1, S2, P1, P2, P3}
  8.     [parameter(Mandatory=$true)]
  9.     [string] $PerfLevel
  10.  
  11. )
  12.  
  13. inlinescript
  14. {
  15.     # I only care about 1 DB so, I put it into variable asset and access from here
  16.     $SqlServerName = Get-AutomationVariable -Name 'SqlServerName'
  17.     $DatabaseName = Get-AutomationVariable -Name 'DatabaseName'
  18.  
  19.  
  20.     Write-Output "Begin vertical scaling script..."
  21.  
  22.     # Establish credentials for Azure SQL Database server
  23.     $Servercredential = new-object System.Management.Automation.PSCredential("yourDBadmin", ("YourPassword" | ConvertTo-SecureString -asPlainText -Force))
  24.  
  25.     # Create connection context for Azure SQL Database server
  26.     $CTX = New-AzureSqlDatabaseServerContext -ManageUrl “https://$SqlServerName.database.windows.net” -Credential $ServerCredential
  27.  
  28.     # Get Azure SQL Database context
  29.     $Db = Get-AzureSqlDatabase $CTX –DatabaseName $DatabaseName
  30.  
  31.     # Specify the specific performance level for the target $DatabaseName
  32.     $ServiceObjective = Get-AzureSqlDatabaseServiceObjective $CTX -ServiceObjectiveName "$Using:PerfLevel"
  33.  
  34.     # Set the new edition/performance level
  35.     Set-AzureSqlDatabase $CTX –Database $Db –ServiceObjective $ServiceObjective –Edition $Using:Edition -Force
  36.  
  37.     # Output final status message
  38.     Write-Output "Scaled the performance level of $DatabaseName to $Using:Edition - $Using:PerfLevel"
  39.     Write-Output "Completed vertical scale"
  40. }
  41.    
  42. ALTER DATABASE [database_name] MODIFY (EDITION = 'standard', SERVICE_OBJECTIVE = 'S3', MAXSIZE = 250 GB)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top