_posts/2017-2-24-Creating a local PFX copy of App Service Certificate.html [89:183]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Now you will have a new command called Export-AppServiceCertificate, use the command as follows
Export-AppServiceCertificate -loginId yourarmemail@domain.com -subscriptionId yoursubid -resourceGroupName resourceGroupNameOfYourAppServiceCertificate -name appServiceCertificateNameOnce the command is executed, you would see a new file in the current directory called ‘appservicecertificate.pfx’. This is a password protected PFX, the PowerShell console would display the corresponding password. For security reasons, do not store this password in a text file. You can use the password directly from the console as required. Also, don’t forget to delete the local PFX file once you no longer need it.
certutil -dump <path of the certificate file>You will see the list of the certificates that are part of the pfx from the root to your certificate. A pfx file created with the above steps with all the certificates of the chain contained is well formed and can be uploaded to App Service Web Apps with confidence. Note the CA part of the uploaded pfx file will be discarded when we process the uploaded certificate, we store all the intermediate certificates associated with the certificate to enable the chain to be remade properly in the runtime. Once all the export operation is complete and you have successfully uploaded your certificate clean your machine of any trace of the SSL certificate by deleting the certificate from the store to secure your certificate.
Title |
Azure portal Deployment |
Deploying local PFX copy |
Recommendations |
Auto/Manual Renew |
When an App Service Certificate is renewed, all the corresponding App Service SSL bindings are updated automatically |
When a certificate is renewed, you would need to manually update all the services that are using a local copy. |
Turn off Auto renew as you won’t know when exactly an App Service Certificate gets renewed with Auto renew and this would end up breaking your SSL endpoints. Manually renew such App Service Certificates before they expire |
Rekey |
Just like renewal, the corresponding SSL bindings are updated automatically |
Just like renewal, you would need to manually update all such services. |
|
Deployment |
When deploying certificate this way, you don’t need any file locally and there won’t be any secrets to clean up |
When deploying certificate this way, you would have the PFX certificate on local disk. |
Always delete the local copy once you no longer need it as you can create a PFX copy as many times as you want. Also, never store the password shown in PowerShell console locally. This way, even if somehow an adversary gets hold of your local disk, he still won’t be able to use the PFX certificate as it’s protected by a strong password |