SQL Server 2016 - 始终加密 - 缺少生成 Powershell 的选项

SQL Server 2016 - Always Encrypted - Missing Option To Generate Powershell

我目前正在测试 SQL Server 2016 的 Always Encrypted 功能,我能够使用默认密钥加密列,但我无法通过 "Generate PowerShell script to run later" 选项编写此工作的脚本。

有没有人遇到过并重新调解过这个问题?

它在我的环境中工作:

我想我遇到了类似的问题,因为我没有使用最新的 SQL Server Management Studio。你可以找到最新版本 here.

生成的代码如下所示 - 我认为您可以更改它并尝试是否无法另存为 PS 脚本:

# Generated by SQL Server Management Studio at 9:15 AM on 2017-10-09

Import-Module SqlServer
# Set up connection and database SMO objects

$sqlConnectionString = "Data Source=SQLInstanceName\INST1;Initial Catalog=databaseName;Integrated Security=True;MultipleActiveResultSets=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;Packet Size=4096;Application Name=`"Microsoft SQL Server Management Studio`""
$smoDatabase = Get-SqlDatabase -ConnectionString $sqlConnectionString

# If your encryption changes involve keys in Azure Key Vault, uncomment one of the lines below in order to authenticate:
#   * Prompt for a username and password:
#Add-SqlAzureAuthenticationContext -Interactive

#   * Enter a Client ID, Secret, and Tenant ID:
#Add-SqlAzureAuthenticationContext -ClientID '<Client ID>' -Secret '<Secret>' -Tenant '<Tenant ID>'

# Change encryption schema

$encryptionChanges = @()

# Add changes for table [dbo].[TablenameX]
$encryptionChanges += New-SqlColumnEncryptionSettings -ColumnName dbo.TablenameX.columNameX -EncryptionType Deterministic -EncryptionKey "CEK_Auto1"

Set-SqlColumnEncryption -ColumnEncryptionSettings $encryptionChanges -InputObject $smoDatabase

SQL版本是:

Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64) Oct 28 2016 18:17:30 Copyright (c) Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: ) (Hypervisor)

SSMS 版本是 Microsoft SQL Server Management Studio 14.0.17177.0 - 或我提供的 link 中的 v17.2。