Facing NetworkSecurityGroupNotFoundForFlowLog Error for Deploying Azure NSG Flow Log through Bicep

Murali R 245 Reputation points
2023-12-13T17:11:43.6366667+00:00

Hi Team,

Iam facing some errors while Enabling NSG Flow Log through Bicep. I have Two NSGResourceGroups with two different regions (NorthCentralUs, EastUs) where it consists of multiple Nsg's in each NSGResourceGroups, One Network Watcher for each region in NetworkWatcherRG, One Vnet and One storage account for each region.

In Bicep template, to collect the value of ExistingNsgId, NsgNames and NsgRgNames, i am using powershell script. When i try to deploy i am receiving the following error.

I am receiving this error only for 2nd NSG RG, but the first NSGRg does not have any problem for creating NSG flow log

Network security group specified in flow log TargetResourceId /subscriptions/xxx/resourceGroups/VSS_EASTUS_NSG/providers/Microsoft.Network/networkSecurityGroups/xxx is not found. (Code: NetworkSecurityGroupNotFoundForFlowLog)

Network security group specified in flow log TargetResourceId /subscriptions/xxx/resourceGroups/VSS_EASTUS_NSG/providers/Microsoft.Network/networkSecurityGroups/xxx is not found. (Code: NetworkSecurityGroupNotFoundForFlowLog)

Network security group specified in flow log TargetResourceId /subscriptions/xxx/resourceGroups/VSS_EASTUS_NSG/providers/Microsoft.Network/networkSecurityGroups/xxx is not found. (Code: NetworkSecurityGroupNotFoundForFlowLog)

Network security group specified in flow log TargetResourceId /subscriptions/xxx/resourceGroups/VSS_EASTUS_NSG/providers/Microsoft.Network/networkSecurityGroups/xxx is not found. (Code: NetworkSecurityGroupNotFoundForFlowLog)

Network security group specified in flow log TargetResourceId /subscriptions/xxx/resourceGroups/VSS_EASTUS_NSG/providers/Microsoft.Network/networkSecurityGroups/xxx is not found. (Code: NetworkSecurityGroupNotFoundForFlowLog)

Kindly help help me on this error.

Azure Network Watcher
Azure Network Watcher
An Azure service that is used to monitor, diagnose, and gain insights into network performance and health.
173 questions
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 47,046 Reputation points Microsoft Employee
    2023-12-14T13:17:26.8+00:00

    @Murali R

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    You are in the process of automating Flow logs creation using Bicep.

    From your script, we found out that the location parameter was misconfigured.

    Fixing this resolved the issue.

    Thanks,

    Kapil


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.