2
votes

I am deploying an Azure Data Factory using ARM templates. I need the ObjectId/PricipalId/Managed Identity Object ID of the Data Factory in the outputs of the deployment. This can be found on the Azure portal under Properties tab of a Data Factory

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

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

3

3 Answers

2
votes

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. if it does - reference it like you normally would, if it doesnt - you are out of luck.

2
votes

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

1
votes

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. The syntax was correct for the objectId property for the access policy, i.e.:

"[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.