1

在 Azure 中,我想使用 PowerShell 自动化运行手册使用以下命令重命名 SQL 数据库:

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

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

此命令在 Azure 门户顶部导航的 Launch Cloud Shell 中运行良好。

但在运行手册中,它不适用于此错误:

Set-AzureRmSqlDatabase :找不到与参数名称“NewName”匹配的参数。

运行手册中似乎-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>]
4

1 回答 1

3

我希望你从 Azure 自动化帐户运行运行手册。

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

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

Get-Command Set-AzureRmSqlDatabase

从门户执行运行手册并查看输出。您会惊讶地看到它将向您报告什么模块版本。

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

在此处输入图像描述

结果: 在此处输入图像描述

更新后

在此处输入图像描述

结果是:

在此处输入图像描述

于 2018-12-07T22:22:52.897 回答