How to export Panorama security policy rules into a readable spreadsheet format using XML API?

How to export Panorama security policy rules into a readable spreadsheet format using XML API?

17503
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


  1. 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.
  1. 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' (LUFRPT14MW5xOEo1R09KVlBZNnpnemh9with the one  generated in Step 1.
  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' (LUFRPT14MW5xOEo1R09KVlBZNnpnemh9with the one  generated in Step 1.
  1. Once you have corrected the API call, copy the complete call.
  2. Open excel, click on Data  and  Click on 'From web'
  3. Under the address field, enter the API call and click on 'GO'
  4. Configuration should appear in XML format. Click on 'Import'
  5. 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


Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA10g000000PNutCAG&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail