从 Visual studio 在线缩减托管在 Azure 中的 sql 数据库
Downscale an sql database hosted in Azure from Visual studio online
我需要将 Azure 中的数据库缩减为基本计划。
我在 VSO 上的发布流程中创建了一个任务,这是一个 PowerShell Azure 任务,其中指定了我的订阅,我已将此脚本放入其中:
Start-Sleep -s 60
$Credential = Get-Credential
$serverContext = New-AzureSqlDatabaseServerContext -ServerName "XXX-com-staging" -Credential $Credential
$db = Get-AzureSqlDatabase -ServerName "XXX-com-staging" -DatabaseName "YYY-com-staging"
$P1 = Get-AzureSqlDatabaseServiceObjective $serverContext -ServiceObjectiveName "P1"
Set-AzureSqlDatabase $serverContext -Database $db -ServiceObjective $P1 -Force -Edition Basic
它不起作用,因为 $Credential 要么为 Null,要么抛出一个错误:
Credential Parameter is mandatory.
是否有任何简单的方法可以实现此目的,或修复我的脚本?
很简单,不需要凭据
$P0 = Get-AzureSqlDatabaseServiceObjective -ServerName "XXX-com-staging" -ServiceObjectiveName "Basic"
Set-AzureSqlDatabase -DatabaseName "YYY-com-staging" -ServerName "XXX-com-staging" -ServiceObjective $P0 -Force -Edition Basic
我需要将 Azure 中的数据库缩减为基本计划。
我在 VSO 上的发布流程中创建了一个任务,这是一个 PowerShell Azure 任务,其中指定了我的订阅,我已将此脚本放入其中:
Start-Sleep -s 60
$Credential = Get-Credential
$serverContext = New-AzureSqlDatabaseServerContext -ServerName "XXX-com-staging" -Credential $Credential
$db = Get-AzureSqlDatabase -ServerName "XXX-com-staging" -DatabaseName "YYY-com-staging"
$P1 = Get-AzureSqlDatabaseServiceObjective $serverContext -ServiceObjectiveName "P1"
Set-AzureSqlDatabase $serverContext -Database $db -ServiceObjective $P1 -Force -Edition Basic
它不起作用,因为 $Credential 要么为 Null,要么抛出一个错误:
Credential Parameter is mandatory.
是否有任何简单的方法可以实现此目的,或修复我的脚本?
很简单,不需要凭据
$P0 = Get-AzureSqlDatabaseServiceObjective -ServerName "XXX-com-staging" -ServiceObjectiveName "Basic"
Set-AzureSqlDatabase -DatabaseName "YYY-com-staging" -ServerName "XXX-com-staging" -ServiceObjective $P0 -Force -Edition Basic