How to export Panorama security policy rules into a readable spreadsheet format using XML API?
17245
Created On 12/19/19 22:04 PM - Last Modified 12/20/19 03:37 AM
Objective
To Export Panorama rules into a readable spreadsheet format using XML API.
Environment
- Any Panorama.
- Any PAN-OS.
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 Panorama IP address, administrator username and password. Note down the generated Key.
- To import pre-rules, API should look like the one below:
https://hostname/api/?type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Anchorage Lab']/pre-rulebase/security&key=LUFRPT14MW5xOEo1R09KVlBZNnpnemh9
- Replace the 'hostname' with Panorama IP address.
- Replace 'Anchorage Lab' replace this with device group you have configured on Panorama.
- Replace the 'key' (LUFRPT14MW5xOEo1R09KVlBZNnpnemh9) with the one generated in Step 1.
- To import post-rules, API should look like the one below:
https://hostname/api/?type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Anchorage Lab']/post-rulebase/security&key=LUFRPT14MW5xOEo1R09KVlBZNnpnemh9
- Replace the 'hostname' with Panorama IP address.
- Replace 'Anchorage Lab' replace this with device group you have configured on Panorama.
- Replace the 'key' (LUFRPT14MW5xOEo1R09KVlBZNnpnemh9) 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 security policy rules can be exported into a PDF/CSV format directly from the policy tab. Refer New features Guide for more details