Ben Tidman
Ben Tidman

Reputation: 2139

How to have multiple custom publishing profiles for Azure webrole

Using the Azure publish wizard gives you some options for changing your config settings, but not enough. You can tell it which build configuration to use (which will apply a transform to your web config) but you only have 2 choices. Release and debug. Also you can specify which cloud service configuration to use which will transform your service.config but again only 2 choices Cloud and Local.

My problem is that I have 3 different versions of my application running in Azure. They are Dev, Demo, and Production. Each has their own database, storage accounts, and other settings related to authentication. Just having a release and debug transformation doesn't cut it.

Really what I would like is to have a script or something so that I could publish my app to each of my Azure instances. It would change my web.config and service.config and target the right azure instances.

Any suggestions are appreciated.

Upvotes: 1

Views: 977

Answers (2)

Ben Tidman
Ben Tidman

Reputation: 2139

In researching this I updated my Azure Tools to the October release. Not sure if these options were available in old release or not but here's what I ended up with.

As it turns out can add your own services configurations and build configurations in addition to the default ones (cloud/local/debug/release).

Services configurations can be added by:

  1. Right click your Web role from your cloud service project and select properties.
  2. At the top of the properties window open the Service Configuration menu. Then select manage.
  3. Select a configuration and click the create copy button.
  4. Select the copy and rename it to whatever you want.
  5. Click close and now you should be able to have settings specific to your new service configuration.

Build configurations can be added by (I followed this blog post):

  1. Select Build -> Configuration Manager from the menu. The
    Configuration Manager dialog
  2. Select from the Active solution configuration dropdown list to bring up the New Solution Configuration dialog.
  3. Enter the name and select the configuration you want to copy. Click Ok.
  4. Make sure you select the correct Configuration (release or debug) for each of your projects for your new solution configuration.
  5. Notice there is still no web.config transform. To add a new Web.config transformation right-click on the Web.config file and from the menu select Add Config Transforms. Notice that a new configuration file matching your new configuration is automatically added

After following these steps I was able to create a new target profile in the Azure publishing wizard and select these configurations. This lets you automate your web.config settings using transforms and have your own custom cloud service configuration per publishing profile.

Here is another excellent reference that goes into much more detail then I was able to for this question.

Upvotes: 0

Nikita R.
Nikita R.

Reputation: 7493

There used to be CodePlex project http://wappowershell.codeplex.com/, which now became an official tool here: https://www.windowsazure.com/en-us/manage/downloads/.

It's a set of Windows PowerShell cmdlets for managing Azure deployment.

Also the following question is pretty similar: Publish Azure Project from Command Line

Upvotes: 1

Related Questions