Issue with Bicep module output for ADF identity

Gabriel25 525 Reputation points
2025-02-19T08:17:02.44+00:00

Hello

I am currently using Bicep version 0.4.1318 to deploy an Azure Data Factory instance. In my main Bicep module, I have the following code that calls a sub-module for provisioning the Data Factory:

bicepRunCopy code1var adfName = 'adf-ctaxrebate-${envPlusSuffix}-${formattedInstanceNum}'2module adfDeploy 'CTaxRebate.dataFactory.bicep' = {3  name: 'adfDeploy'4  params: {5    adfName: adfName6  }7}

The sub-module for the Data Factory is defined as follows:

bicepRunCopy code1param adfName string23resource adf 'Microsoft.DataFactory/factories@2018-06-01' = {4  name: adfName5  location: resourceGroup().location6}78output dfId string = adf.identity.principalId

When I execute the main Bicep module using the PowerShell cmdlet New-AzResourceGroupDeployment, I encounter the following error:

RunCopy code1The template output 'dfId' is not valid: The language expression property 'identity' doesn't exist, available properties are 'apiVersion, location, tags, etc...

It seems that the error is indicating an issue with this line in the Data Factory module:

bicepRunCopy code1output dfId string = adf.identity.principalId

I am confused by this error, especially since I have successfully used similar code in a previous project without any issues. Additionally, I have verified that the identity property appears in the IntelliSense suggestions.

Could anyone provide insights into why this error might be occurring and how I can resolve it?

Thank you!

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
{count} votes

Accepted answer
  1. Smaran Thoomu 24,110 Reputation points Microsoft External Staff Moderator
    2025-02-19T08:57:41.33+00:00

    Hi @Gabriel-2005
    Welcome to Microsoft Q&A platform and thanks for posting your query here.

    I understand you're encountering an issue with your Bicep deployment for Azure Data Factory (ADF), specifically regarding the identity property. Let's address this step by step.

    Issue:

     The template output 'dfId' is not valid: The language expression property 'identity' doesn't exist, available properties are 'apiVersion, location, tags, etc...
    

    This error suggests that the identity property isn't defined in your ADF resource, which is why accessing adf.identity.principalId results in an error.

    Solution:

    To resolve this, you need to enable Managed Identity for your Azure Data Factory instance. Here's how you can modify your Bicep template:

    1. In your sub-module (CTaxRebate.dataFactory.bicep), update the ADF resource to include the identity property:
         param adfName string
         resource adf 'Microsoft.DataFactory/factories@2018-06-01' = {
           name: adfName
           location: resourceGroup().location
           identity: {
             type: 'SystemAssigned'
           }
         }
         output dfId string = adf.identity.principalId
         
         
      
      By adding the identity block with type: 'SystemAssigned', you're enabling a system-assigned managed identity for the Data Factory.
    2. After making this change, redeploy your Bicep template using the New-AzResourceGroupDeployment cmdlet. This should provision the Data Factory with the managed identity enabled, and the identity property will be available as expected.

    The identity property isn't included by default when deploying an Azure Data Factory. Explicitly defining it in your Bicep template ensures that the Data Factory is created with a managed identity, allowing you to reference adf.identity.principalId without issues.

    For more information on configuring managed identities in Azure Data Factory, you can refer to the official documentation.

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Amira Bedhiafi 33,071 Reputation points Volunteer Moderator
    2025-02-19T09:05:26.77+00:00

    The identity property is not automatically created for the ADF resource unless you explicitly define it in your Bicep template. So you need to explicitly define it :

    
    param adfName string
    
    resource adf 'Microsoft.DataFactory/factories@2018-06-01' = {
    
      name: adfName
    
      location: resourceGroup().location
    
      identity: {
    
        type: 'SystemAssigned'
    
      }
    
    }
    
    output dfId string = adf.identity.principalId
    
    

    In this code, the identity property is explicitly set to SystemAssigned, which means Azure will automatically create and manage the identity for the Data Factory. This should resolve the error you're seeing.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.