Describe the bug
The networkRuleSets in https://github.com/Azure/ResourceModules/blob/58691e44109c5991c29f5345944b3253be920a58/modules/event-hub/namespace/network-rule-set/main.bicep seem to have incorrectly logic.
resource networkRuleSet 'Microsoft.EventHub/namespaces/networkRuleSets@2022-01-01-preview' = {
name: 'default'
parent: namespace
properties: {
publicNetworkAccess: publicNetworkAccess
defaultAction: publicNetworkAccess == 'Disabled' ? null : (!empty(ipRules) || !empty(virtualNetworkRules) ? 'Deny' : defaultAction)
trustedServiceAccessEnabled: publicNetworkAccess == 'Disabled' ? null : trustedServiceAccessEnabled
ipRules: publicNetworkAccess == 'Disabled' ? null : ipRules
virtualNetworkRules: publicNetworkAccess == 'Disabled' ? null : networkRules
}
}
The snippet above forces trustedServiceAccessEnabled to be null when publicNetworkAccess is set to "Disabled". This is incorrect. When using Private Endpoints this is the exact configuration that you need.

{
"id": "/subscriptions/blah/resourcegroups/rg-1/providers/Microsoft.EventHub/namespaces/evtns-t-01/networkrulesets/default",
"name": "default",
"type": "Microsoft.EventHub/Namespaces/NetworkRuleSets",
"location": "australiaeast",
"properties": {
"publicNetworkAccess": "Disabled",
"defaultAction": "Allow",
"virtualNetworkRules": [],
"ipRules": [],
"trustedServiceAccessEnabled": true
}
}
To reproduce
Deploy https://github.com/Azure/ResourceModules/blob/58691e44109c5991c29f5345944b3253be920a58/modules/event-hub/namespace/network-rule-set/main.bicep using:
publicNetworkAccess = 'Disabled'
trustedServiceAccessEnabled = true
Code snippet
No response
Relevant log output
No response
Describe the bug
The networkRuleSets in https://github.com/Azure/ResourceModules/blob/58691e44109c5991c29f5345944b3253be920a58/modules/event-hub/namespace/network-rule-set/main.bicep seem to have incorrectly logic.
The snippet above forces

trustedServiceAccessEnabledto be null whenpublicNetworkAccessis set to "Disabled". This is incorrect. When using Private Endpoints this is the exact configuration that you need.{ "id": "/subscriptions/blah/resourcegroups/rg-1/providers/Microsoft.EventHub/namespaces/evtns-t-01/networkrulesets/default", "name": "default", "type": "Microsoft.EventHub/Namespaces/NetworkRuleSets", "location": "australiaeast", "properties": { "publicNetworkAccess": "Disabled", "defaultAction": "Allow", "virtualNetworkRules": [], "ipRules": [], "trustedServiceAccessEnabled": true } }To reproduce
Deploy https://github.com/Azure/ResourceModules/blob/58691e44109c5991c29f5345944b3253be920a58/modules/event-hub/namespace/network-rule-set/main.bicep using:
publicNetworkAccess = 'Disabled'trustedServiceAccessEnabled = trueCode snippet
No response
Relevant log output
No response