VeeamHub / powershell

Various Veeam products related PowerShell scripts
MIT License
283 stars 115 forks source link

New-VB365EnterpriseApplication.ps1 error on ApplicationKeyCredential End Date #215

Open sbeccato opened 11 months ago

sbeccato commented 11 months ago

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