【问题标题】:Powershell - The term 'New-SqlColumnEncryptionKey' is not recognized - trying to create Column Encryption KeyPowershell - 无法识别术语“New-SqlColumnEncryptionKey” - 尝试创建列加密密钥
【发布时间】:2021-03-27 00:31:23
【问题描述】:

我使用的是 Powershell 7.0.3。 连接到 azure(通过 connect-AzAccount)后,我可以列出我的列主键:

Get-SqlColumnMasterKey -InputObject $database

Name
----
MYDB_CMK
MYDB_CMK2

在尝试创建列加密密钥时..

New-SqlColumnEncryptionKey -Name "MYDB_CEK" -InputObject $database -ColumnMasterKey "MYDB_CMK"

我收到以下错误:

New-SqlColumnEncryptionKey: The term 'New-SqlColumnEncryptionKey' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

据我所知,命令 Get-SqlColumnMasterKey 和 New-SqlColumnEncryptionKey 应该在同一个模块中,通过

加载
Import-Module "SqlServer" 

我错过了什么?

【问题讨论】:

  • 可能是版本控制问题——文档在记录什么版本包含什么方面非常糟糕(实际上,它取决于操作系统版本、PowerShell 版本和模块版本)。例如,在我的系统上,我有这个 cmdlet 和模块的版本 21.1.1879。导入后试试Get-Module SqlServer。

标签: sql-server powershell azure-powershell always-encrypted


【解决方案1】:

是的,它是 SqlServer 模块的一部分,但它仅在 Powershell 5 中受支持:

【讨论】:

  • 感谢 singhh-msft。当我迁移到 Powershell 7 时,这有点令人着迷,因为有些东西在 5 中不起作用,现在我的 7 个脚本也不能在 5 中起作用。嘿,这就是让 IT 如此......令人兴奋的原因:D 干杯。
猜你喜欢
  • 2020-03-03
  • 1970-01-01
  • 2022-01-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多