Improve certificate renewal workflow in deserialization failure scenario#2515
Merged
dpaulson45 merged 1 commit intomainfrom Mar 6, 2026
Merged
Improve certificate renewal workflow in deserialization failure scenario#2515dpaulson45 merged 1 commit intomainfrom
dpaulson45 merged 1 commit intomainfrom
Conversation
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
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
RawDataproperty to thePSCustomObjectwrapping theNew-ExchangeCertificateresult, enabling theImport-ExchangeCertificateFromRawDatafallback path to work correctly. - Added a null guard for
$c.RawDatainImport-ExchangeCertificateFromRawDatato gracefully skip certificates without raw data. - Improved the thumbprint deserialization check from
$null -neto[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
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-ExchangeCertificateFromRawDatafunction in case that deserialization of the certificate object has failed.Reason:
RawDataproperty was missing. Also, null-value scenarios inImport-ExchangeCertificateFromRawDatawere not covered.Fix:
RawDatato the custom objectImport-ExchangeCertificateFromRawDataValidation:
Lab