Multiple Azure Cloud Environments

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

image

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

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

image

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

image

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:

image

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

image

And once the cloud service has been successfully published:

image

I can then browse my deployed service:

image

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

image

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

image

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

image

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

image

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.

image

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.

image

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

image

And changing the name to Development.

image

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

image

Below shows the Development and Production configuration files:

image

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.

image

And then the instance count is set to 2.

image

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:

image

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

image

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

image

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

image

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

image

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

image

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

image

Below shows the final settings for production:

image

Below shows the final settings for development:

image

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

image

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. 

This entry was posted in Azure, Deployment. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>