r/PowerShell • u/markdmac • Apr 01 '26
Question Any LastPass users here?
I just started a new job, at my last job we used KeePass and I was easily able to pull credentials from the vault into our scripts that were automated in bamboo.
My new employer uses LastPass and has 2FA enabled.
I already assume I will need to request that we get a service account that doesn't use 2 factor authentication to be able to pull creds dynamically. I have found 2 modules for LastPass but can't seem to get them to work.
Can anyone provide any guidance? Is there an API I can leverage instead of the modules or is there a combination of the two I need to use to establish a connection to the shared vault?
I am looking to schedule some scripts to run and don't want it to pause for 2FA, but for testing I am OK with being promoted for my personal code for now.
Any advice is greatly appreciated. This employer currently just uses LastPass interactively and isn't big on automation yet but hired me partly because of my experience with doing that. I didn't foresee LastPass being so difficult to access programmatically.
11
u/Mayki8513 Apr 01 '26
we used to use LastPass and i'd recommend to see If they're open to it and switch to bitWarden 😅, it lets you host your own instance so your credentials don't have to leave your network, their docs aren't too bad either
5
u/atomic_jarhead Apr 01 '26
It’s dangerous to use LastPass in my opinion. They were breached in August 2022 and again in December 2022. The second time was because they never patched the vulnerability from August. If that’s not enough, it happened the first time in 2011. They are just about due for another breach any time now.
3
u/cbtboss Apr 01 '26
The LastPass API solely is user provisioning focused, and doesn't have vault retrieval capabilities.
8
u/GreatHistorian7445 Apr 01 '26
I think you're running into a LastPass limitation more than a PowerShell one. Their public API is mostly about provisioning/admin, not clean unattended vault retrieval, so the modules usually end up leaning on `lastpass-cli` and an interactive session/token flow.
I would avoid solving this by disabling 2FA on a normal user account. If the scripts run in an AD environment, gMSA/JEA is a much cleaner pattern. If you need a real automation-friendly secret store, it's usually easier to move the automation secrets into something built for service/workload access and leave LastPass for interactive human use.
7
u/Agile_Seer Apr 01 '26
There's probably an API, but I use Bitwarden as one should.
6
u/SaltDeception Apr 01 '26
If you’re in an AD domain environment, see if Group Managed Service Accounts would fit the bill. That would take all credential retrieval out of the equation for you.
If you’re just needing something like local admin rights for a script, see if a JEA configuration using a virtual account would suffice.
If neither of those fits your needs, look into Secrets Management using the LastPass provider (which also requires lastpass-cli).
1
u/markdmac Apr 02 '26
Why do you say that? A random text file that was locked down to specific accounts. An encrypted database on a totally different server also locked down to specific accounts. Where is the problem?
1
u/asdftester1234 Apr 01 '26
For the KeePass coding, could you give a brief overview how that worked? That sounds much more secure in my opinion.
2
u/Reaction-Consistent Apr 01 '26
I’d highly suggest getting the company to switch away from LastPass due to its many data breaches, and use bitwarden or keeper. Both support sso, mfa and has a ton of other security features. LastPass doesn’t typically rank in the top 5 password management apps.
2
u/MyOtherSide1984 Apr 02 '26
Only use LastPass if you want to be completely unsecured. They should be using something like Bitwarden or Keeper or 1Password. Self hosted Bitwarden if possible and feasible IMO.
2
u/dan4334 Apr 03 '26
You need to use a proper secrets manager, like Hashicorp Vault, if you want to access credentials programmatically.
LastPass simply isn't the tool for the job. It's for storing passwords you need to log in to websites.
I would also strongly consider moving off of LastPass considering how many security issues they've had in the last few years. We switched to Keeper.
1
u/UnderstandingHour454 Apr 02 '26
Don’t use either! Use azure key vault and pull it that way . It requires authentication, but that’s easy with SSO.
1
u/coolbeaNs92 Apr 02 '26
The company I work for uses LP and it woeful.
I've tried to convince them to migrate to BW but to no avail.
1
u/Kind-Character-8726 Apr 03 '26
Surely nobody is still using lastpass