Create networkSecurityGroup destinationPortRanges doesn't match documentation #7625
-
Bicep version Describe the bug To Reproduce Additional context This is needed to allow the securityRules section to be filled in by a loop. One needs both xxxPortRange and xxxPortRanges in the bicep file and data for them in the parameter files., since one doesn't know if which of future entries will require single ports or ranges and which will require an array of enumerated values. The documentation at https://docs.microsoft.com/en-us/azure/templates/microsoft.network/2021-08-01/networksecuritygroups?tabs=bicep states that the parameter destinationPortRange is valid. The error message doesn't list it as a valid parameter:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
So the issue is that you are creating several @brwilkinson have you come across this and happen to have an example somewhere? |
Beta Was this translation helpful? Give feedback.
-
Sorry about the zip. Github won't that .bicep or .json. Here's my code: network-security-group.bicep
parameter file
|
Beta Was this translation helpful? Give feedback.
-
Ben, I'll try again over the weekend to deploy exactly what I sent you. If you can't duplicate it, and I can, I'll try to get you a complete screen transcript of everything I can. Remember that this is actually an ARM problem. The bicep compiles to ARM successfully. It's ARM that's complaining. I didn't realize that until after I had filed the bug. Looking at your suggestions... #1 is not a bad idea. If it'll work for me. It's actually less typing, since all those params only have to be specified in the parameters. Of course, ARM needs to take it. #2 would work if ARM would take a DestinationPortRanges array with one port. For instance, I need a rule that let's my companies VPN access 3306 for mysql. If I can specify [3306] I'd be fine. I know that I need to specify [80,443] sooner or later. What I don't want is to be unable to handle a single entry (a number or '*') or an array, at need. Let me report back. Ed |
Beta Was this translation helpful? Give feedback.
So the issue is that you are creating several
securityRules
, where some require the singular propertydestinationPortRange
and the other requires the pluraldestinationPortRanges
? If the resource type does not support accepting both properties always, then I think the only way around is to use theunion()
function to conditionally include the relevant properties.@brwilkinson have you come across this and happen to have an example somewhere?