gpt4 book ai didi

powershell - 是否可以自动制作天蓝色弹性泳池秤?

转载 作者:行者123 更新时间:2023-12-02 23:53:58 25 4
gpt4 key购买 nike

如标题所示,我正在尝试自动扩展Azure数据库。我已经找到了用于单个数据库的Powershell工作流脚本,该脚本运行良好。我想知道是否可以自动缩放 flex 池。我试图重写脚本,但失败多次。

这是下面的脚本:

workflow Set-AzureSqlDatabaseEdition 
{
param
(
# Name of the Azure SQL Database server (Ex: bzb98er9bp)
[parameter(Mandatory=$true)]
[string] $SqlServerName,

# Target Azure SQL Elastic Pool
[parameter(Mandatory=$true)]
[string] $ElasticPoolName,

# Desired Azure SQL Elastic Pool edition {Basic, Standard, Premium}
[parameter(Mandatory=$true)]
[string] $Edition,

# Desired DTU
[parameter(Mandatory=$true)]
[string] $DTU,

# DatabaseDtuMin
[parameter(Mandatory=$true)]
[string] $DatabaseDtuMin,

# DatabaseDtuMax
[parameter(Mandatory=$true)]
[string] $DatabaseDtuMax,

# Credentials for $SqlServerName stored as an Azure Automation credential asset
# When using in the Azure Automation UI, please enter the name of the credential asset for the "Credential" parameter
[parameter(Mandatory=$true)]
[PSCredential] $Credential
)

inlinescript
{
Write-Output "Begin vertical scaling script..."

# Establish credentials for Azure SQL Database server
$Servercredential = new-object System.Management.Automation.PSCredential($Using:Credential.UserName, (($Using:Credential).GetNetworkCredential().Password | ConvertTo-SecureString -asPlainText -Force))

# Create connection context for Azure SQL Database server
$CTX = New-AzureSqlDatabaseServerContext -ManageUrl “https://$Using:SqlServerName.database.windows.net” -Credential $ServerCredential

# Get Azure Elastic Pool context
$EP = Get-AzureRmSqlElasticPool $CTX ElasticPoolName $Using:ElasticPoolName

# Specify the specific performance level for the target $DatabaseName
$DTU = Get-AzureRmSqlElasticPool $CTX ElasticPoolName $Using:DTU

# Set the new edition/performance level
Set-AzureRmSqlElasticPool $CTX ElasticPoolName $DTU –ServiceObjective $DTU –Edition $Using:Edition -Force

# Output final status message
Write-Output "Scaled the performance level of $Using:DatabaseName to $Using:Edition - $Using:PerfLevel"
Write-Output "Completed vertical scale"
}
}

我希望有人能为我指明正确的方向,以便做到这一点。

非常感谢!!!

最佳答案

如果您愿意使用第三方产品,请查看CloudMonix-它具有一项功能,可以按任何度量标准和/或日期时间自动缩放 flex 池,SQL Warehouse和SQL Azure数据库。

您可以在其中定义比例范围和比例调整。比例范围通常是基于时间的标准,在这两个标准之间会进行比例缩放(例如,对于上午9点至下午5点,最小等级为P3,最大等级为P5,依此类推),并且比例调整是基于某种性能指标(DTU> 80或网站上的“请求/秒”> 50,依此类推)

无需PowerShell

关于powershell - 是否可以自动制作天蓝色弹性泳池秤?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50813099/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com