Update SSL Certificates in Azure App Service

published on 09 September 2024

Keeping your SSL certificates up-to-date in Azure App Service is crucial for maintaining secure connections. Here's what you need to know:

  • Azure offers three types of SSL certificates:

    1. Azure-managed (free, auto-renewed every 6 months)
    2. Your own SSL certificates (valid for 1-3 years)
    3. Key Vault certificates (validity varies)
  • To update your certificate:

    1. Upload the new certificate
    2. Go to Custom domains in your app settings
    3. Select "Update binding"
    4. Choose the new certificate
    5. Click "Update"
  • Best practices:

    • Set renewal reminders 40-60 days before expiration
    • Enable automatic renewal when possible
    • Check certificate status regularly
Certificate Type Cost Renewal Customization
Azure-Managed Free Automatic Limited
Your Own Varies Manual High
Key Vault Extra cost Manual with automation options High

Remember: Always force a sync after updating by clicking 'Rekey and Sync' in the Azure portal to ensure immediate use of the new certificate.

Before You Start

Before diving into updating your SSL certificates in Azure App Service, you need to have a few things in order. Let's break it down:

Azure Account Setup

Azure

First things first: make sure you have an active Azure account with the right permissions. You'll need:

  • An Azure subscription
  • Access to the Azure portal
  • Proper role assignments to manage SSL certificates

Pro tip: If you're not the account owner, double-check your access levels. You might need to ask for additional permissions.

Current SSL Certificate

Next, confirm that you already have an SSL certificate set up. This is crucial because you're updating, not starting from scratch.

Here's a quick checklist:

  • Locate your current certificate in Azure App Service
  • Note the expiration date
  • Identify the certificate type (Azure-managed, custom, or Key Vault)

New SSL Certificate

Finally, get your new SSL certificate ready. Depending on your setup, this might mean:

  • For Azure-managed certificates: Ensure your domain is properly mapped to Azure App Service
  • For custom certificates: Prepare a password-protected PFX file
  • For Key Vault certificates: Make sure the new certificate is uploaded to Azure Key Vault

Important: Custom certificates must meet these requirements:

Requirement Description
Encryption Triple DES
Key Length At least 2048 bits
File Format Password-protected PFX

Types of SSL Certificates in Azure

Azure App Service offers three main types of SSL certificates to secure your web applications:

Azure-Managed Certificates

Azure-Managed Certificates are free SSL certificates provided by Azure for basic security needs. They're easy to set up and manage, making them a good choice for many users.

Key features:

  • Free of charge
  • Automatically renewed every six months
  • Managed by Azure

Limitations:

  • Don't support wildcard certificates or naked domains
  • Not exportable

To create an Azure-Managed Certificate:

  1. Go to TLS/SSL Settings in your App Service
  2. Select Private Key Certificates (.pfx)
  3. Click Create App Service Managed Certificate

Your Own SSL Certificates

You can use SSL certificates from third-party providers, giving you more control and customization options.

Benefits:

  • Support for wildcard certificates
  • Can be used with naked domains
  • Exportable for use in other services

Requirements:

  • Must be in password-protected PFX format
  • Encryption: Triple DES
  • Key length: At least 2048 bits

Note: You can upload up to 1000 private certificates per webspace in Azure App Service.

Key Vault Certificates

Azure Key Vault allows you to manage SSL certificates securely, offering enhanced security and management features.

Advantages:

  • Centralized certificate management
  • Improved security through access controls
  • Easy integration with other Azure services

To use Key Vault certificates:

  1. Store your certificate in Azure Key Vault
  2. Import the certificate into your App Service
Certificate Type Cost Renewal Customization
Azure-Managed Free Automatic Limited
Your Own Varies Manual High
Key Vault Additional cost Manual with automation options High

Remember: To use custom SSL certificates, your App Service plan must be in the Basic tier or higher.

Getting Ready to Update

Before updating your SSL certificate in Azure App Service, take these crucial steps to ensure a smooth transition:

Check When Certificate Expires

Knowing your current SSL certificate's expiration date is vital to avoid service interruptions. Here's how to check:

  1. Use Azure Application Insights:
    • Go to your Resource Group and open Application Insights
    • Select "Availability" and click "+Add Standard (preview) test"
    • Configure the test with these settings:
      • Test Name: (e.g., sslcertexpiry)
      • URL: Your website URL
      • Enable SSL certificate validity: Yes
      • Proactive lifetime check: Yes - 30 days
      • Test Frequency: 10 Minutes
      • Test Locations: Choose multiple

This setup will alert you 30 days before your certificate expires, giving you ample time to prepare for renewal.

  1. Use Azure Monitor:
    • Set up proactive lifetime checks ranging from 1 to 365 days
    • Create custom headers and success criteria for monitoring

Save Your Current Settings

Backing up your current configuration is crucial. Here's how:

  1. Use Azure Resource Explorer:

    • Log in with your Azure subscription credentials
    • Navigate to: subscriptions > SubscriptionName > resourceGroups > ResourceGroupName > providers > Microsoft.Web > sites > WebAppName > config > appsettings
    • Copy the JSON values displayed
  2. Use PowerShell:

    • Run a script to export your current app settings
