Powershell - 无法识别术语“New-SqlColumnEncryptionKey” - 尝试创建列加密密钥

问题描述 投票:0回答:1

我使用的是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-SqlColumnMasterKeyNew-SqlColumnEncryptionKey 应该位于同一模块中,通过

加载
Import-Module "SqlServer" 

我错过了什么?

sql-server powershell azure-powershell always-encrypted
1个回答
4
投票

2023 更新

Powershell 7.x(v 22+)中的

SqlServer
模块现在支持所有 Sql 列加密 cmdlet,如此处的文档所示:

https://learn.microsoft.com/en-us/powershell/module/sqlserver/new-sqlcolumnencryptionkey?view=sqlserver-ps

原答案

是的,它是

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

© www.soinside.com 2019 - 2024. All rights reserved.