简体   繁体   English

在 ARM 模板部署输出中获取 Azure 数据工厂的 ObjectId

[英]Get ObjectId of Azure Data Factory, within ARM template deployment output

I am deploying an Azure Data Factory using ARM templates.我正在使用 ARM 模板部署Azure Data Factory I need the ObjectId/PricipalId/Managed Identity Object ID of the Data Factory in the outputs of the deployment.在部署的输出中,我需要数据工厂的ObjectId/PricipalId/Managed Identity Object ID This can be found on the Azure portal under Properties tab of a Data Factory这可以在数据工厂的“ Properties选项卡下的 Azure 门户上找到

I have tried these variations but to no avail:我已经尝试过这些变化,但无济于事:

"value": "[reference(concat('Microsoft.DataFactory/factories/', variables('name')), '2018-06-01').identity.principalId]"
"value": "[reference(concat('Microsoft.DataFactory/factories/', variables('name')), '2018-06-01').principalId]"

The error that I get to see on using these is that the property (identity/principalId) does not exist我在使用这些时看到的错误是该属性 (identity/principalId) 不存在

I have also tried out the stuff mentioned in the docs here: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#reference , it gave the same error我还尝试了此处文档中提到的内容: https : //docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#reference ,它给出了同样的错误

try using reference(concat('Microsoft.DataFactory/factories/', variables('name')), '2018-06-01', 'Full') as the value for the output and examine it, you should see if what you need exists.尝试使用reference(concat('Microsoft.DataFactory/factories/', variables('name')), '2018-06-01', 'Full')作为输出值并检查它,你应该看看你需要存在。 if it does - reference it like you normally would, if it doesnt - you are out of luck.如果有 - 像往常一样引用它,如果没有 - 你运气不好。

The working output snippet is:工作输出片段是:

 "dataFactoryPrincipalId": {
  "type": "string",
  "value": "[reference(concat('Microsoft.DataFactory/factories/', parameters('name')), '2018-06-01', 'Full').identity.principalId]"
}

note this is not the same as the "Managed Identity Application ID" property请注意,这与“托管身份应用程序 ID”属性不同

Just in case it helps anyone, I was facing this problem when deploying an ARM template that provisioned a Data Factory, then created a Key Vault access policy for it.以防万一它对任何人有帮助,我在部署配置数据工厂的 ARM 模板时遇到了这个问题,然后为其创建了一个 Key Vault 访问策略。 The syntax was correct for the objectId property for the access policy, ie:访问策略的 objectId 属性的语法是正确的,即:

"[reference(concat('Microsoft.DataFactory/factories/', parameters('dataFactoryName')), '2018-06-01', 'Full').identity.principalId]"

However it was still returning an error that the identity property was not available for the resource.但是,它仍然返回一个错误,指出身份属性不可用于资源。 The issue was that I was not provisioning an identity when I deployed the Data Factory.问题是我在部署数据工厂时没有配置身份。 The following property needed to be added to the Data Factory deployment:需要将以下属性添加到数据工厂部署中:

"identity": {
    "type": "SystemAssigned"
 }

Then the property was available to the reference function.然后该属性可用于引用函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM