Problem statement is: You have a .net web app (which can be self hosted) and you want to provide it to customers so that they can deploy their instances on Microsoft Azure, without shipping source code to them. Also this has to be very easy for customers to do so. There is a Stackoverflow question I raised – How do I give only dlls and static files to a customer to deploy to azure

Now while publishing it to Azure Marketplace seems most obvious answer. There might be instances where you want to test it with beta customers before going public or so. Or just for the sake of it. If the product is finished ideal way is to publish the app to Azure Marketplace.

Now as per Microsoft’s documentation: In App Service, a web app is a compute resource for hosting a website or web application. They either run in shared or dedicated VM but isolated from other web apps. It supports web app in

  • ASP.NET
  • Node.JS
  • Java
  • PHP
  • Python

Azure support couple of deployment methods for App Service like:

  1. Deploy from Visual Studio: We provide a solution to customer which they open in Visual Studio. And manually deploy it to Azure. But, we can’t expect customers to be subscribers of visual studio. Also, providing an update is a bad experience. If you were to push an update, you need to send updated dlls back to users and ask them to redeploy. Much like maintaining a cloud service as an offline product.
  2. FTP / FTPS: This solves 70% or our problem statement. We provide customers with  dlls and config file(s) of the web app. They create their App Service Instance, setup FTP credentials and deploy these bits using their favorite FTP clients. This is tedious way to do it and has same issue with update as above.
  3. One drive based solution: Provide the bits in a shared one drive. And ask them to sync it with their app service instance. While this solves update issue, the user still needs to create an App Service first and then sync with one drive. So now we are looking at a 90% solution.
  4. Github Based Deployment: Push your bits to a public / private repository. And ask users (after granting them read access) to publish it from there. Azure provides a novel way to deploy from Github. It solves the problem of providing updates as users can sync or auto sync with any new commits on the repository. Also in this process Azure allows users to create an instance of App Service on the go. It solves 100% of the problem statement.

Github Based Deployment (Steps)

Before you start, here’s the sample repo I created – https://github.com/mebjas/github-to-azure-deployment

  1. You need to setup a Github Repository (public / private) with the required binaries, config files & static files.
  2. Then you need to add a JSON file: azuredeploy.json with config on different deployment parameters in the root of repository. Click here for detailed template format.
  3. Also, you can add a deploy to azure button with appropriate link to initiate the deployment.

    The link looks something like: https://azuredeploy.net/?repository=https://github.com/mebjas/github-to-azure-deployment-test
    It clearly explains where to deploy to and where to deploy from.

Then you can deploy the code to Azure in three easy steps after clicking on the link button. It’ll ask you to login to Azure if you are not already signed in.

step1: fill in details infra details

Step 1: fill in details infra details

Step 2: Azure will validate the type of web application

Step 2: Azure will validate the type of web application

Step 3: Azure will start deployment

Step 3: Azure will start deployment

If everything goes well. You’ll get the URL of deployed web app & link to Azure portal to manage it. Else a proud error message.

To update, just push new dlls to the GitHub Repository and users can sync it from Azure Portal > App Service > Deployment options > Sync

Sync from Github in Azure Portal > App Service

Sync from GitHub in Azure Portal > App Service > Deployment options > sync

TODO: Find how to enable auto sync.

References:

  1. Microsoft documentation on App Service – https://docs.microsoft.com/en-us/azure/app-service-web/app-service-web-overview
  2. Microsoft documentation on App Service Deployment – https://docs.microsoft.com/en-us/azure/app-service-web/web-sites-deploy
  3. Stackoverflow question – http://stackoverflow.com/questions/40802335/how-do-i-give-only-dlls-and-static-files-to-a-customer-to-deploy-to-azure
  4. Github azuredeploy.json template format – https://github.com/Azure/azure-quickstart-templates/blob/master/apprenda60-small/azuredeploy.json