0

我想部署一个启用托管虚拟网络的集成运行时资源。在线查看代码似乎适用于以下结构:

resource IntegrationRuntime 'Microsoft.DataFactory/factories/integrationRuntimes@2018-06-01' = {
  name: 'integrationRuntime-${clientShortName}-${envName}'
  parent: adf
  properties: {
    description: 'Test Integration Runtime - Joao V1'
    type: 'Managed'
    // For remaining properties, see IntegrationRuntime objects
    typeProperties:{
      computeProperties:{
        location: 'UK South'
                dataFlowProperties: {
                    computeType: 'General'
                    coreCount: 8
                    timeToLive: 10
                    cleanup: false
        }
      }
    }
    managedVirtualNetwork:{
      type:'ManagedVirtualNetworkReference'
      referenceName: 'default'
    }
  }
}

但是,当我使用 yml 文件通过 DevOps 上的 CI-CD 管道部署它时,我收到以下错误消息:

状态消息:对托管虚拟网络“默认”的引用无效。托管的虚拟网络不存在。(代码:ManagedVNetReferencedNotExist) 错误出现在参考名称中,因为如果我使用其他名称重新运行脚本,新名称会显示在新的错误消息中。这就引出了一个问题:那我应该使用什么参考名称?

如果我还尝试在 azure Portal 中手动部署它,我启用托管 V 网络并创建一个新的 IR,它也会中断并发出相同的代码。不知道这里可能出了什么问题。DF 中唯一的其他 IR 是标准的(AutoResolveIntegrationRuntime)

4

1 回答 1

0

您需要先创建一个VNET,然后再在参考中提供名称,或者您也可以使用existing VNET名称。

如果你有,existing VNET那么你可以使用下面的代码:

param dfName 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
   ]
 }

输出:

在此处输入图像描述

在此处输入图像描述


如果您没有,请VNET使用以下代码在同一模板中创建 VNET、ADF 和 IR:

param dfName string 
param virtualNetworkName string = 'azure_adf_vnet'
param subnetName string = 'azure_adf_subnet'
param vnetAddressPrefix string = '10.0.0.0/16'
param subnetPrefix string = '10.0.0.0/16'

resource virtualNetworkName_resource 'Microsoft.Network/virtualNetworks@2020-06-01' = {
  name: virtualNetworkName
  location: resourceGroup().location
  properties: {
    addressSpace: {
      addressPrefixes: [
        vnetAddressPrefix
      ]
    }
  }
}

resource virtualNetworkName_subnetName 'Microsoft.Network/virtualNetworks/subnets@2020-06-01' = {
  parent: virtualNetworkName_resource
  name: subnetName
  location: resourceGroup().location
  properties: {
    addressPrefix: subnetPrefix
  }
}

 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: virtualNetworkName
   properties: { 
   }
   dependsOn: [
     integrationRuntime
   ]
 }

输出:

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

于 2021-11-09T12:13:38.523 回答