Skip to content

Improve certificate renewal workflow in deserialization failure scenario#2515

Merged
dpaulson45 merged 1 commit intomainfrom
lusassl-06032026-1
Mar 6, 2026
Merged

Improve certificate renewal workflow in deserialization failure scenario#2515
dpaulson45 merged 1 commit intomainfrom
lusassl-06032026-1

Conversation

@lusassl-msft
Copy link
Copy Markdown
Contributor

Issue:
Renewing the Auth Certificate failed in the latest implementation of the MonitorExchangeAuthCertificate.ps1 script. This is because we did not add the RawData to the custom object, which we pass to the Import-ExchangeCertificateFromRawData function in case that deserialization of the certificate object has failed.

Reason:
RawData property was missing. Also, null-value scenarios in Import-ExchangeCertificateFromRawData were not covered.

Fix:

  • Add RawData to the custom object
  • Handle null-value scenarios in Import-ExchangeCertificateFromRawData

Validation:
Lab

@lusassl-msft lusassl-msft requested a review from a team as a code owner March 6, 2026 15:36
@lusassl-msft lusassl-msft requested a review from Copilot March 6, 2026 15:38
@lusassl-msft
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a certificate renewal failure in the MonitorExchangeAuthCertificate script that occurred when the Get-ExchangeCertificate cmdlet failed to deserialize the certificate object. The fix ensures RawData is included in the custom object passed to Import-ExchangeCertificateFromRawData, and adds defensive null-checking for RawData in that function.

Changes:

  • Added RawData property to the PSCustomObject wrapping the New-ExchangeCertificate result, enabling the Import-ExchangeCertificateFromRawData fallback path to work correctly.
  • Added a null guard for $c.RawData in Import-ExchangeCertificateFromRawData to gracefully skip certificates without raw data.
  • Improved the thumbprint deserialization check from $null -ne to [System.String]::IsNullOrWhiteSpace() and added a diagnostic verbose log after certificate generation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Shared/CertificateFunctions/Import-ExchangeCertificateFromRawData.ps1 Added null check for RawData before attempting import, skipping certificates with missing raw data.
Admin/MonitorExchangeAuthCertificate/ConfigurationAction/New-ExchangeAuthCertificate.ps1 Added RawData to custom object, improved thumbprint validation with IsNullOrWhiteSpace, and added verbose logging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dpaulson45 dpaulson45 merged commit e25774b into main Mar 6, 2026
11 checks passed
@dpaulson45 dpaulson45 deleted the lusassl-06032026-1 branch March 6, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants