Reputation: 3
I am trying to fetch Cert subject name and Cert Expiry date for a given windows azure subscription, i am unable to fetch the expiry date using get-azurecertificate, kindly help.
Upvotes: 0
Views: 232
Reputation: 810
Actually, the data property contains the base64 formatted data of the certificate. If you export this field to a cer file, it is a certificate. Here is the screenshot of my lab:
To decode it directly in Powershell, please try the following commands:
$certlist = Get-AzureCertificate -ServiceName stlcs01
$data = $certlist[0].Data
$cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]([System.Convert]::FromBase64String($data))
$cert | fl *
I've tested it in my lab, it works for me.
Here is the screenshot:
Upvotes: 3