gpt4 book ai didi

azure - Azure 数据工厂的托管 VNet IR 的 Bicep 部署中出现错误

转载 作者:行者123 更新时间:2023-12-03 03:44:12 25 4
gpt4 key购买 nike

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

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,然后再在引用中提供名称,或者您也可以使用现有的VNET名称。

如果您有现有的 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
]
}

输出:

enter image description here

enter image description here

<小时/>

如果您没有 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
]
}

输出:

enter image description here

enter image description here

enter image description here

关于azure - Azure 数据工厂的托管 VNet IR 的 Bicep 部署中出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69897155/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com