我正在尝试部署一个示例 Azure BICEP 文件 - 只是一个简单的 vnet/子网。当我尝试使用 Az CLI 进行部署时,我收到以下错误:
解析“./baseinfra.bicep”失败,请检查是否为有效的JSON格式
//deploy virtual network & subnets
param vnetName string
param snetName string
param location string = resourceGroup().location
param vnetAddressPrefixes string
param snet1Prefix string
param snet2Prefix string
param resourceTags object
resource vnet1 'Microsoft.Network/virtualNetworks@2020-07-01' = {
name: '${vnetName}-01'
location: location
tags: resourceTags
properties: {
addressSpace: {
addressPrefixes: [
vnetAddressPrefixes
]
}
subnets:[
{
name: '${snetName}-01'
properties:{
addressPrefix: snet1Prefix
}
}
{
name: '${snetName}-02'
properties:{
addressPrefix: snet2Prefix
}
}
]
}
}
使用模块调用
module vnet './vnet.bicep' = {
name: 'vnetDeploy'
params: {
vnetName: 'azmech-eastus2-vnet'
snetName: 'azmech-eastus2-snet'
vnetAddressPrefixes: '10.0.0.0/26'
snet1Prefix: '10.0.0.0/28'
snet2Prefix: '10.0.0.16/28'
resourceTags: {
Environment: 'Dev'
Project: 'Bicep Tutorial'
}
}
}
任何输入表示赞赏。