无法将类型 'string' 隐式转换为 'Microsoft.Azure.Management.DataFactory.Models.SecretBase'

Cannot implicitly convert type 'string' to 'Microsoft.Azure.Management.DataFactory.Models.SecretBase'

我正在使用 .NET 和 Azure 数据工厂 SqlServerLinkedService 开发 ETL 解决方案,作为从本地 SQL 服务器到 Azure 的数据移动的一部分。

我无法设置密码 属性,因为它的类型 SecretBase 没有任何 property/constructor:

有谁知道如何设置这个属性?

下面是我的代码:

奇怪的是,这似乎只在 the Azure Python docs

中有解释

SecretBase class

The base definition of a secret type.

You probably want to use the sub-classes and not this class directly. Known sub-classes are: SecureString, AzureKeyVaultSecretReference

因此您可以使用 Azure SecureString implementation 来设置值,因为它继承自 SecretBase

我想我已经找到使用 SecureString 的解决方案,它派生自 SecretBase 并具有 Property 来设置字符串值