simoneL
simoneL

Reputation: 622

Copy files into Azure App Service

I am working on a website that will be deployed to various environments - Dev, UAT and Production - and each of them has different config settings defined through the use of config files.

The deployment process consists of two steps:

  1. Publish the latest build output
  2. Copy and replace the default config files with the one specific to the environment were the deployment is being done (these files are currently under source control)

I am trying to automate the deployment process using VSTS and Azure App Services but I couldn't find any task or option that would let me copy files into an App Service.

What is it the best way to implement this deployment process?

Upvotes: 4

Views: 4825

Answers (2)

alex
alex

Reputation: 976

Kudu api give you the ability to upload and download files from azure web app with overwrite

The git: https://github.com/projectkudu/kudu/wiki/REST-API

Not sure if vsts have this ability. I recently did what you describe with Jenkins . Now I'm trying to integrate Jenkins to vsts Hope it give you an answer

Upvotes: 1

Rob Reagan
Rob Reagan

Reputation: 7686

You can make this much easier on yourself by using config transforms for your web.config file.

Basically, make sure that you've defined a Build Configuration for each environment. Debug and Release are defined out of the box for Visual Studio MVC projects. You can add as many configurations as you want, such as a UAT configuration.

Once you have your configurations defined, make sure there's web.[your build config].config file located beneath your web.config in the Visual Studio solution explorer. Within each of these build configuration specific transform files, you can override settings as needed.

To close the loop, you can specify a build configuration to target when creating a build in VSTS. This will automatically execute the transform for the build configuration you've selected.

More details on build configs and web.config transforms here.

Alternatively, you could specify your app settings and connection strings directly in the Application Settings of your Azure Web App. These override anything in your deployed web.config file. What I like about this approach is that you don't have to expose sensitive information like connection strings to other developers on your team, and it removes the minor complexity of web.config transforms.

Upvotes: 2

Related Questions