'类型错误:无法读取未定义的属性'类型',请确保它遵循 JavaScript 对象表示法 (JSON)

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

我最初的代码是:

{
    "name": "[concat(parameters('factoryName'), '/MemoExtraction')]",
    "type": "Microsoft.DataFactory/factories/linkedServices",
    "apiVersion": "2018-06-01",
    "properties": {
        "annotations": [],
        "type": "AzureFunction",
        "typeProperties": {
            "functionAppUrl": "[parameters('MemoExtraction_properties_typeProperties_functionAppUrl')]",
            "functionKey": {
                "type": "SecureString",
                "value": "[parameters('MemoExtraction_functionKey')]"
                                                        
                                                    
                  
                                       
            },
            "authentication": "Anonymous"
        }
    },
    "dependsOn": []
                                                                              
     
},

我已推送新代码:

{
    "name": "[concat(parameters('factoryName'), '/MemoExtraction')]",
    "type": "Microsoft.DataFactory/factories/linkedServices",
    "apiVersion": "2018-06-01",
    "properties": {
        "annotations": [],
        "type": "AzureFunction",
        "typeProperties": {
            "functionAppUrl": "[parameters('MemoExtraction_properties_typeProperties_functionAppUrl')]",
            "functionKey": {
                "type": "AzureKeyVaultSecret",
                "store": {
                    "referenceName": "Ls_AzureKeyVault",
                    "type": "LinkedServiceReference"
                },
                "secretName": "MemoKey"
            },
            "authentication": "Anonymous"
        }
    },
    "dependsOn": [
       "[concat(variables('factoryId'), '/linkedServices/Ls_AzureKeyVault')]"
    ]
},

我收到以下错误: enter image description here

我不确定为什么在部署时会出现此错误。它应该部署成功。

azure azure-devops azure-data-factory azure-keyvault securestring
1个回答
0
投票

我使用 Key Vault 创建了一个功能链接服务,然后导出 ADF 的 ARM 模板,如下所示:-

enter image description here

使用 ADF 资源导出上述 ADF 管道的模板,如下所示:-

enter image description here

从导出的 ARM 代码文件中,我选择了以下 2 个代码,并将数据工厂参数替换为新的 ADF 名称(不带任何管道),以便将 Azure 函数链接服务部署在新的 ADF 管道中,如下所示:-

导出的ARM代码:-

enter image description here

在我的 Azure 存储库中添加了上述两个文件,并将 ADF 名称参数替换为新的 testadf90silicon 名称,如下所示:-

ARMTemplateParametersForFactory.json

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "factoryName": {
            "value": "testadf90silicon"
        },
        "AzureKeyVault1_properties_typeProperties_baseUrl": {
            "value": "https://siliconkeyvault90.vault.azure.net/"
        },
        "AzureFunction1_properties_typeProperties_functionAppUrl": {
            "value": "https://siliconfunc65.azurewebsites.net"
        }
    }
}

ARMTemplateForFactory.json

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "factoryName": {
            "type": "string",
            "metadata": "Data Factory name",
            "defaultValue": "testadf90silicon"
        },
        "AzureKeyVault1_properties_typeProperties_baseUrl": {
            "type": "string",
            "defaultValue": "https://siliconkeyvault90.vault.azure.net/"
        },
        "AzureFunction1_properties_typeProperties_functionAppUrl": {
            "type": "string",
            "defaultValue": "https://siliconfunc65.azurewebsites.net"
        }
    },
    "variables": {
        "factoryId": "[concat('Microsoft.DataFactory/factories/', parameters('factoryName'))]"
    },
    "resources": [
        {
            "name": "[concat(parameters('factoryName'), '/pipeline1')]",
            "type": "Microsoft.DataFactory/factories/pipelines",
            "apiVersion": "2018-06-01",
            "properties": {
                "activities": [
                    {
                        "name": "Azure Function1",
                        "type": "AzureFunctionActivity",
                        "dependsOn": [],
                        "policy": {
                            "timeout": "0.12:00:00",
                            "retry": 0,
                            "retryIntervalInSeconds": 30,
                            "secureOutput": false,
                            "secureInput": false
                        },
                        "userProperties": [],
                        "typeProperties": {
                            "functionName": "siliconfunc65",
                            "method": "GET",
                            "headers": {}
                        },
                        "linkedServiceName": {
                            "referenceName": "AzureFunction1",
                            "type": "LinkedServiceReference"
                        }
                    }
                ],
                "policy": {
                    "elapsedTimeMetric": {},
                    "cancelAfter": {}
                },
                "annotations": []
            },
            "dependsOn": [
                "[concat(variables('factoryId'), '/linkedServices/AzureFunction1')]"
            ]
        },
        {
            "name": "[concat(parameters('factoryName'), '/AzureKeyVault1')]",
            "type": "Microsoft.DataFactory/factories/linkedServices",
            "apiVersion": "2018-06-01",
            "properties": {
                "annotations": [],
                "type": "AzureKeyVault",
                "typeProperties": {
                    "baseUrl": "[parameters('AzureKeyVault1_properties_typeProperties_baseUrl')]"
                }
            },
            "dependsOn": []
        },
        {
            "name": "[concat(parameters('factoryName'), '/AzureFunction1')]",
            "type": "Microsoft.DataFactory/factories/linkedServices",
            "apiVersion": "2018-06-01",
            "properties": {
                "annotations": [],
                "type": "AzureFunction",
                "typeProperties": {
                    "functionAppUrl": "[parameters('AzureFunction1_properties_typeProperties_functionAppUrl')]",
                    "functionKey": {
                        "type": "AzureKeyVaultSecret",
                        "store": {
                            "referenceName": "AzureKeyVault1",
                            "type": "LinkedServiceReference"
                        },
                        "secretName": "secret",
                        "secretVersion": "cf004fc9796f40d1867c3647b76de797"
                    },
                    "authentication": "Anonymous"
                }
            },
            "dependsOn": [
                "[concat(variables('factoryId'), '/linkedServices/AzureKeyVault1')]"
            ]
        }
    ]
}

输出:-

在新 ADF 中创建了 Azure 函数链接服务管道:-

enter image description here

enter image description here

enter image description here

另请参阅 KarthikBhyresh-MT 的类似 SO 线程,您可以在其中覆盖功能键和 URI 值的参数。

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