Venafi / VenafiPS

Powershell module to fully automate your Venafi TLS Protect Datacenter and Cloud platforms!
https://venafips.readthedocs.io/
Apache License 2.0
18 stars 7 forks source link

How to check and enable/disable "Automatic Renewal" for a specific Certificate? #198

Closed HFS-CG closed 1 year ago

HFS-CG commented 1 year ago

Howdy!

I'm trying to use VenafiPS to generate a CSV with specific data about certificates in a specific Path. I need basic certificate details (easy), the "Management Type" (easy), and I need to know if "Automatic Renewal" is enabled/disabled (this is where I'm stuck).

We're running TPP 22.2, and I'm using VenafiPS 5.4.1 I've dug through all the product-documentation and tried all sorts of search-fu on the Warriors page, all to no avail.

At this point, I'd be willing to write something to dig-into the SQL database directly if I have to.

For clarification, this is what I'm trying to check/set via some sort of programmatic method;

image

gdbarron commented 1 year ago

@HFS-CG, you can get this value with Get-TppAttribute -Path <policy_path> -Attribute 'Disable Automatic Renewal' -Class 'X509 Certificate'

Xeleema commented 1 year ago

FYI: For me, I had to use the following scope, and I had to drop the -Class argument (to bypass critical "You are attempting to retrieve policy attributes, but $PATH is not a policy path" error). Note I’m using the same version of PoSH module & Venafi.

New-VenafiSession -Server $VTTP -Credential $cred -Clientld 'vert-cli' -Scope @{ 'configuration' = 'manage' }

Get-TppAttribute -Path $entry.Path -Attribute 'Disable Automatic Renewal'
gdbarron commented 1 year ago

It all depends on if you are trying to get the value set at the policy level or at the certificate level. To retrieve the value set on a policy, use mine. To retrieve the value set/inherited on a certificate, use yours. -Class can only be used on a policy and that error is expected if the path isn't a policy.

HFS-CG commented 1 year ago

@gdbarron @Xeleema Thanks for the help! This is a MUCH simpler solution for the script 👍