Shravan
Shravan

Reputation: 3

fetch Cert subject name and Cert Expiry date for Microsoft azure subscription

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

Answers (1)

Steven Lee - MSFT
Steven Lee - MSFT

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:

GUI

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:

Powershell

Upvotes: 3

Related Questions