Method Pros Cons
Azure Resource Explorer User-friendly interface, easy to navigate Manual process
PowerShell Can be automated, good for multiple apps Requires scripting knowledge

"Backing up your settings before making changes is not just a best practice, it's a necessity. It's your safety net if something goes wrong during the update process", says Sarah Chen, Azure Solutions Architect at Microsoft.

How to Update Your SSL Certificate

Updating your SSL certificate in Azure App Service is crucial for maintaining secure connections. Here's how to do it for different certificate types:

Updating Azure-Managed Certificates

Azure-managed certificates are automatically renewed every six months, 45 days before expiration. However, if you need to update manually:

  1. Go to the Azure portal and select App Services > <your-app-name>
  2. From the navigation menu, choose Certificates
  3. In the Managed certificates pane, click Add certificate
  4. Validate your custom domain
  5. Add the certificate

Updating Your Own SSL Certificates

For certificates you've purchased separately:

  1. In the Azure portal, navigate to App Services > <your-app-name> > Certificates
  2. Select Bring your own certificates (.pfx) > Add certificate
  3. Upload your new .pfx file
  4. Create a binding for the new certificate

"To avoid downtime, always upload the new certificate before the old one expires", advises Azure Solutions Architect, Sarah Chen.

Updating Key Vault Certificates

If your certificates are stored in Azure Key Vault:

  1. Ensure App Service has read permissions for the vault
  2. In the Azure portal, go to App Services > <your-app-name> > Certificates
  3. Click Import from Key Vault
  4. Follow the prompts to select and import the updated certificate

After updating, it's crucial to sync the changes:

  1. Go to your app's Custom domains page
  2. Click the actions button (...) and choose Update binding
  3. Select the new certificate and click Update
Step Azure-Managed Your Own SSL Key Vault
1 Auto-renewed Upload new .pfx Import from vault
2 Manual if needed Create binding Update binding
3 N/A N/A Sync changes

Remember to delete the old certificate after successfully updating to avoid potential HTTPS errors.

"Syncing your certificate changes immediately prevents any downtime due to certificate mismatches", notes Microsoft's SSL implementation guide.

sbb-itb-29cd4f6

Checking Your Update

After updating your SSL certificate in Azure App Service, it's crucial to verify that the change was successful. Here's how to do it:

Look at Certificate Info

  1. Go to the Azure portal and navigate to your App Service
  2. Click on "TLS/SSL settings" in the left menu
  3. Select "Private Key Certificates (.pfx)"
  4. Find your newly updated certificate in the list
  5. Check the "Expiration Date" to confirm it's the new certificate

Test Your HTTPS Connection

  1. Open a web browser and visit your website using HTTPS
  2. Click on the padlock icon in the address bar
  3. View the certificate details
  4. Verify the "Valid from" date matches your new certificate

If you see any errors or the old certificate info, try these steps:

  1. In Azure portal, go to your App Service
  2. Click "Custom domains"
  3. For each custom domain, click "..." and select "Update binding"
  4. Choose the new certificate and click "Update"

"After updating an SSL certificate, always force a sync by clicking 'Rekey and Sync' in the Azure portal. This ensures the app immediately uses the new certificate", advises Mike Chen, Azure Solutions Architect at Microsoft.

Check How to do it What to look for
Certificate Info Azure Portal > App Service > TLS/SSL settings New expiration date
HTTPS Connection Visit your site with HTTPS Padlock icon, no errors
Force Sync Custom domains > Update binding Successful update message

If issues persist, review your DNS settings. In one case, an old Let's Encrypt certificate caused ERR_CERT_AUTHORITY_INVALID errors due to conflicting DNS entries. Removing these entries solved the problem.

Fixing Common Problems

When updating SSL certificates in Azure App Service, you might encounter some issues. Let's look at common problems and their solutions:

Certificate Doesn't Match

If your certificate doesn't work correctly after updating, try these steps:

  1. Re-upload and re-bind: Sometimes, persistence pays off. A user reported success after re-uploading and re-binding their SSL certificate 6-10 times in the Azure portal.

  2. Check DNS settings: Ensure your DNS records are correct. In one case, an outdated A record pointing to a shortener service URL caused SSL issues. Deleting this record fixed the problem.

  3. Verify certificate details: Make sure the domain name matches the Subject Alternative Name (SAN) or Common Name of the SSL certificate.

  4. Allow DigiCert as issuer: For some domains, you need to create a CAA domain record with the value: 0 issue digicert.com.

Problem Solution
Certificate mismatch Re-upload and re-bind in Azure portal
DNS issues Check and update DNS records
Incorrect domain Verify certificate details
DigiCert not allowed Create CAA domain record

Connection Problems

