Bicep to Deploy Data Factory Managed Virtual Network

Rob Bowman 221 Reputation points
2021-10-13T14:21:34.87+00:00

I'm trying to create a bicep module that will deploy a data factory along with a managed vnet. Here's what I have:

param dfName string
param sqlId string

resource df 'Microsoft.DataFactory/factories@2018-06-01' = {
  name: dfName
  location: resourceGroup().location
  identity: {
    type: 'SystemAssigned'
  }
}

resource integrationRuntime 'Microsoft.DataFactory/factories/integrationRuntimes@2018-06-01' = {
  name: '${dfName}/managedVnetIr' 
  properties: {
    type: 'Managed'
    typeProperties: {
      computeProperties: {
        location: 'AutoResolve'
        dataFlowProperties: {
          computeType: 'General'
          coreCount: 8
          timeToLive: 0
        }
      }
    }
  }
  dependsOn: [
    df
  ]
}

resource managedVnet 'Microsoft.DataFactory/factories/managedVirtualNetworks@2018-06-01' = {
  name: '${dfName}/vnet'
  properties: { 
  }
  dependsOn: [
    integrationRuntime
  ]
}

resource managedPrivateEndpoint 'Microsoft.DataFactory/factories/managedVirtualNetworks/managedPrivateEndpoints@2018-06-01' = {
  name: '${dfName}/vnet/pe'
  properties: {
    privateLinkResourceId:sqlId
    groupId: 'sql'
  }
  dependsOn: [
    managedVnet
  ]
}

output dfId string = df.identity.principalId

When this module is run, I get the following error:

"status": "Failed",
    "error": {
        "code": "ResourceNotFound",
        "message": "Resource not found. ResourceId: '/subscriptions/8210b2ab-404f-40a5-baba-1cde6d89c670/resourceGroups/rg-contactcentre-dev-001/providers/Microsoft.DataFactory/factories/df-ccsurvey-dev-001/managedvirtualnetworks/vnet'."
    }

Can anyone spot what I've done wrong or direct me to a working sample please?

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,762 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ShaikMaheer-MSFT 38,546 Reputation points Microsoft Employee Moderator
    2021-10-14T10:39:46.53+00:00

    Hi @Rob Bowman ,

    Thank you for posting query in Microsoft Q&A Platform.

    From the error message it looks, below resource is not found and resulted in error.
    /subscriptions/8210b2ab-404f-40a5-baba-1cde6d89c670/resourceGroups/rg-contactcentre-dev-001/providers/Microsoft.DataFactory/factories/df-ccsurvey-dev-001/managedvirtualnetworks/vnet

    May be you can make sure is that resource available and then run it?

    Or

    As you know, bicep actually helps you to generate ARM json of resources. So you can try to build your bicep file and take ARM json generated and validate it manually it make sure your bicep file is generating required ARM json correctly or not?

    140569-image1.png


  2. Syed, Umair 45 Reputation points
    2024-09-11T06:06:28.6+00:00

    I faced the same issue and the following bicep worked for me:

    
    resource dataFactory 'Microsoft.DataFactory/factories@2018-06-01' existing = {
      name: dataFactoryName
    }
    
    resource integrationRuntimeName 'Microsoft.DataFactory/factories/integrationRuntimes@2018-06-01' = {
      name: runtimeName
      parent: dataFactory
      properties: {
        description: 'Azure managed integration runtime'
        type: 'Managed'
        managedVirtualNetwork: {
          referenceName: managedVnet.name
          type: 'ManagedVirtualNetworkReference'
        }
        typeProperties: {
          computeProperties: {
            dataFlowProperties: {
              computeType: 'General'
              coreCount: 8
              timeToLive: 10
            }
            location: location 
            pipelineExternalComputeScaleProperties: {
              numberOfExternalNodes: 1
              numberOfPipelineNodes: 1
              timeToLive: 60
            }
          }
        }
      }
      dependsOn: [
        managedVnet
      ]  
    }
    resource managedVnet 'Microsoft.DataFactory/factories/managedVirtualNetworks@2018-06-01' = {
      parent: dataFactory
      name: 'default'
      properties: { 
      }
    }
    output runtimeResourceId string = integrationRuntimeName.id
    
    
    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.