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

Create-SecureCertificatePassword #67

Closed floaton1 closed 1 year ago

floaton1 commented 1 year ago

I'm down to creating the secure certificate password. I'm having issues, I think from inexperience. I can run this script and set a password but I'm not understanding how this relates to the registered app. I feel like I need to pull the cert password from the cert I created and assigned to the application. Do I need to be in the folder where I have the cert stored to pull the cert password with the commands in the getting started folder? Sorry if this is a silly question. Thanks,

grahamr975 commented 1 year ago

@floaton1

See Step 3 of the Azure App Tutorial. When generating & exporting the certificate using PowerShell, you can assign a password of your choosing when exporting the certificate as a .pfx file.

# Export certificate to .pfx file
$mycert | Export-PfxCertificate -FilePath mycert.pfx -Password (Get-Credential).password

Then, you'd also export without a password as a .cer file.

# Export certificate to .cer file
$mycert | Export-Certificate -FilePath mycert.cer

From here, upload the .cer file into your Azure app. You'll then use the .pfx file & password in your script to authenticate to your Azure app.

You will pass the full path to your stored password file & .pfx certificate into the script as parameters, but don't necessarily need to place them in the same folder as your script.