gpt4 book ai didi

azure - 无法使用变量扩展 Azure SQL 数据库

转载 作者:行者123 更新时间:2023-12-03 04:56:32 26 4
gpt4 key购买 nike

我正在尝试执行以下操作:

  1. 使用以下 PS 脚本捕获 Azure sql 数据库的原始版本和 RequestedServiceObjectiveName:
$OriginalScale= Get-AzSqlDatabase `
-ResourceGroupName "POC_Scale" `
-ServerName "scaledb" `
-DatabaseName "scaleME"

2.使用以下方法将此数据库扩展到特定版本和层:

Set-AzSqlDatabase `
-ResourceGroupName "POC_Scale" `
-ServerName "scaledb" `
-DatabaseName "scaleME" `
-Edition "Standard" `
-RequestedServiceObjectiveName "S3" `

3.部署后,将其缩放回我在步骤 2 之前捕获的原始比例:

Set-AzSqlDatabase `
-ResourceGroupName "POC_Scale" `
-ServerName "scaledb" `
-DatabaseName "scaleME" `
-Edition "$OriginalScale.Edition" `
-RequestedServiceObjectiveName "$OriginalScale.RequestedServiceObjectiveName" `

我收到以下错误:

Error

我尝试过以下方法:

  1. 尝试在传入的 -Edition 和 -RequestedServiceObjectName 周围使用单引号,但出现相同的错误。

  2. 检查 $OriginalScale.Edition 确实返回“Standard”。还检查了文档,发现 .Edition 实际上是一个理论上应该有效的字符串。

有人可以指导我我在这里做错了什么吗?看起来很简单,但不确定我做错了什么。

最佳答案

引号是问题所在。要么不使用引号,要么像这样:

-版本“$($OriginalScale.Edition)”

您当前尝试的语法忽略 .Edition 并仅输出 PSObject 名称。

关于azure - 无法使用变量扩展 Azure SQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68042787/

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