SSL

Intro

So I had an issue in work today where I needed to export an ssl certificate that we generated through Azure and bind it to one of our servers to secure a test site. I thought I would share in the hope that it will help someone else that is trying to do something similar.

This article assumes that you have a working Azure subscription and already have purchased an SSL certificate through Azure.

To get started, navigate to the Azure portal and access the app service certificate as below.

Project Template App Service Certificate

When the screen loads, Select Export Certificate from the left menu, Next click Open Key Vault Secret, then select the current version of your certificate. A screen similar to below will appear. Verify the details are correct and click Download as a certificate.

Project Template Export App Service Certificate
Project Template Project Template
Folder Structure Folder Structure

Run the application to make sure it runs without error, once it compiles and starts you should see a screen similar to below.

application Application

Next navigate to the Azure portal here and from the dashboard, type App Service in the search box, select App Services and create a new app service.

App Service Search App Service
App Service New New App Service

In the create app service screen enter the details as below and click create.

  • Subscription - Select your Azure subscription
  • Resource Group - Is a logical group of resources
  • Name - The name of your web application
  • Publish - Inticates if you are deploying code or in to a Docker Container
  • Runtime Stack - Select the same runtime as your application in this case .NET Core 3.1
  • Operating System - Select Windows
  • Region - Select North Europe or wherever you are located

Create Azure App Service Create App Service

Once your resources have been deployed, navigate to your app service and download the publish profile as shown below.

Publist Profile Publish Profile

Now you are ready to deploy your web application to your App Service, go back to Visual Studio, right click on you project, select publish. You will see a screen as below, select import profile then select Web Deploy from the dropdown list, now click publish.

Publish Service Search Import Publish Profile
Web Deploy Web Deploy Publish

After a minute or two your application will be automatically deployed to your Azure App Service as shown below

Deployed App Service

When you are done with your App Service, Azure makes it easy for you to clean up your resources. Navigate to the Azure portal, select the resource group you created at the start of this article and click delete resource group. Azure will ask you to enter in the name as confirmation before you can delete. Enter in the name and select delete and your resources will be deleted.

Deployed App Service

Conclusion

In this article I demonstrated how easy it is to create a web project through visual studio and deploy it to an Azure App Service in just a few minutes. If something is not clear and you would like me to explain it a bit better, feel free to leave a comment below and I will get back to you as soon as I can.