Creating an administrator account on Panorama using Pan-OS Python SDK kit

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating an administrator account on Panorama using Pan-OS Python SDK kit

L0 Member

Hey guys,

 

Hope all of you are doing well.

 

I recently started using the panos python module to interact and automate some of the things I'm doing on Panorama GUI. I wanted to know how to add a administrator account using the device.administrator class. This is the code I have written as of now:

 

from panos.panorama import Panorama
from panos import objects
from panos import device

# connect to panorama
pano = Panorama('ip_addr', 'name', 'password')

myDevice = device.Administrator(name = 'testcase', authentication_profile = 'organization_based', device_admin_read_only = True, password_hash = 'adminaccounttest1')

pano.add(myDevice)
#pano.find(myDevice)
myDevice.create()

pano.commit('password')

 

Thanks a lot!

1 REPLY 1

L5 Sessionator

The password hash has to be created using the function:

 

https://pan-os-python.readthedocs.io/en/latest/module-device.html#panos.device.Administrator.change_...

 

Alternatively, you can use this to create the password and use the value returned as the panos.device.Administrator.password_hash value:

 

https://pan-os-python.readthedocs.io/en/latest/module-base.html#panos.base.PanDevice.request_passwor...

 

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 LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!