grahamr975 / EWS-Office365-Contact-Sync

Uses Exchange Web Services to synchronize a Global Address List in Office 365 to a user's mailbox
MIT License
98 stars 21 forks source link

Failed to load the Certificate (then failed to fetch GAL contacts) #102

Closed nbwork closed 8 months ago

nbwork commented 8 months ago

Followed the instructions, but I think I may have something wrong with the certificate or the certificate password. I don't think I am completely understanding how to use Create-SecureCertificatePassword.ps1:

VERBOSE: Importing function 'Connect-ExchangeOnline'. VERBOSE: Importing function 'Connect-IPPSSession'. VERBOSE: Importing function 'Disconnect-ExchangeOnline'. VERBOSE: Computed version info: 3.2.0 VERBOSE: ModuleVersion: 3.2.0 PS>TerminatingError(Get-ConnectionContext): "Failed to load the Certificate, this can be because of any of the following reasons.

  1. Certificate file referred by CertificateFilePath is not a valid Certificate file.
  2. Missing or invalid CertificatePassword provided to load the certificate. InnerException : The specified network password is not correct. " VERBOSE: ConnectionContext Removed PS>TerminatingError(): "The specified network password is not correct. " PS>TerminatingError(Write-Log): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to fetch Global Address List Contacts from Office 365 Directory"

    TerminatingError(Write-Log): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to fetch Global Address List Contacts from Office 365 Directory" TerminatingError(Write-Log): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to fetch Global Address List Contacts from Office 365 Directory" TerminatingError(Write-Log): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to fetch Global Address List Contacts from Office 365 Directory" The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to fetch Global Address List Contacts from Office 365 Directory Write-Log : Failed to fetch Global Address List Contacts from Office 365 Directory At line:85 char:3

    • Write-Log -Level "FATAL" -Message "Failed to fetch Global Add ...
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Log

Windows PowerShell transcript end End time: 20240204154251


nbwork commented 8 months ago

I had to change the script to prompt me for the certificate password, and then I was able to create the correct SecureCertificatePassword.xml.

$SecureString = Read-Host "password" -assecurestring

(it prompted me for the password, which I pasted in, then:)

$SecureString | Export-Clixml .\SecureCertificatePassword.xml