Hi Team,
Iam currently trying to deploy Multiple parameter files with loadjsoncontext for creation of NSG flow with Traffic Analytics in Azure with BICEP. Below is the template i have used currently to load two parameter files for a BICEP. One with pipeline parameter file to collect the value of Existing NSG and other parameter file Iam using as a loadjsoncontext in BICEP instead of the Pipeline variable for the values of networkWatcherName, networkWatcherLocation, storageId, nsgResourceGroupName, workspaceId, workspaceRegion and workspaceResourceId
param nsgs array = []
param allowedVNetPrefixes array = []
param logRetentionDays int = 0
param subscriptionId string = subscription().subscriptionId
var nsgFlowLog = json(loadTextContent('./nsgFlowLogParameters/nsgFlowLogCLE_WESTEUROPE.json'))
var networkWatcherName = '${nsgFlowLog.networkWatcherName}'
var location = '${nsgFlowLog.location}'
var storageId = '${nsgFlowLog.storageId}'
var nsgResourceGroupName = '${nsgFlowLog.nsgResourceGroupName}'
var workspaceId = '${nsgFlowLog.workspaceId}'
var workspaceRegion = '${nsgFlowLog.workspaceRegion}'
var workspaceResourceId = '${nsgFlowLog.workspaceResourceId}'
resource flowLog 'Microsoft.Network/networkWatchers/flowLogs@2022-01-01' = [for nsg in nsgs: {
name: '${networkWatcherName}/Microsoft.Network${nsgResourceGroupName}NSG_${replace(nsg.subnet, '/', '_')}'
location: location
properties: {
targetResourceId: '/subscriptions/${subscriptionId}/resourceGroups/${nsgResourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/NSG_${replace(nsg.subnet, '/', '_')}'
storageId: storageId
enabled: true
format: {
type: 'JSON'
version: 2
}
retentionPolicy: {
days: logRetentionDays
enabled: true
}
flowAnalyticsConfiguration: {
networkWatcherFlowAnalyticsConfiguration: {
enabled: true
workspaceId: workspaceId
workspaceRegion: workspaceRegion
workspaceResourceId: workspaceResourceId
}
}
}
}]
Currently iam trying to test multiple parameter files with loadjsoncontext for each subscription. Each and every subscription i have a NSG Resource Groups which contains the value of Nsgs and Storage Account. Kindly guide me on how to use all the parameter files in loadjsoncontext in BICEP.