gpt4 book ai didi

Azure Runbook 重命名 SQL 数据库

转载 作者:行者123 更新时间:2023-12-03 01:02:48 24 4
gpt4 key购买 nike

在 Azure 中,我想使用 PowerShell 自动化 Runbook 重命名 SQL 数据库,命令如下:

Set-AzureRmSqlDatabase -ResourceGroupName <ResourceGroupName> 
-ServerName <ServerName> -DatabaseName <DatabaseName> -NewName <NewName>

根据文档https://learn.microsoft.com/en-us/powershell/module/azurerm.sql/set-azurermsqldatabase?view=azurermps-6.13.0

此命令在从 Azure 门户顶部导航启动 Cloud Shell 中运行良好。

但在 Runbook 中,它不适用于以下错误:

Set-AzureRmSqlDatabase : A parameter cannot be found that matches parameter name 'NewName'.

Runbook 中似乎缺少 -NewName

   Set-AzureRmSqlDatabase `
-DatabaseName <System.String> `
-ResourceGroupName <System.String> `
[-ElasticPoolName <System.String>] `
[-Tags <System.Collections.Generic.Dictionary`2[System.String,System.String]>] `
[-RequestedServiceObjectiveName <System.String>] `
-ServerName <System.String> `
[-Edition <Microsoft.Azure.Commands.Sql.Database.Model.DatabaseEdition>] `
[-MaxSizeBytes <System.Int64>]

最佳答案

我希望您从 Azure 自动化帐户运行 Runbook。

根据您创建 Azure 自动化帐户的时间,您的帐户模块可能已过时。

证明这一点的一个简单方法是创建一个新的 Runbook 并将其放入其中:

Get-Command Set-AzureRmSqlDatabase

从门户执行 Runbook 并查看输出。您会惊讶地发现它将向您报告什么模块版本。

幸运的是,我有一个非常旧的自动化帐户可以为您证明这一点:

enter image description here

结果: enter image description here

更新后

enter image description here

结果是:

enter image description here

关于Azure Runbook 重命名 SQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53674738/

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