Azure Data Factory部署报错TypeError: Cannot read property 'type' of undefined求助
排查Azure Data Factory链接服务部署报错:TypeError: Cannot read property 'type' of undefined
原始AzureFunction链接服务代码
{ "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": [] }
修改后的AzureFunction链接服务代码
{ "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')]" ] }
部署报错信息
TypeError: Cannot read property 'type' of undefined
排查与解决方案
1. 验证依赖的Key Vault链接服务
- 确认
Ls_AzureKeyVault链接服务已在当前Data Factory实例中正确创建,且ARM模板定义完整无语法错误。若该服务不存在或配置异常,会导致当前链接服务解析依赖失败。 - 检查
Ls_AzureKeyVault的类型是否为AzureKeyVault,且typeProperties包含vaultUri等必填属性。
2. 检查变量factoryId的定义
- 确认ARM模板的
variables部分已正确定义factoryId,标准格式应为:
若"variables": { "factoryId": "[concat('Microsoft.DataFactory/factories/', parameters('factoryName'))]" }factoryId未定义或格式错误,dependsOn中的引用会解析失败,触发类型读取错误。
3. 核对AzureKeyVaultSecret配置
- 确认Key Vault中存在名为
MemoKey的密钥,且Data Factory服务主体拥有该密钥的读取权限。密钥不存在或权限不足会导致配置解析异常。 - 检查
functionKey节点结构是否符合ADF规范:type必须为AzureKeyVaultSecret,store节点包含referenceName和type: LinkedServiceReference,secretName与Key Vault中密钥名称完全匹配。
4. 调整部署顺序
- 批量部署时,确保
Ls_AzureKeyVault先于MemoExtraction链接服务部署。即使配置了dependsOn,资源顺序错误也可能导致依赖解析失败,可单独先部署Ls_AzureKeyVault再部署目标服务。
5. 检查模板语法
- 排查整个ARM模板是否存在逗号遗漏、括号不匹配等语法错误,这类问题会导致模板解析器无法正确读取资源的
type属性,进而抛出报错。
内容的提问来源于stack exchange,提问作者Shruti Srivastava
相关产品推荐
相关产品推荐

