Skip to content
Notifications
Clear all

Walkthrough: Automating service account updates with the CLI

7 Posts
7 Users
0 Reactions
83 Views
(@clarag)
Reputable Member
Joined: 4 months ago
Posts: 274
Topic starter   [#12866]

Hi everyone! 👋 I’m new to Delinea and have been tasked with streamlining our service account management, especially the rotation and updates.

In my last role, we used a different PAM and I'm still getting a feel for the Delinea CLI. I'd love to hear from the community: what's your real-world workflow for automating service account updates? Any scripts or scheduling tips you can share? I'm particularly interested in how it ties into project timelines and resource tracking.



   
Quote
(@ashp99)
Honorable Member
Joined: 4 months ago
Posts: 377
 

Welcome! Rotating service accounts with the CLI is a huge time saver once you get it set up.

For project tracking, we just added a small wrapper script that logs every successful password update (using the CLI's `--output json` flag) to a simple CSV. We then pipe that into a shared dashboard. It's not fancy, but it gives the team visibility into what's been updated and when, which helps with audit trails.

Our biggest tip is to start by automating just one non-critical service account to iron out your process. The CLI's pretty reliable, but you'll want to build in some error checking for when a target system is unreachable. Good luck!


data over opinions


   
ReplyQuote
(@annab)
Reputable Member
Joined: 4 months ago
Posts: 349
 

That's a really good point about the error checking for unreachable systems. It makes me wonder, what kind of error checking did you build in? Do you have the script retry after a delay, or does it just fail and send an alert?

The logging to a CSV for visibility sounds simple but effective. I like that approach because it doesn't overcomplicate things. Have you run into any issues with the format of the CLI's JSON output changing between versions, or has it been pretty stable?



   
ReplyQuote
(@alexm)
Honorable Member
Joined: 4 months ago
Posts: 479
 

The CSV logging approach is fundamentally sound for visibility, but it introduces a data management problem at scale. We found that logging every CLI operation directly to a CSV, as described, led to file locking issues when multiple automation jobs ran concurrently, and parsing for dashboards became a bottleneck.

You'll want to decouple the logging from the CLI execution. Our pattern uses a simple message queue or a dedicated logging agent - the script invokes the CLI, captures the JSON output, and immediately emits it as an event to a separate collector. This avoids the "append-only CSV" bottleneck. The collector then handles persistence, whether to a SQL table for querying or a time-series database for the dashboard.

The stability of the JSON schema is a valid concern. We mitigate that by version-pinning the CLI tool in our automation environment and implementing a schema validation step in the collector. If the JSON structure from a new CLI version is unexpected, the event is quarantined for manual inspection rather than breaking the pipeline.



   
ReplyQuote
(@code_weaver_anna)
Prominent Member
Joined: 8 months ago
Posts: 563
 

Starting with the CLI for automation is the right move. We treat password rotations as a scheduled job, similar to CI/CD pipelines. The core of our workflow is a simple Python script that calls the CLI, but the key is wrapping it with the same retry logic we use for API calls.

We schedule it via our existing task runner (Celery), but cron works fine. The project tracking angle is interesting - we tag each rotation job with the project's JIRA or issue number from an environment variable. That metadata gets logged alongside the CLI's JSON output to our logging system, not a CSV, which creates an audit trail tied directly to development cycles.

For your first run, I'd suggest mocking the CLI call to test your logging and error handling before touching a real account. That lets you verify the integration with your project tracking without any risk.


benchmark or bust


   
ReplyQuote
(@eval_newbie_2025)
Honorable Member
Joined: 6 months ago
Posts: 370
 

Mocking the CLI call first is such a good, safe idea, thanks for that! I would have probably jumped straight in and caused a mess.

I really like the idea of tagging jobs with the project's JIRA number. It seems like a clean way to link the infrastructure work back to business reasons. Do you store that project tag in the same log entry as the CLI's success/failure output? I'm trying to picture how you'd query that later to see all the rotations done for a specific project.



   
ReplyQuote
(@backend_latency_queen)
Honorable Member
Joined: 6 months ago
Posts: 613
 

Exactly. We embed the JIRA tag as a field in the same structured log event that contains the CLI's JSON. The key is using a logging library that supports this, rather than just printing to stdout.

For example, in our Go implementation, the log entry is a JSON object itself. It includes the parsed CLI output *and* the contextual tags like `project_key: "PROJ-123"`. This makes querying trivial. We can filter for `project_key` in our logging platform (we use Loki) to see all related rotations, or even join on that field in our audit database.

The caveat is you need to ensure your log ingestion pipeline can handle nested JSON properly. Some systems flatten everything, which would break this.


sub-100ms or bust


   
ReplyQuote