Powershell wrapper to securely authenticate with Neo4J and execute CYPHER using Bolt

I wrote a powershell wrapper to store datasource information to allow a method to securely store/retrieve user/password to connect to a Neo4j database using BOLT via powershell and run a cypher query. This allows for automation without having to store your neo4j credentials in clear text within a powershell script.

As I'm moving some of my connected enterprise project into semi-production use I needed to run some CYPHER on a schedule but want to do this securely.

Thanks to Gelnn Sarti for his post that got me started on this path.

Here's my blog post describing it in more detail.

And the scripts in github

1 Like

UPDATE:
I've expanded on this tool to include a method to log/debug .cypher script execution results (by transaction), and also to perform replacement of a placeholder for secured credentials that are stored as a secure-string in the registry. (This is great for user/password/apikey/tokens that you want to use in your cypher).

Metadata for results of each transaction can optionally be logged into a neo4j graph database, including any exception errors thrown. It will track items like # of labels/relationships/indexes added/removed or properties modified. It also will provide a "section" name to your code if you place it in the comments of your source cypher:

//SECTION data import using apoc

will add the section header "data import using apoc" to the log entry to more easily find a script area you are debugging results for.

Here's the blog post with more details.

And the scripts in github

1 Like

Thanks for submitting!

I’ve added a tag that allows your blog to be displayed on the community home page!

I'd like to hear back if anyone can test this for me. It seems to be working pretty well for me in my environment.

I'm not sure how many folks out there run .cypher scripts from a Windows platform, but some feedback if this is helpful or useful to anyone would be appreciated.

Thanks!

1 Like