Junos OS allows configuration groups to be applied conditionally using the when statement. A configuration group is applied only when all conditions are defined under "when" evaluate to TRUE
when
when"
show security policies
Configuration is present under: show configuration groups <group-name>
show configuration security policies | display inheritance
To ensure that policies defined under a configuration group are correctly applied, the "when" condition must match the actual system context.
1. Verify when the condition
Check the group configuration: show configuration groups <group-name>
2. Ensure that the values used in the when clause (for example, peers) match the actual device/peer identifiers.
peers
Correct the "when peers" knob configuration
3. Update the peer names to match the actual system context:
set groups <group-name> when peers <correct-peer-name> Example: set groups abc when peers FW-gw2 set groups abc when peers FW-gw3
4. The peer names must correspond to the configured peer identifiers in the device environment.
Apply the configuration group
Ensure the group is applied: set apply-groups <group-name>
5. Verify inheritance
Check that the configuration is now applied:
show configuration | display inheritance show security policies
Note: In Junos, apply-groups only links the configuration group, while the when condition determines whether it is actually applied. If the condition does not match (for example, incorrect peers value), the group is ignored and its policies are not inherited into the active configuration.
apply-groups
2026-06-12 : Article Created
2026-06-16 : Non-tech changes