VeeamHub/powershell

New-VB365EnterpriseApplication.ps1 error on ApplicationKeyCredential End Date

Opened this issue · 0 comments

Describe the bug
Got error executing the script.
The problem is during this call at line 93: New-AzureADApplicationKeyCredential
For some reason using this method "-EndDate $cert.GetExpirationDateString()" return the error described as if the EndDate retrieved were after the effective certificate end date.

I solved this issue using "$cert.NotAfter" instead "$cert.GetExpirationDateString()".
I modified also the start date, using "$cert.NotBefore".

Line 93 could be:
New-AzureADApplicationKeyCredential -ObjectId $app.ObjectId -CustomKeyIdentifier $base64Thumbprint -Type AsymmetricX509Cert -Usage Verify -Value $base64Value -StartDate $cert.NotBefore -EndDate $cert.NotAfter | Out-Null

To Reproduce
Steps to reproduce the behavior:

  1. Execute the script

Screenshots
image