PyBritive is a Python-based, full-featured command line interface for Britive. PyBritive supports both end-user as well as admin features. PyBritive is an open-source project, and we invite participation from all our users.
![](https://www.britive.com/wp-content/uploads/2024/07/admin-function-embed-1024x407.png)
We have designed PyBritive to simplify developer workflows and reduce the toll on the users. In this blog, I would like to discuss admin functions available via PyBritive. Whether reporting on existing users and access data or adding new applications and environments, PyBritive can help. PyBritive exposes Britive’s admin APIs via the pybritive api
command. Let’s look at a few examples.
Managing Users
Britive’s Users API can be invoked to carry out various functions like getting a list of users, deactivating a certain user, or resetting the MFA settings of a user. I often find myself leveraging the --format
option to get the output in the desired format.
pybritive api users.list -f csv >> users.csv
The example above will allow me to get the list of all users and store them in a CSV file. We can also use filtering options like below.
pybritive api users.list --filter-expression "status eq active" -f json
The above example will give a list of active users only and in a JSON format. Further string manipulation or using the output of this command in a subsequent process can be very powerful.
PyBritive’s Shell completion can also come in very handy when using these commands for the first time. The shell completion is available for Bash, Fish, and Zsh shells.
![:light_bulb_on:](https://pf-emoji-service--cdn.us-east-1.prod.public.atl-paas.net/atlassian/light_bulb_on_32.png)
The shell completion does come in handy when you are just getting started with PyBritive. I also find myself using tools like jq to filter the JSON results and get to the desired outcomes quickly.
More information on how to set up shell completion can be found in our PyBritive documentation.
Managing Applications
Some of my favorite and frequently used commands are kicking off scans or listing applications currently configured in the environment.
pybritive api applications.scan --application-id T1jmGXXXXXXXslD
The above command will help you kick off a data scan for the application. The application ID can be captured from the URL of the application from the browser or by running the applications.list
to take stock of the configured applications.
pybritive api applications.catalog -f json
This command will list all applications available to be configured within Britive. As we add OOB support for additional applications, the list will grow.
The last on the list for me is the applications.test
which allows you to test the configurations and verify that Britive can connect and fetch the right data from the application. This can also be used as a heartbeat endpoint for app connections.
pybritive api applications.test --application-id T1jmGXXXXXXXslD
Managing Profiles
The last one I would mention here is listing profiles for an application. This will allow you to spot-check the integrity status of every profile or verify some of the other details like the environment associations.
pybritive api profiles.list --application-id T1jmGXXXXXXXslD
Closing
Command-line interfaces, or “CLIs”, like pybritive
can help meet automation needs, simplify day-to-day administrative tasks, and provide users with another powerful tool in their proverbial tool-belt.
You can visit the documentation page for more options and review all available PyBritive commands. Please do not hesitate to reach out to a member of our team to schedule time for a demo.