Skip to content

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

@sbeccato

Description

@sbeccato

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions