As part of our new mobile app offering that we are busy developing, I need to deploy the backend Azure mobile app services. These are the backend services that will provide all the main business logic that the app will need to function and provide value to the user. The app itself will essentially be a dumb set of screens that will have no smarts in and of themselves. The smarts will come from the backend services that the app will consume. And these services will be hosted on Azure in the form of mobile app services.
I have previously written about how I setup the build pipeline using Azure DevOps. The next step was therefore to deploy the build articles to Azure using the same Azure DevOps pipeline.
The main steps needed to deploy your app to Azure are actually defined in your build pipeline:
- create a zip file containing the deployed build artifacts
- publish the zip file so it is available for the release pipeline
In my build pipeline I have these two tasks defined as the last tasks in the pipeline. To create the zip file I use MSBUILD using the parameters
Hide Copy Code
I therefore added an MSBUILD task to the build pipeline. You may also need to add other build parameters for specifying the OutputPath, Configuration and Platform and any other parameters as necessary.
You will then need to add a Publish Build Artifacts task to your build pipeline. This makes your zip file available to the release pipeline. In the textbox for Path to publish I have entered
Hide Copy Code
as this is where I want the zip file to be published.
There are various templates you can use for setting up your release pipeline. For the purposes of this article I will keep it simple and refer to the Deploy Azure App Service template. Here you will need to authorise your Azure subscription. Once this has been completed you will need to enter other details including:
- app type
- app service name
- package folder (the filename and path where the zip file is located)
- optionally you can specify a slot if you are deploying to slots (which I highly recommend you do)
There are some subtle differences between how TFS handles deployments to Azure and how Azure DevOps handles them that threw me when I first setup the release pipeline. For example ensuring the release pipeline has access to the zip file threw me at first, until I discovered you need to publish it for it to be available to the release pipeline.
Other than that, the process itself is fairly straight-forward and I didn’t encounter any major problems.