-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathSet-AzSqlDatabase.ps1
28 lines (22 loc) · 1015 Bytes
/
Set-AzSqlDatabase.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Change Azure SQL Database service tier
# Sign in
# Connect to Azure with a browser sign in token
Connect-AzAccount
#Set subscription
Get-AzSubscription
$SubscriptionId = "92aedf6b-f7b7-4e1f-9f23-ed28db0d2085"
# Select-AzureRmSubscription -SubscriptionId $SubscriptionId
#List existing SQL Databases
Get-AzResourceGroup | Select ResourceGroupName, Location
$rg = "SQLserver"
Get-AzSqlServer -ResourceGroupName $rg | Select ServerName, Location
$server = "borland"
Get-AzSqlDatabase -ResourceGroupName $rg -Server $server | Select DatabaseName, Edition, SkuName, CurrentServiceObjectiveName
$database = "AdventureWorksLT"
#New size
$NewEdition = "Standard"
$NewPricingTier = "S2"
#Scale
$ScaleRequest = Set-AzSqlDatabase -DatabaseName $database -ServerName $server -ResourceGroupName $rg -Edition $NewEdition -RequestedServiceObjectiveName $NewPricingTier
$ScaleRequest
Get-AzSqlDatabase -ResourceGroupName $rg -Server $server | Select DatabaseName, Edition, SkuName, CurrentServiceObjectiveName