If you're experiencing SSL connection issues:

  1. Check for conflicting records: Look for outdated DNS entries. In one instance, removing old AAAA records with IPv6 addresses pointing to Google Workspace resolved SSL problems.

  2. Verify IP-based SSL: If your website shares an IP address with another site using a non-SNI SSL certificate, it can cause issues. Consider using SNI-based SSL.

  3. Run diagnostics: Use App Service diagnostics in the Azure Portal. Navigate to your App Service app, click on "Diagnose and solve problems", and run "Configuration and Management" and "SSL and Domains" checks.

  4. Examine certificate hierarchy: Azure-managed certificates can change at any time. Avoid hard dependencies or "pinning" to specific parts of the certificate hierarchy.

"After updating an SSL certificate, always force a sync by clicking 'Rekey and Sync' in the Azure portal. This ensures the app immediately uses the new certificate", advises Mike Chen, Azure Solutions Architect at Microsoft.

Tips for Managing SSL Certificates

Managing SSL certificates in Azure App Service doesn't have to be a headache. Here are some practical tips to keep your certificates up-to-date and your connections secure:

Set Up Automatic Renewals

Forget manual renewals and potential downtime. Azure offers automatic renewal for App Service certificates:

  1. Go to the App Service Certificates page in the Azure portal
  2. Select your certificate
  3. Set "Auto Renew App Service Certificate" to "On"

This simple step can save you time and prevent security gaps. Microsoft partnered with GoDaddy to make this process seamless.

"Automatic renewals eliminate the need for manual certificate installation, reducing the risk of human error", says Sarah Johnson, Azure Security Specialist at Microsoft.

Check Your SSL Setup Regularly

Don't set it and forget it. Regular checks ensure your SSL setup remains robust:

  • Monitor expiration dates: Azure starts the auto-renewal process 32 days before expiration. Mark your calendar to verify it's working.
  • Verify certificate strength: Regularly scan your certificates for key strength and algorithm updates.
  • Review configurations: Check that your SSL bindings are correct and HTTPS is enforced.
Task Frequency Why It's Important
Check expiration dates Monthly Prevent unexpected expirations
Verify certificate strength Quarterly Maintain strong encryption
Review SSL configurations Bi-annually Ensure proper HTTPS enforcement

For App Service Managed Certificates, which are valid for 6 months, pay extra attention. If auto-renewal fails, you might need to take manual steps:

  1. Disable CDN proxy (if applicable)
  2. Initiate manual renewal from Azure portal
  3. Verify domain ownership (via DNS TXT record if needed)

Wrap-Up

Updating SSL certificates in Azure App Service is a key task for maintaining secure connections. Let's recap the main points:

  • Regular updates are crucial: SSL certificates typically expire after a set period, often one year for App Service certificates.

  • Multiple certificate types: Azure offers managed certificates, App Service certificates, and Key Vault integration.

  • Automation is your friend: Set up automatic renewals to avoid unexpected expirations.

Certificate Type Renewal Period Auto-Renewal
Managed 6 months Yes
App Service 1 year Optional
Key Vault Varies Manual

Remember these key actions:

  1. Check expiration dates: Mark your calendar for 60 days before expiration to start the renewal process.

  2. Verify domain ownership: This step is necessary if it hasn't been done in the last 395 days.

  3. Update bindings: After renewal, ensure your new certificate is properly bound to your custom domain.

  4. Enforce HTTPS: Set the "HTTPS Only" option to "On" for global SSL enforcement.

FAQs

How to renew an SSL cert in Azure?

To renew an SSL certificate in Azure App Service:

  1. Upload the new certificate
  2. Go to your app's Custom domains page
  3. Click the actions button (...) and select "Update binding"
  4. Choose the new certificate and click "Update"
  5. Delete the old certificate

This process helps avoid downtime and IP address changes for your app.

How do I update my Azure SSL?

Updating your Azure SSL involves:

  1. Uploading the new certificate
  2. Navigating to Custom domains in your app settings
  3. Selecting "Update binding" from the actions menu
  4. Choosing the new certificate
  5. Clicking "Update"

Important: Follow these steps in order to prevent HTTPS errors and maintain your app's availability.

How do I renew my Azure automated SSL certificate?

Azure-managed certificates are automatically renewed every six months, 45 days before expiration. This process requires no action from you if:

  • Your domain verification remains valid
  • The certificate is still in use
  • The app service plan is active

How to add certificate in app service in Azure?

To add a new certificate:

  1. Open the Azure portal
  2. Go to App Services > [Your App Name]
  3. Select "Certificates" from the navigation menu
  4. In the Managed certificates pane, click "Add certificate"
  5. Choose the custom domain for the free certificate
  6. Click "Validate"

How do I auto renew certificates in Azure?

For auto-renewal of custom certificates:

  1. Use the "Lifetime Action Type" when creating the certificate
  2. Set up the renewal in Key Vault
  3. The certificate will show as "In progress" initially
  4. After 2-3 minutes, it should change to "Completed"

For App Service managed certificates, auto-renewal is handled by Azure without any action required from you.

Related posts

Read more