繁体   English   中英

Azure Runbook重命名SQL数据库

[英]Azure runbook rename SQL database

在Azure中,我想使用以下命令使用PowerShell自动化Runbook重命名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中正常工作。

但是在Runbook中,它不适用于此错误:

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

似乎-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自动化帐户运行Runbook。

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

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

Get-Command Set-AzureRmSqlDatabase

从门户执行Runbook并查看输出。 您会惊讶地看到它将向您报告哪个模块版本。

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

在此输入图像描述

结果: 在此输入图像描述

更新后

在此输入图像描述

结果是:

在此输入图像描述

暂无
暂无

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

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