【问题标题】:Azure runbook rename SQL databaseAzure Runbook 重命名 SQL 数据库
【发布时间】:2019-05-09 12:39:32
【问题描述】:

在 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>]

【问题讨论】:

  • 你在管道参数吗?

标签: azure powershell azure-runbook


【解决方案1】:

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

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

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

Get-Command Set-AzureRmSqlDatabase

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

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

结果:

更新后

结果是:

【讨论】:

  • 您也可以从运行手册中执行Get-Help Set-AzureRmSqlDatabase -Full 并查看可用参数
  • 我认为我发现了这个问题 :)
猜你喜欢
  • 2011-12-04
  • 1970-01-01
  • 2015-11-21
  • 1970-01-01
  • 2018-01-27
  • 2019-05-29
  • 2018-09-01
  • 2016-01-11
  • 1970-01-01
相关资源
最近更新 更多