Inside DigitalOcean’s SOX Compliance Playbook

Baton docs

Getting started with the Baton CLI

Welcome to Baton! If you're looking for a quick and easy way to extract, compare, and explore identity, resource, and permission data in an app, the command line interface (CLI) is the perfect tool for you.

In this guide you can find basic information about the Baton CLI. Together we will go through the basic concepts and show you how to install and use the CLI.

How to set up Baton

Setting up Baton requires two steps.

  1. Use this command to install Baton:

    $ brew install conductorone/baton/baton
    

    If you don’t have Homebrew installed yet, follow this guide.

  2. Inspect the baton utility using this command:

    $ baton --help
    

That’s it! Baton is up and running.

How to use the Baton CLI

After successful installation, you will see a list of all available commands in the console.

Using the Baton CLI is very simple:

  1. Type as a basic command into the console baton.
  2. Attach the command you want to use.
  3. Execute command.
  • c1z files contain all of the information that the connector has collected as part of a synchronization process. Using the Baton CLI, you can browse the contents of the sync.c1z file and export that data to a .csv or .xlsx file.
baton is a utility for working with the output of a baton-based connector

Usage:
  baton [command]

Available Commands:
  access         List effective access for a user
  completion     Generate the autocompletion script for the specified shell
  diff           Perform a diff between sync runs
  entitlements   List entitlements
  export         Export data from the C1Z for upload
  grants         List grants
  help           Help about any command
  principals     List principals
  resource-types List resource types for the latest (or current) sync
  resources      List resources for the latest sync
  stats          Simple stats about the c1z

Flags:
  -f, --file string            The path to the c1z file to work with. (default "sync.c1z")
  -h, --help                   help for baton
  -o, --output-format string   The format to output results in: (console, json) (default "console")
  -v, --version                version for baton

Use "baton [command] --help" for more information about a command.
CommandDescriptionReturns
accessList effective access for a user.-
completionGenerate the auto completion script for the specified shell. The shell reads the file and executes individual commands that are placed on separate lines.-
diffPerform a diff between sync runs. Diff is used to show the changes between two versions of the same file.-
entitlementsList all entitlements.ID, Resource, Entitlement
exportExport data from the baton..csv, .xlsx
grantsProvides a list of all permissions for an active logged-in user.Resource, Entitlement, Principal
helpProvides help for any command you use.All available commands.
principalsProvides list of principals.
principals compareAllows you to easily compare the principals that have been granted one entitlement versus the other. Can compare across source files.
resource-typesList resource types for the latest (or current) sync.ID, Display Name, Resource Type, Parent Resource
resourcesList resources for the latest (or current) synch.ID, Display Name, Resource Type, Parent Resource
statsSimple stats about the baton.entitlements, grants, resource_types
usersList user resources with more detail.ID, Display name, Login, Email, Profile Image

What’s next?

Baton offers a lot of features and benefits for developers. One of the most powerful features is the ability to integrate with third-party systems like GitHub. This allows you to keep track of user rights updates in your GitHub repositories and, for example, see a diff of changes to the system at a set time every day.

Visit our tutorial Export GitHub access updates to a CSV file using Baton for more information.

Another way to use the SDK is to insert SDK as a basic layer in your applications. This can be helpful in case you want to add some extra functionality to your apps without having to start from scratch. By using the SDK as a foundation, you can save yourself time and effort while still being able to take advantage of all the features that Baton offers.

Check out our SDK getting started guide and learn how to integrate the SDK into your application.