Here simply want to demonstrate how simple it is to update an existing role deployment, using the Staging slot which is provided for every cloud service.
- Review the DiagnosticsDemo solution. Whats of particular interest in this solution is the initialization of the Azure DiagnosticsMonitor on the RoleEntryPoint.
- Open the cloud project configuration page for the WebRole, and highlight how the Diagnostics module is baked in all Azure projects. The module is enabled by default, and includes a standard connection string, which by default will use the local dev fabric.
- An Azure Storage account should be provisioned, and configured here.
- Azure storage provide a single, consolated, highly availably place to store all diagnostics data for an entire cloud solution.
- Imagine having to reconcile the local log files across 100 running instances of a web role, for example – this would not be feasibility, and indeed a nightmare.
- Open WebRole.cs (RoleEntryPoint), and walkthrough the OnStart code.
- Highlight the concept of a “Startup Task”, which will create a custom Windows EventLog Source, called “FooSource”. Point out where a startup task is defined in the csdef, and the ability to elevate its execution privilege.
- Startup tasks are a useful extensibility point, for running in customizations to the default Cloud Service VM images (e.g. registry settings, registering custom components, running MSI installers, etc).
- Highlight the csdef and cscfg defaults for defining the default instance count and VM size. Ensure that the instance count is set to 2 or more for this demo.
- Because this solution has been pre-deployed, will make a code change to highlight how the update cycle works with Cloud Services.
- Update style.css (102), change the background color to something that will stand out.
- Deploy to the solution using VS Publish. Ensure that the Staging slot is used (wait 5 minutes).
- In the meantime…
- The Diagnostic Demo solution is currently running in the production slot. Let browse to it load balanced DNS.
- Use DiagnosticsDemo.v2.0