繁体   English   中英

用于 Azure Datafactory 的 ManagedVNet IR 的 Bicep 部署错误

[英]Error in Bicep deployment of ManagedVNet IR for Azure Datafactory

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

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 门户中手动部署它,启用托管 V 网络并创建一个新的 IR,它也会中断并发出相同的代码。 不知道这里可能有什么问题。 DF 中唯一的其他 IR 是标准的 (AutoResolveIntegrationRuntime)

您需要先创建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
   ]
 }

输出:

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM