【发布时间】:2017-04-12 23:38:05
【问题描述】:
我在 Azure 自动化门户的 Runbook 中创建了一个 Azure PowerShell 脚本,以便根据时间自动调整数据库性能级别。
当我想缩小到“P1”或“P2”性能级别时,我可以通过“Get-AzureSqlDatabaseServiceObjective”成功检索服务目标;但是,当我想扩大到“P6”或“P11”时,我无法使用完全相同的代码块:
$Edition = "Premium"
$PerfLevel = "P6"
$Servercredential = new-object System.Management.Automation.PSCredential($Credential.UserName, (($Credential).GetNetworkCredential().Password | ConvertTo-SecureString -asPlainText -Force))
$CTX = New-AzureSqlDatabaseServerContext -ManageUrl “https://$ServerName.database.windows.net” -Credential $ServerCredential
$ServiceObjective = Get-AzureSqlDatabaseServiceObjective $CTX -ServiceObjectiveName $PerfLevel
Set-AzureSqlDatabase $CTX –DatabaseName $DatabaseName –ServiceObjective $ServiceObjective –Edition $Edition -Force
当我将“P6”指定为“ServiceObjectiveName”时,此 cmdlet 返回 null;但是,当我指定“P1”或 P2 时,cmdlet 会返回正确的 ServiceObjective 对象,并且代码将正确执行。
“Get-AzureSqlDatabaseServiceObjective”的 MSDN 文档仅将“P1、P2、P3”显示为有效的高级值;但是,必须有一种方法可以将数据库扩展到这些更高的性能级别(我可以在此脚本中指定“P3”作为参数,它实际上会将数据库性能级别更改为 P3,即使您无法选择此不再通过 Azure 门户手动获得性能级别)。
任何人都可以提供建议或其他方法来通过 PowerShell 脚本达到这些更高的性能水平吗?我已经在这里和其他地方进行了数小时的研究,但我找不到解决这个问题或任何其他已解决类似问题的帖子的解决方案。
【问题讨论】:
标签: powershell azure