How to export Firewall security policy rules into a readable spreadsheet format using XML API?
55667
Created On 12/20/19 02:46 AM - Last Modified 05/17/23 07:35 AM
Objective
To Export Palo Alto Firewall rules into a readable spreadsheet format using XML API.
Environment
- Palo Alto Firewall.
- PAN-OS 7.1 and above.
Procedure
- Generate the key in order to export rules.
http(s)://hostname/api/?type=keygen&user=username&password=password
- Replace the hostname, username and password with the Firewall IP address, administrator username and password. Note down the generated Key.
- To import Security Rules, API should look like the one below:
https://hostname/api/?type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security&key=LUFRPT14MW5xOEo1R09KVlBZ
- Replace the 'hostname' with Firewall IP address.
- Replace the 'key' (LUFRPT14MW5xOEo1R09KVlBZ) with the one generated in Step 1.
- Once you have corrected the API call, copy the complete call.
- Open excel, click on Data and Click on 'From web'
- Under the address field, enter the API call and click on 'GO'
- Configuration should appear in XML format. Click on 'Import'
- Configuration should get imported in to excel.
Additional Information
In PAN-OS 8.1 and above, the firewall rules can be exported into a PDF/CSV format directly from the policy tab. Refer New features Guide for more details.