Multiple Azure Cloud Environments


Most real world enterprise Azure deployments will require more than one environment.  A typical topology is represented below:

i1

There are many resources available that describe this concept so it will not be re-explained here.  Instead this post will present one approach to setting this up in Azure.

Note: I have found that separating these environments into different subscriptions has many benefits and tends to be my preferred approach.  Besides helping to isolate the environments from each other, it benefits from stretching the monthly credit a bit farther! 

My scenario includes two cloud services: a web role and a worker role.  The creation of the two roles is illustrated below:

i2

As the content of the roles is not significant to the post, I just created a basic MVC web app:

i3

My first step in setting up publishing to multiple environments is to create the basic publishing profile.  First, select publish on the created cloud project and select the option to create a cloud service.  This is shown below:

i4

After the basic settings have been selected the publishing settings are shown below:

i5

And once the cloud service has been successfully published:

i6

I can then browse my deployed service:

i7

And in the server explorer, I can see the newly published service running.

i8

And just to illustrate the worker role is running, I will update the diagnostic settings.

i9

And set the Event log’s log level to information:

i10

After a couple of minutes I can see an error was written.  Interesting error but should not affect the demo!

i11

Multiple Environment Configurations

Now that we have a basic service established it is time to set up our different environments.  In my scenario I want to create a Development and a Production environment.

i12

The first step is to create two configurations: one for the development environment and one for the production environment.  On the cloud service project, the Manage Configuration option is selected.

i13

The first step is to rename the Cloud configuration to Development using the Rename button:

i14

And changing the name to Development.

i15

Next, the Development configuration is copied and the copy renamed to Production.

i16

Below shows the Development and Production configuration files:

i17

To illustrate the different configuration settings, let’s update the production configuration to be different than the development configuration.  To customise the configuration settings for a particular cloud service configuration, double-click the role in the Roles folder.

In our example, the WebRole was selected.

There are several sections that allow you to customise the settings of the cloud role.  In this example the instance count will be updated to 2 VMs in production.  First the Production configuration is selected.

i18

And then the instance count is set to 2.

i19

Multiple Publishing Profiles

Because we now have both development and production environments to publish to we will need multiple publishing profiles.  To create a development and a production environment, first select the Publish option of the cloud project context menu:

i20

In the Target profile drop down, select the manage option:

i21

We will create a copy and rename the profiles by adding a suffix to identify the different environments:

i22

Now there are two profiles available in the Target profile drop down:

i23

Using the previous button we will go back to settings to update our production setting to use the Production service configuration:

i24

Because we want separate development cloud roles, we will need to create a new service for the development role:

i25

When making changes to multiple publishing profiles, do not forget to click save:

i26

Below shows the final settings for production:

i27

Below shows the final settings for development:

i28

After deploying both profiles the effect of setting the instance count to 2 for the production web role is evident:

i29

 Conclusion

The above scenario is simple and does not include the complexity of other components.  In particular storage and database resources.  When dealing with the multiple environments managing the connection strings may become tricky as a combination of service configuration and application or web configuration (app.config/web.config) may be required.

Please post your experience with managing different Azure environments in the comments!

Comments (3)

  1. Mike-EEE says:

    Fantastic post, Jeffrey! Great job with balancing images and text.

  2. Great post on a very useful topic. I love how you detailed each step thoroughly. This is an easy to follow manual.

  3. Love it! Great write instructions!

Skip to main content