title: Bicep to Deploy Data Factory Managed Virtual Network
body: <p>I'm trying to create a bicep module that will deploy a data factory along with a managed vnet. Here's what I have:</p>
  <pre><code>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
  </code></pre>
  <p>When this module is run, I get the following error:</p>
  <blockquote>
  <p>&quot;status&quot;: &quot;Failed&quot;,
  &quot;error&quot;: {
  &quot;code&quot;: &quot;ResourceNotFound&quot;,
  &quot;message&quot;: &quot;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'.&quot;
  }</p>
  </blockquote>
  <p>I've also tried the following (based on answer from AnsumanBal-MT)</p>
  <pre><code>param dfName string
  param sqlId string
  param vnetName 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' = {
    parent: df
    name: '${dfName}-managedVnetIr' 
    properties: {
      type: 'Managed'
      typeProperties: {
        computeProperties: {
          location: 'AutoResolve'
          dataFlowProperties: {
            computeType: 'General'
            coreCount: 8
            timeToLive: 0
          }
        }
      }
    }
  }
  
  resource managedVnet 'Microsoft.DataFactory/factories/managedVirtualNetworks@2018-06-01' = {
    parent:df
    name: vnetName
    properties: { 
    }
    dependsOn: [
      integrationRuntime
    ]
  }
  
  resource managedPrivateEndpoint 'Microsoft.DataFactory/factories/managedVirtualNetworks/managedPrivateEndpoints@2018-06-01' = {
    parent:managedVnet
    name: '${vnetName}-sql-pe'
    properties: {
      privateLinkResourceId:sqlId
      groupId: 'sql'
    }
    dependsOn: [
      managedVnet
    ]
  }
  
  output dfId string = df.identity.principalId
  </code></pre>
  <p>but this gives the following error:</p>
  <blockquote>
  <p>{
  &quot;status&quot;: &quot;Failed&quot;,
  &quot;error&quot;: {
  &quot;code&quot;: &quot;ResourceDeploymentFailure&quot;,
  &quot;message&quot;: &quot;The resource operation completed with terminal provisioning state 'Failed'.&quot;
  } }</p>
  </blockquote>
  <p>Can anyone spot what I've done wrong or direct me to a working sample please?</p>