2

I'm using Powershell 7.0.3. Having connected to azure (via connect-AzAccount) I can list my Column Master Keys:

Get-SqlColumnMasterKey -InputObject $database

Name
----
MYDB_CMK
MYDB_CMK2

On attempting to create a Column Encryption Key..

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

I get the following error:

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.

As far as I'm aware the commands Get-SqlColumnMasterKey and New-SqlColumnEncryptionKey should be in the same module, loaded via

Import-Module "SqlServer" 

What have I missed?

Fetchez la vache
  • 4,940
  • 4
  • 36
  • 55
  • 1
    Might be a versioning issue -- the docs are horrid at documenting what version includes what (in practice, it depends on OS version, PowerShell version *and* module version). On my system I have this cmdlet and version 21.1.1879 of the module, for example. Try `Get-Module SqlServer` after importing. – Jeroen Mostert Dec 16 '20 at 11:12

1 Answers1

3

Yes, it is a part of SqlServer module but, it is only supported in Powershell 5:

enter image description here

Harshita Singh
  • 4,590
  • 1
  • 10
  • 13
  • Thanks singhh-msft. This is somewhat beguiling as I moved to Powershell 7 since something didn't work in 5, and now my 7 scripts don't work in 5 either. Hey ho it's what makes IT so... exciting :D Cheers. – Fetchez la vache Dec 16 '20 at 14:39