Hands-On Lab Integrating Development and Operations with Visual Studio Team Foundation Server 2012 and System Center Operations Manager 2012 Lab version: 11.0.51106.01 Update 1 Last updated: 2/4/2013 CONTENTSOVERVIEW ............................................................................................................................... 3 EXERCISE 1: MONITORING APPLICATIONS WITH SYSTEM CENTER OPERATIONS MANAGER ..... 4 EXERCISE 2: SYNCHRONIZING SYSTEM CENTER OPERATIONS MANAGER ALERTS WITH TEAM FOUNDATION SERVER 2012 ................................................................................................................... 12 EXERCISE 3: CONTROLLING INTELLITRACE IN PRODUCTION USING SYSTEM CENTER OPERATIONS MANAGER ......................................................................................................................... 27 OverviewOverview In this lab, you will learn about how communications and workflow between operations and development teams can be improved by utilizing System Center Operations Manager 2012, Team Foundation Server 2012, and Visual Studio Ultimate 2012. As you walk through the exercises, you will see how Operations Manager can monitor a sample ASP.NET website, synchronize select operational alerts with Team Foundation Server, and automate the collection and delivery of IntelliTrace logs to the development team. Prerequisites In order to complete this lab you will need the Microsoft® Visual Studio Team Foundation Server® 2012 and System Center® 2012 Operations Manager Integration Virtual Machine provided by Microsoft. For more information on acquiring and using this virtual machine, please see this blog post. About the Fabrikam Fiber Scenario This set of hands-on-labs uses a fictional company, Fabrikam Fiber, as a backdrop to the scenarios you are learning about. Fabrikam Fiber provides cable television and related services to the United States. They use an on-premises ASP.NET MVC application for their customer service representatives to administer customer orders. Their IT operations team uses System Center 2012 to monitor their on-premises applications for any performance problems, outages, or other incidents. Recently the CIO of Fabrikam Fiber launched an initiative to encourage development and operations organizations to work more closely together in order to better ensure the quality of their production systems and to more efficiently resolve incidents. These two teams have recently decided to integrate System Center Operations Manager and Team Foundation Server to make it easier for developers to get the information they need about production incidents in order to turn around fixes more rapidly. Exercises This hands-on lab includes the following exercises: 1. Monitoring Applications with System Center Operations Manager 2. Synchronizing System Center Operations Manager Alerts with Team Foundation Server 2012 3. Controlling IntelliTrace in Production using System Center Operations Manager Estimated time to complete this lab: 60 minutes. Exercise 1: Monitoring Applications with System Center Operations ManagerExercise 1: Monitoring Applications with System Center Operations Manager In this exercise, you will see how System Center Operations Manager (SCOM) can be configured and used to help monitor a web application. We will then use this as the foundation on which we will begin showing the integration story with Team Foundation Server 2012 in the next exercise. 1. Log in as Administrator. All user passwords are P2ssw0rd. Note: To help ensure that all services and applications are ready for the remainder of this lab, please allow the machine a few minutes to warm up. 2. Let’s start by taking a look at how we pre-configured application monitoring for a sample website using SCOM. Start the Operations Console from the taskbar. Figure 1 Launching the Operations Console 3. Load the Authoring workspace. Figure 2 Authoring workspace Note: The Authoring workspace enables you to create new monitoring scenarios so you can change or add monitoring in an existing management pack or create a new management pack for an application that does not have one. 4. From the Authoring tree, select the Authoring | Management Pack Templates | .NET Application Performance Monitoring template node. This displays the Monitor FabrikamFiber website management pack in the middle pane. Figure 3 Selecting a template 5. Select Monitor FabrikamFiber website from the middle pane and then select the Properties option from the Tasks pane. Figure 4 Viewing properties 6. The first tab in the properties window is labeled What to Monitor. This tab describes the application components to monitor, which is just the FabrikamFiber.Web website in this case. Figure 5 Monitored application components 7. The next tab allows configuration of the Server-Side Defaults. Select the Advanced Settings button. Figure 6 Configured server-side monitoring settings 8. In the advanced settings window, note that both performance and exception alerts are turned on and that the sensitivity threshold has been adjusted down to 100 ms. This was done ahead of time for demonstration purposes. Figure 7 Advanced monitoring settings 9. Under the section for configuring exception event monitoring, note that the “Application failure alerts” and “All exceptions” options are selected. This will alert us to all application failures and exceptions. Figure 8 All failures and exceptions are set to be logged 10. Select the Cancel button to close the advanced settings window. 11. Select the Client-Side Monitoring tab in the properties window. This tab configures the use of client-side monitoring in managed web applications. Figure 9 Client-side monitoring configuration 12. Select the Client-Side Defaults tab in the properties window. This configuration tab is similar to the Server-Side Defaults tab in that it controls what events to monitor. It also provides advanced settings and the ability to filter clients to monitor by IP address. Figure 10 Client-side defaults 13. Select the OK button on the properties window to close it. This will save changes and prepare the monitoring configuration. 14. Return to the Monitoring workspace. Figure 11 Monitoring workspace 15. In the Monitoring tree, select Monitoring | Application Monitoring | .NET Monitoring | Monitor FabrikamFiber website | Monitor FabrikamFiber website. This shows us that the website is currently in the Healthy state. SCOM provides a number of different views that can be used to view the state of applications and gain performance insights. Figure 12 Overall state of the website 16. Select the row describing the state of the website and then select the Alert View navigation option from the Tasks pane. Figure 13 Opening the Alert View 17. The Alert view shows all alerts and their details for the monitored website. It also allows you to disable or override the rule that produces the warnings, create an alert subscription to send email or text message, and even collect IntelliTrace snapshots. Select one of the alerts listed by single-clicking. Figure 14 Alert View showing existing alerts Note: The initial alerts and timestamps that you see in screenshots may be different from those you see in the virtual machine. 18. In the Navigation section of the Tasks pane, select the Performance View option. Figure 15 Navigating to the Performance View 19. Scroll through the list of performance counters to see what counters are currently collected and available for display. You can also specify a time range and export data if desired from this view. Figure 16 Performance View counters 20. Close the Performance and Alert windows. At this point, SCOM has been configured and is now monitoring the application. In the next exercise, we’ll take a look at how you can integrate this monitoring setup with Team Foundation Server to help improve the workflow between operations and development. Exercise 2: Synchronizing System Center Operations Manager Alerts with Team Foundation Server 2012Exercise 2: Synchronizing System Center Operations Manager Alerts with Team Foundation Server 2012 In this exercise, you will see how SCOM can synchronize alerts and work items with Team Foundation Server to improve the communication and workflow between operations and development. In this lab and virtual machine, we are working with Team Foundation Server 2012 Update 1, but it is also possible to synchronize with Team Foundation Server 2010. 1. Let’s take a look at how SCOM was configured to integrate with Team Foundation Server. In the Operations Console window, select the Authoring workspace. Figure 17 Authoring workspace 2. From the Authoring tree, select Authoring | Management Pack Templates | TFS Work Item Synchronization. Figure 18 TFS Work Item Synchronization 3. Select the template instance named FabrikamFiber TFS Syncing from the middle screen and then select the Properties link in the Tasks pane. Figure 19 Viewing properties for work item sync 4. In the Server Settings tab, note the configured Team Project Collection URL. Figure 20 Team Project Collection URL 5. Select the Project Settings tab and note that an application component mapping is already setup between the Fabrikam Fiber website and TFS. In addition, the area path is setup so that work items will be created in the Web Site area. These settings make it possible for operations to send alerts in the form of Operational Issue work items when a problem is found in production that the operations team can’t resolve. Figure 21 Project Settings 6. Select the Cancel button to close the FabrikamFiber TFS Syncing Properties window. Select the No button if prompted to save changes. 7. Minimize the Operations Console window. 8. Now let’s take a look at a scenario where a runtime issue is picked up in SCOM and then passed on from operations to development for further investigation. 9. Start Internet Explorer and then select the Fabrikam Fiber Intranet button from the Favorites bar. Figure 22 Launching website 10. Select the Reports link in an attempt to view reporting data, but note that there is an error. Figure 23 Reports link Note: The website layout changes depending upon the window size, so the navigation links may also appear on the left-hand side in some cases. Figure 24 Unhandled exception occurred while generating report 11. It appears that there was an unhandled error generating the reports, and since we have SCOM monitoring the website, we can use that to take a closer look. Return to the Operations Console window and select the Monitoring workspace. Figure 25 Monitoring workspace 12. From the monitoring tree, select Monitoring | Application Monitoring | .NET Monitoring | Monitor FabrikamFiber website | Active Alerts. Figure 26 Active alerts for the website 13. In the Active Alerts view, you will notice a few warnings and errors. In an active production application, it is likely that there would be even more to sift through. To make it easier to find the recent exception, let’s customize the view a little. Select the Personalize View button from the Tasks pane. Figure 27 Customizing the alerts view 14. In the Personalize View dialog, select the Last Modified column and then select OK. Figure 28 Adding in a column 15. Back in the Active Alerts view, scroll to the right if necessary and select the Last Modified column header to sort by that property. The reason why we are using this property instead of relying on the Created or Age column is that this exception may have occurred before. When repeat alerts are raised, the Repeat Count property is increased on the alert rather than creating a new one, and the Created property represents the timestamp of the first occurrence. Figure 29 Sort by last modified time 16. Starting with the most recently modified alert, single-click on each warning alert until you locate the one that has a description describing the NullReferenceException that you just saw in the Fabrikam Fiber web application. The alert description is found in the Alert Details pane in the bottom part of the Active Alerts view. Figure 30 Finding the alert associated with website error 17. Double-click on the alert to load the Alert Properties window. You can view all details related to the alert here. Note that the Repeat Count is greater than 0, meaning that it has occurred multiple times now. Figure 31 Alert properties 18. In the lower portion of the Alert Properties window, change the Alert Status to be Assigned to Engineering and then select the Apply button. SCOM will then create a new Operational Issue work item in the team project specified by the template that we looked at earlier. Figure 32 Assign an alert to engineering 19. Select the hyperlink that is in the Alert Description to view more information about the exception. It will take a few moments to load, and when Internet Explorer prompts you to allow a page to close, select the Yes button to continue. Figure 33 Loading the AppDiagnostics web page for the alert 20. The Exception Event window shows an immense amount of data about the exception, the application, and the environment in which it was running. You can view all exception data and call stack, modules that were loaded, other events that may be related, and even performance counters that were collected. As you will see in a minute, all of this information is available to both operations and development. Figure 34 Exception event information collected and recorded by SCOM 21. Close the Exception Event window and then close the Alert Properties window. 22. Minimize the Operations Console window. In the next step, we will transition to the development side. 23. Start Visual Studio from the taskbar. Figure 35 Launching Visual Studio 24. In Team Explorer | Home, select the New Query link under Work Items. Figure 36 Creating a new query 25. Change the Work Item Type field to be Operation Issue and the State field to be New. Figure 37 Query definition to get new operational issues 26. Select the Run button to execute the query. Figure 38 Executing the query 27. Double-click on the new Operation Issue work item to open it. Figure 39 Loading the new Operational Issue from TFS Note: You may need to wait a few moments for the work item to be created in TFS, therefore you may need to Run the query again. 28. At this point, a developer can look at the provided application error report to begin an investigation. Note that the same AppDiagnostic hyperlink is provided here as well. Figure 40 Operational Issue work item 29. Change the State to Accepted. This will automatically set the Reason to be Incident is acknowledged. Select the Save Work Item button to save changes. Figure 41 Accepting the work item 30. Now that we have accepted the issue, we can assign the issue to a development team member to address. Change the State to Assigned and the Assigned To field to Administrator. Obviously, in a real environment this would be assigned to a real team member. Select the Save Work Item button to save the changes. Figure 42 Assigning the work item 31. Switch back to the Operations Console and wait until the Active Alerts view refreshes to show the alert update its Resolution State to Acknowledged. The operations team is now aware that the development team has acknowledged the issue and is investigating. Note: The Operations Console will automatically refresh when changes are detected, but you can always right-click in the alert view and refresh manually. Depending upon the capabilities and resources of the hardware that is running the virtual machine, this synchronization may take a few moments. Figure 43 Alert state has updated after syncing with TFS Exercise 3: Controlling IntelliTrace in Production using System Center Operations ManagerExercise 3: Controlling IntelliTrace in Production using System Center Operations Manager In this exercise, you will learn how you can use SCOM to quickly control the configuration of IntelliTrace in a production setting, generate snapshots, and automatically share that diagnostic data with the development team. The use of the IntelliTrace Profiling Management Pack automatically deploys the necessary infrastructure, which is called the IntelliTrace Collector, to the designated servers. 1. Minimize the Operations Console window and return to Visual Studio. 2. In the Operation Issue window, select the Links tab. Figure 44 Viewing links provided by SCOM 3. Right-click on the file hyperlink and select the Open Linked Item option. This link is to an IntelliTrace log file that was created by SCOM and then stored on a file share. Figure 45 Open linked item Note: It is possible to configure SCOM to attach IntelliTrace files to work items created in TFS, but be aware that these files can be quite large. In addition, Visual Studio Ultimate is required in order to open the IntelliTrace files. 4. Select the Yes button when prompted to confirm opening the link. Figure 46 Confirming action to open file link 5. Once the IntelliTrace log file loads in Visual Studio, double-click on the NullReferenceException item to open it in debug mode. Figure 47 IntelliTrace debugging data from SCOM 6. As we would expect when using IntelliTrace, the location in source where the exception was thrown is shown highlighted, and the Autos and Call Stack windows provide some information about the null reference itself. However, this does not provide a lot of contextual data surrounding the actual exception, as you can see from the single event shown in in the IntelliTrace window. Figure 48 Debugging with IntelliTrace Note: To debug with IntelliTrace and step through code, you must have the matching source files and symbol files available and ensure that they are in the Visual Studio symbol path. For more information, please see this MSDN article about how Visual Studio matches up source and symbols. 7. Select Debug | Stop Debugging from the main menu in Visual Studio. 8. Right-click on the Operational Issue tab and then select the Close All But This option. Figure 49 Cleaning up open files 9. When prompted to save changes to the new query, select Yes. Figure 50 Saving the new query 10. Name the query New Ops Issues and then select the Save button. Figure 51 Saving the new query 11. Let’s go ahead and ask the operations team to acquire a full IntelliTrace snapshot to aid in debugging. Change the State of the issue to Awaiting Evidence, add in a Resolution Note indicating what evidence we would like, and then select the Save Work Item button. Figure 52 Changing the state of the issue to ask for full IntelliTrace log 12. Minimize Visual Studio and return to the Operations Console window. 13. Locate and expand the Team Foundation Server Synchronization node from the Monitoring tree view. There are various filtered alert views that can be used to see alerts as they are synchronized back and forth between SCOM and TFS. Figure 53 Monitoring alert status 14. Select the Awaiting Evidence node to check for alerts that are waiting for additional evidence. Figure 54 Viewing alerts that are awaiting evidence 15. Double-click on the alert to open it. Figure 55 Open the alert 16. Select the History tab to view the recent history for the alert and note that the development team is asking for an IntelliTrace log. Figure 56 Viewing the history for the alert 17. Close the Alert Properties window. 18. With the alert still selected, click on the Start IntelliTrace Collection task button. Figure 57 Starting IntelliTrace collection 19. The Run Task dialog shows what is being targeted for collection and the default parameters that will be used. Leave the defaults in place and then select the Run button. Figure 58 Starting IntelliTrace collection 20. Wait for the Status column to report a value of Success and then close the task status dialog. Figure 59 IntelliTrace collection was started 21. Now it is time to reproduce the error. Start Internet Explorer and load the Fabrikam Fiber Intranet application from the Favorites bar once again. It will take a few moments to start the website because the IntelliTrace collection process starts by resetting the associated application pool. 22. Once the website has loaded, click on the Reports link to reproduce the error. 23. Return to the Operations Console window and select the Collect IntelliTrace Snapshot task. Figure 60 Collecting IntelliTrace snapshot 24. In the Run Task window, use the default options and select the Run button. Figure 61 Collecting IntelliTrace snapshot 25. Wait for the Status column to report a value of Success and then close the task status dialog. 26. Since we are using IntelliTrace on a production server, we should now stop the IntelliTrace process. Select the Stop IntelliTrace Collection task, select the Run button, and close the task once completed. 27. Right-click on the alert and select Set Resolution State | Assigned to Engineering to re-assign the alert to the development team with the IntelliTrace log linked to the existing Operation Issue work item. Figure 62 Re-assign to the development team 28. Return to Visual Studio and select the Refresh button on the Operational Issue work item window. Figure 63 Refreshing work item 29. There should now be a new hyperlink provided with link comment that starts with “A new IntelliTrace snapshot…” It may take a few moments to appear, so you may need to refresh a few times. Figure 64 IntelliTrace snapshot provided by operations team 30. Right-click on the new hyperlink and select the Open Linked Item option. You will be prompted to accept loading the link once again. Figure 65 Opening the IntelliTrace file 31. Compared to the previous IntelliTrace log that we looked at, this one has a lot more detail in it as expected. Figure 66 IntelliTrace summary 32. Expand the Web Requests section to see what URLs were accessed, how long they took, and the result. Figure 67 Web requests that were recorded during the IntelliTrace session 33. In the Exception Data section, select the System.NullReferenceException entry that has a call to GetCustomerSummary at the top of its call stack and then select the Start Debugging button. Figure 68 Start debugging using the IntelliTrace file 34. Just like before, we are taken to the line of code where the exception was originally thrown, however this time we have additional historical debugging data that we can examine. Click the Return to Call Site button. Figure 69 Return to the call site of GetCustomerSummary method 35. Returning to the call site takes us to the Employees.cshtml file, where we can now see where the Customer parameter comes from that is ultimately passed to the GetCustomerSummary method. Figure 70 Debugging with IntelliTrace 36. Select Debug | Stop Debugging from the main menu and return to the Operational Issue. 37. At this point, it would be up to the development team to fix the issue, but that is beyond the scope of this lab. Let’s assume that the fix is in place and tested according to the fictional Fabrikam Fiber’s development standards. Set the state of the Operational Issue state to Resolved and then select the Save Work Item button. Figure 71 Resolving the Operational Issue work item 38. Return to the Operation Console window and select the Resolved alerts option under the Team Foundation Server Synchronization node. You may need to wait a few moments until the alert shows up. Figure 72 Viewing resolved issues 39. The operations team could then verify the fix as implemented. Assuming that task has been completed, right-click on the alert and select Set Resolution State | Closed. Figure 73 Operations verifying that the fix resolved the issue To give feedback please write to VSKitFdbk@Microsoft.com Copyright © 2016 by Microsoft Corporation. All rights reserved.