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
Azure support couple of deployment methods for App Service like:
- 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.
- 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.
- 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.
- 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
- You need to setup a Github Repository (public / private) with the required binaries, config files & static files.
- 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.
- 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.
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
TODO: Find how to enable auto sync.
- Microsoft documentation on App Service – https://docs.microsoft.com/en-us/azure/app-service-web/app-service-web-overview
- Microsoft documentation on App Service Deployment – https://docs.microsoft.com/en-us/azure/app-service-web/web-sites-deploy
- Stackoverflow question – http://stackoverflow.com/questions/40802335/how-do-i-give-only-dlls-and-static-files-to-a-customer-to-deploy-to-azure
- Github azuredeploy.json template format – https://github.com/Azure/azure-quickstart-templates/blob/master/apprenda60-small/azuredeploy.json