Windows Azure - Viewing Deployment Machine Details

Many of you might be eager to know the deployment machine details like Operating System, Processes, and Hardware Configuration of the Azure application. In this article I am focusing on this deployment details display.

Many of you might be eager to know the deployment machine details like Operating
System, Processes, and Hardware Configuration of the Azure application. In this
article I am focusing on this deployment details display.

Where are the Roles executed?

We have to take a note that the web role and worker role are executed on a
Virtual Machine. The VM role provides flexibility in deploying a configured
Virtual Machine role.

Creating the Application

We can start with a web role and add the following code into the Page Load
event.

//
Display the Resutls InfoLabel.Text = builder.ToString();
}
The code does the following activities.

Use the Environment class to list the Operating System Name, Version, Procesor Count etc.

Use the Process class to list the current active processes in the machine

Use the RoleEnvironment class to get the Role Name, Deployment Id, Is Emulated properties.

The following are the important properties we are accessing:

Environment Class

Get the machine name: Environment.MachineName
Get the operating system version: Environment.OSVersion
Get the number of processors in the machine: Environment.ProcessorCount

Process Class

Get the active processes: Process.GetProcesses()

RoleEnvironment Class

Get the role name: RoleEnvironment.CurrentRoleInstance.Role.Name
Get the deployment id: RoleEnvironment.DeploymentId
Check whether emulator mode: RoleEnvironment.IsEmulated

Executing the application

On executing the application in the development environment the following
results are retrieved.

Executing on the Cloud

Now we can deploy the application to the cloud and view the results. You can
refer to the packaging and deploying steps
here.

After the deployment status is ready in the cloud, we can execute the
application.

The execution result is shown below:

From the above result we can see the Operating system version. Together with
that Debugger.IsAttached and RoleEnvironment.IsEmulated properties are returning
false inside the cloud execution.

Summary

In this article we have seen the deployment details of the Azure application. We
have executed the application in the local development machine and in the online
Cloud platform. The attached source code contains the above described
application.