Show Local Device Policies

L2 Linker

Show Local Device Policies

Hi all,


I'm searching through the API browser on my PAN-OS 8 instance, and wondering where the syntax exists for exploring/getting the local policies per-physical device.


Or for clarity's sake - what API endpoint would return all of the local device's security policies. I am using some from Panorama globally, and cleaning up local security policies.


Not asking for someone to write a query for me, just point me to the right place in the API, please.


Any help appreciated!



Tags (2)
L4 Transporter

Re: Show Local Device Policies

Policies on firewalls are located in `rulebase` under the vsys (for vsys1 below):




Policies on panorama are split between `pre-rulebase` and `post-rulebase` (for device group `Some group` below):


/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Some group']/pre-rulebase

/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Some group']/post-rulebase

L2 Linker

Re: Show Local Device Policies

Awesome, thanks so much @gfreeman!

L2 Linker

Re: Show Local Device Policies

@gfreeman, if I enter:




into the XPath search in the API browser, I get a 403 response of:


panCmsHandleDeviceContextReq: getRemoteContent() got response code 403


and same response if I try and submit:




I'm a super user on my Panorama instance, and have 1 vsys in it, so not sure why that query when hitting submit isn't working.



L2 Linker

Re: Show Local Device Policies

Ended up realizing my own fail - was using the URL for panorama and not the device I wanted to target (d'oh!)


For anyone seeing this later, here's a Powershell function I wrote to pull the information I was after:

Function Get-LocalDeviceSecurityPolicies($DeviceIP)
$response = Invoke-RestMethod "https://$DeviceIP/api/?key=$apiKey&type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security"
return $

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!