Skip to main content
MaAtVA
Explorer
February 9, 2026
Solved

How determine newly created policy id:

  • February 9, 2026
  • 2 replies
  • 225 views

Hello, i create a new poliy directly on fortigate CLI with:

 

config firewall policy
Description: "My Policy"
edit 0
set name "MyPolicy"
set action accept
set dstintf IFACE_01
set dstaddr MyDstServer
set srcintf IFACE_02

set srcaddr MySrcServer

set service HTTP
set schedule always
set schedule-timeout disable
set status enable
set logtraffic all
end

 

The command does not return the newly created policyid, since i want to create some batch operation where i have to place the policy before a specific other policy, is there an easy way to return the created policyid, i only know the command

 

get firewall policy

 

where i have to use the last ID.

Best answer by ede_pfau

What @funkylicious posted is key here: the newest policy is the sequentially last policy.

Try this:

conf fire policy

ed ?

 

The last listed ID is the newest one.

Should be visible in the GUI in "sequential view" mode as well but I haven't tested that.

 

Then you can re-position the policy by

"move 23 before 51"

where policy #23 is relocated just above policy #51.

2 replies

funkylicious
SuperUser
SuperUser
February 9, 2026

hi,

usually that's how you can identify a newly created policy from cli.

when you assign 0, the fw would later assign the next id that is available and place the rule at the end/last.

"jack of all trades, master of none"
ede_pfau
SuperUser
ede_pfauAnswer
SuperUser
February 9, 2026

What @funkylicious posted is key here: the newest policy is the sequentially last policy.

Try this:

conf fire policy

ed ?

 

The last listed ID is the newest one.

Should be visible in the GUI in "sequential view" mode as well but I haven't tested that.

 

Then you can re-position the policy by

"move 23 before 51"

where policy #23 is relocated just above policy #51.

Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
Fortinet Flag the Hack. Wednesday, August 26, 9:00 AM - 5:00 PM ET, COSM, Atlanta, GA.
Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!