简体   繁体   English

从Visual Studio Online缩减Azure中托管的SQL数据库的规模

[英]Downscale an sql database hosted in Azure from Visual studio online

I need to downscale a database in Azure to its Basic plan. 我需要将Azure中的数据库缩减到其基本计划。

I have created a task in my Release flow on VSO, a PowerShell Azure Task with my subscription specified in it, and I've put this script in it : 我已经在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

It doesn't work because $Credential is either Null, or it throws an Error saying that: 它不起作用,因为$ Credential为Null,或者抛出错误,说:

Credential Parameter is mandatory. 凭据参数是必需的。

Is there any simple way to achieve this, or a fix for my script ? 有没有简单的方法可以实现这一目标,或者可以解决我的脚本问题?

It was easy, no need for Credentials 这很容易,不需要凭证

$P0 = Get-AzureSqlDatabaseServiceObjective -ServerName "XXX-com-staging" -ServiceObjectiveName "Basic"
Set-AzureSqlDatabase -DatabaseName "YYY-com-staging"  -ServerName "XXX-com-staging" -ServiceObjective $P0 -Force -Edition Basic

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM