[英]Azure CLI command to create ADF linked service with key vault?
I am referencing the below codes with command but getting error for both我正在使用命令引用以下代码,但两者都出现错误
az datafactory linked-service create --resource-group $resourcegroup --factory-name $factoryname --linked-service-name ls_AzureKeyVault_storage --properties @ls_AzureKeyVault_storage.json > \dev\null az datafactory 链接服务创建 --resource-group $resourcegroup --factory-name $factoryname --linked-service-name ls_AzureKeyVault_storage --properties @ls_AzureKeyVault_storage.json > \dev\null
{ "name": "ls_AzureKeyVault_storage", "properties": { "annotations": [], "type": "AzureKeyVault", "typeProperties": { "baseUrl": "https://kvadfconnections.vault.azure.net/" } } } {“名称”:“ls_AzureKeyVault_storage”,“属性”:{“注释”:[],“类型”:“AzureKeyVault”,“typeProperties”:{“baseUrl”:“https://kvadfconnections.vault.azure.net /" } } }
az datafactory linked-service create --resource-group $resourcegroup --factory-name $factoryname --linked-service-name AzureStorageLinkedService --properties @AzureStorageLinkedService.json > \dev\null az datafactory 链接服务创建 --resource-group $resourcegroup --factory-name $factoryname --linked-service-name AzureStorageLinkedService --properties @AzureStorageLinkedService.json > \dev\null
{ "name": "AzureStorageLinkedService", "properties": { "annotations": [], "type": "AzureBlobStorage", "typeProperties": { "connectionString": { "type": "AzureKeyVaultSecret", "store": { "referenceName": "ls_AzureKeyVault_storage", "type": "LinkedServiceReference" }, "secretName": "sec-stforadfcli-connection" } } }, "type": "Microsoft.DataFactory/factories/linkedservices" } {“名称”:“AzureStorageLinkedService”,“属性”:{“注释”:[],“类型”:“AzureBlobStorage”,“typeProperties”:{“connectionString”:{“类型”:“AzureKeyVaultSecret”,“存储” :{“referenceName”:“ls_AzureKeyVault_storage”,“type”:“LinkedServiceReference”},“secretName”:“sec-stforadfcli-connection”}}},“type”:“Microsoft.DataFactory/factories/linkedservices”}
We have tested this in our local environment, Below statements are based on our analysis.我们在本地环境中对此进行了测试,以下陈述基于我们的分析。
While creating the linked service through AzureCLI
cmdlet using az data factory linked-service create
,you need to pass the json file to the --properties flag
.在使用az data factory linked-service create
通过AzureCLI
cmdlet 创建链接服务时,您需要将 json 文件传递给--properties flag
。
az datafactory linked-service create --factory-name
--linked-service-name
--properties
--resource-group
[--if-match]
properties{}
list on top of the typeproperties{}
in your json file then while creating the linked service to the data factory it will fail with the error that you have shared as shown in the below如果您在 json 文件中的typeproperties{}
顶部声明properties{}
列表,则在创建与数据工厂的链接服务时,它将失败并显示您共享的错误,如下所示typeProperties
in json file to create a linked service with the data factory as shown in the below.您只需传递typeProperties
文件中的 typeProperties 即可使用数据工厂创建链接服务,如下所示。 In the below example,we are trying to create a keyvault
linked service with our existing ADF.在下面的示例中,我们尝试使用现有的 ADF 创建一个keyvault
链接服务。 Here is our keyvault.json
file which has type properties.这是我们的keyvault.json
文件,它具有类型属性。
{
"type": "AzureKeyVault",
"typeProperties":{
"baseUrl": "<keyvault>"
},
"annotations":[<requiredannotations],
"description":"<requireddescription>",
"parameters": {
"test":{
"type":"String",
"defaultValue":"test"
}
}
}
Here is the sample output for reference:以下是样品 output 供参考:
You can use the above keyvault.json
file as reference & make the changes as per your requirement.您可以使用上述keyvault.json
文件作为参考并根据您的要求进行更改。
You can also refer this documentation, for more information about what all the properties that we can pass to AzurekeyVaultLinkedService
& there respective datatypes.您还可以参考此文档,了解有关我们可以传递给AzurekeyVaultLinkedService
的所有属性以及相应数据类型的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.