Technical Tip: How to use scripts to add URL lists in FortiManager
Description
FortiManager can reduce the effort required in configuring many FortiGates.
One example of this is the ability to use scripts to populate potentially large URL lists and then install them on multiple FortiGates.
Scope
This article shows how to run a script to add 3 URL entries to a URL filter.
You can use a similar approach to populate other objects.
Solution
The syntax used in the script is same as would be used to configure webfilter url list on FortiGate directly.
config webfilter urlfilter
edit 3
set name "Microsoft O365 Allow"
config entries
edit 1
set url "*.lync.com"
set type wildcard
set action allow
next
edit 2
set url "*.teams.microsoft.com"
set type wildcard
set action allow
next
edit 3
set url "teams.microsoft.com"
set action allow
next
end
next
end
Consider the following
1 Webfilter profile uses URL Table List
2 URL table list may change from FortiGate to FortiGate
3 If you need to sync all of your FortiGates, consider using the same webfilter with the same Webfilter table
FortiManager can reduce the effort required in configuring many FortiGates.
One example of this is the ability to use scripts to populate potentially large URL lists and then install them on multiple FortiGates.
Scope
This article shows how to run a script to add 3 URL entries to a URL filter.
You can use a similar approach to populate other objects.
Solution
The syntax used in the script is same as would be used to configure webfilter url list on FortiGate directly.
config webfilter urlfilter
edit 3
set name "Microsoft O365 Allow"
config entries
edit 1
set url "*.lync.com"
set type wildcard
set action allow
next
edit 2
set url "*.teams.microsoft.com"
set type wildcard
set action allow
next
edit 3
set url "teams.microsoft.com"
set action allow
next
end
next
end
To create the script, go to:
Device Manager > Scripts > Create new > Run script on "Policy Package or ADOM Database"
Device Manager > Scripts > Create new > Run script on "Policy Package or ADOM Database"

Once the script has been run. You can then modify the webfilter profile to reference the new URL list.

Consider the following
1 Webfilter profile uses URL Table List
2 URL table list may change from FortiGate to FortiGate
3 If you need to sync all of your FortiGates, consider using the same webfilter with the same Webfilter table
