• TFS 2010 in Practice -Part1 (Overview & Dual-server installation)

     

    This is going to be the first part of series of posts on Team Foundation Server (TFS) 2010 and will include overview of TFS 2010 product and an installation scenario.  I am going to be practical as much as possible. Alright let’s start.

    Why TFS

    TFS is a platform to create a repository well aligned with functions and roles (project manager, developers, testers, analysts, team lead, etc.) on an IT project life cycle. Even though it is mostly used for source control, it is more than that; it is integrated and scalable platform for Application Lifecycle Management (ALM). Core features:

    − Work Item Tracking: any traceable units (bugs, tasks, issues, etc.)

    − Version Control: code repository with storage, retrieval, comparison, access rights features

    − Build Automation: customizable build processes that can be scheduled & automated

    − Reporting: Built-in report templates to track the team project status

    − Project Management: ALM methodology adoption (CMMI, MSF Agile, SCRUM), monitoring team progress

    Architecture:

    clip_image002

    As seen in above image, TFS 2010 has 3 tiers: data (repository), application (services), and client (user interface).

    Installation Scenario:

    In this installation, we will follow TFS 2010 installation guidelines specific to dual-server topology, here are the servers and their features:

    1. Database: 64-bit MS SQL 2008 R2 Ent. on Win 2008 R2 Enterprise
    2. Application: SharePoint Foundation 2010 and 64-bit TFS 2010 on 64-bit Win 2008 R2 Enterprise

    I would recommend each server to have 2.40 GHz, 6 GB RAM, and 1 VHD with 7.2 k RPM and 100+ GB (300 GB for Database server) for a moderate size teams (20-50 members).

    As you’ve seen, in this installation application and data tiers are physically separated for the sake of scalability.

    Also please note that, we will use SharePoint Foundation 2010 which is new version of Windows SharePoint Services (WSS 3.0), which is available for mid-size, pilot solutions with no charge.

    Installation Steps

    • Get ready
      • Create user accounts: For TFS 2010 installation with all the features (analysis, reporting, etc.) we need 2 accounts as minimum, one is admin that does installation and configurations and the other one is service that runs services on behalf
      • Make your servers ready and satisfy with minimal requirements & windows updates
    • Install SQL 2008 R2 on database server: For steps, please visit here “How to Install SQL 2008 R2”. Please make sure you, at least, chose the features in the following image for installation

    clip_image004

    • Install SharePoint Foundation 2010: Please follow the steps defined here for this installation. You need to specify your SQL Server installed above in this step and may set NTLM as Authentication Method.
    • Install TFS 2010: Now we are ready for installing TFS 2010. Please follow the steps defined in Team Foundation Installation Guide 2010

    Conclusion:

    In this part, we have covered an overview of TFS 2010 briefly and installation steps of TFS 2010 according to dual-server topology or TFS Advanced installation mode on which data and application tiers are separated into 2 servers. Hope you like it and keep it tuned for coming partsSmile

    For more information:

    · Team Foundation Server 2010

    · Team Foundation Server 2010 Product

    · Team Foundation Installation Guide 2010

  • Caching STS Security Token with an Active Web Client

    A common scenario when using an STS (Being ADFS or Custom STS) is the requirement to cache the security token to be used repeatedly with the requests to WCF services to authenticate the calls. This is usually easy in desktop applications when most people go and cache the entire service proxy object in some global variable!

    The recommended approach is to cache the security token itself and use it later on which has the following advantages...

    • You can use the same token with different WCF services that accept the token
    • You can renew the token before it expires

     

    I've created a small sample with Active Web client with one page that first: caches the token, then use it to make the service calls.

    The following method can be used to cache the token...

    CacheToken()

    {

    // First, create binding to the service. The below URL is the name of the binding

    // It is important to note that this will cause the next calls to use v1.3. If you want to use Feb 2005 standards, use WSHttpBinding, not 2007

    WS2007HttpBinding wsf =new WS2007HttpBinding(@"https://vs2010.contoso.com/ATMServicesSTS/Service1.svc/IWSTrust13");

    // Now create a WS trust factory that will be used to create the communication channel with the STS

    WSTrustChannelFactory trustChannelFactory = new WSTrustChannelFactory(wsf,new EndpointAddress(@"https://vs2010.contoso.com/ATMServicesSTS/Service1.svc/IWSTrust13"));

    // I use User Name/Password for security

    trustChannelFactory.Credentials.UserName.UserName ="My User Name";

    trustChannelFactory.Credentials.UserName.Password ="My Password";

    // just to make sure no certificates involved

          trustChannelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;

          trustChannelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;

    // specifiy the trust version

          trustChannelFactory.TrustVersion = TrustVersion.WSTrust13;

    // Now create the cannel

    WSTrustChannel channel = (WSTrustChannel)trustChannelFactory.CreateChannel();

    // Specify the request parameters including Audience URI and lifetime

    RequestSecurityToken rst =new RequestSecurityToken(WSTrust13Constants.RequestTypes.Issue){Lifetime =new Lifetime(DateTime.UtcNow, DateTime.UtcNow.AddMinutes(5))};

    rst.AppliesTo = new EndpointAddress(@"https://vs2010.contoso.com/ATMServices/");

    RequestSecurityTokenResponse rstr =null;

    // Get the token

    SecurityToken token = channel.Issue(rst,out rstr);

    // Cache it in the session

    Session["Token"] = token;

    }

    Now, Use the token...

    // Create the proxy object

    ActiveClient.ATMServices.ServiceClient sc =new ActiveClient.ATMServices.ServiceClient();

    // Configure the channel factory

    sc.ChannelFactory.ConfigureChannelFactory<ActiveClient.ATMServices.IService>();

    // Create the channel with the issued token

    ActiveClient.ATMServices.IService serviceChannel = sc.ChannelFactory.CreateChannelWithIssuedToken<ActiveClient.ATMServices.IService>((SecurityToken)Session["Token"]);

    // call the service method

    txtReturn.Text = serviceChannel.GetData(50);

     

    Remember to add references to WIF to your project.

     

     Happy Coding:)

     

    Update 20/1/2012: Sample project added as an attachement.


     

  • Fix: BizTalk ESB exceptions notifications service resending emails

    What is the ESB Exceptions notifications service?

    The BizTalk ESB toolkit is an implementation of an enterprise service bus messaging standard. It allows for separation between message content, processes implementation, and process configuration.

    As part of the ESB samples you find the ESB portal sample with some helper services. One of these services is the ESB exceptions notifications service. This is a windows service that checks every specified timespan for new exceptions happening on your platform and if there is anyone who created a subscription to this type of exception or not. If it finds valid subscriptions to the new exception it simply send emails to the subscribing user notifying them of the exceptions.

    Problem

    This service is actually very useful and would make your ESB support team more responsive and Performant.

    The problem I found is that if someone actually added new subscriptions with a non-valid email address this would throw an exception while sending the email. And because this service is processing emails in batches it will consider the entire batch as not being sent although it might even have already sent messages within this batch already. This would make the service just keep sending the same messages over and over again until the request to send this email is removed from the database.

    Solution

    The solution is to change the behavior of the exceptions service by handling this condition. In my case all I needed in this case is to mark this email as being sent and just completely discard the error.

    1-      Open the Alerts visual studio project from the folder “C:\Projects\ESBSource\Source\Samples\Management Portal\ESB.AlertService

    2-      Open the file “Nofier.cs”

    3-      Go to the function called Notify

    4-      Change the send lines to be like the below

    try

    {

        emailClient.Send(message);

        System.Diagnostics.Trace.WriteLine("Email successfully sent");

    }

    catch (SmtpFailedRecipientsException )

    {

    }

     

    alertEmail.Sent = true;

    Please note that I left the marking of the email as being sent as I do not want it to reprocesses the same email again.

  • Orchestrator 2012 Deployment & Configuration Step by Step – Part 5 “Integration Pack”

    In this post series I will go through Microsoft System Center Orchestrator 2012 Deployment and Configuration in Step by Step format with screenshots, and will go into details of the product to help you better understand how you can get benefits from this powerful product.

    In this post I will go through Integration Pack to better understand the concept and know how to Download, Import and use Integration Packs in Orchestrator 2012, again we still working with RC version which is subject to change in the next release.

    What is Integration Pack (IP):

    System Center 2012 - Orchestrator includes over 41 built-in workflow standard activities that perform a wide variety of functions. You can expand Orchestrator’s functionality and ability to integrate with other Microsoft and third-party platforms and products by installing integration packs. Integration packs for Orchestrator contain additional activities that extend the functionality of Orchestrator.

    You can download integration packs from the Microsoft Download Center. Each integration pack has a guide that provides installation instructions, describes any known issues, and includes reference information for all of the activities supported by the integration pack.

    Microsoft provides integration packs for all of the System Center products, as well as other Microsoft and third party products and technologies.

    The following integration packs are available:

    IBM Tivoli Netcool/OMNIbus Integration Pack for System Center 2012 - Orchestrator Release Candidate

    VMware vSphere Integration Pack for System Center 2012 - Orchestrator Release Candidate

    Integration Pack for System Center Configuration Manager

    Integration Pack for System Center Data Protection Manager

    Integration Pack for System Center Operations Manager

    Integration Pack for System Center Service Manager

    Integration Pack for System Center Virtual Machine Manager

    Important Note:

    Integration Packs for Orchestrator 2012 still not ready and will be released when Orchestrator 2012 RTM release very soon, expected to release before end of this year, however you you can download prerelease IPs from here http://www.microsoft.com/download/en/details.aspx?id=27842, and each Integration Pack has it’s own required configuration and in the below example I will focus in Virtual Machine Manager 2008 R2 Integration Pack as an example.

    Register and Deploy Integration Pack:

    Step

    Description

    Screenshot
    1 Copy the Virtual_Machine_Manager_2008_R2_Integration Pack.oip integration pack file to the location of your choice on the runbook server that the Orchestrator is running..  
    2 Click Start, point to All Programs, point to Microsoft System Center 2012, and then click Orchestrator. Right-click Deployment Manager, and then click Run as Administrator 2
    3 In the left pane of the Deployment Manager, expand Management Server. Right-click Integration Packs, and then select Register IP with the Management Server. The Integration Pack Registration Wizard opens. Click Next. 3
    4 In the Integration Pack or Hotfix Selection window, click Add. Locate and select the IP_SystemCenterVirtualMachineManager_1.0.oip file that you copied in step 1. Click Open, then click Next. 4
    5 In the Completing the Integration Pack Wizard dialog box, click Finish. The End User Agreement dialog box appears. Click Accept. The Log Entries pane displays a confirmation message when the integration pack is successfully registered. 5

    5-1
    6 In the left pane of Deployment Manager, right-click Integration Packs, and then select Deploy IP to Action Server or Client. Click Next for the welcome page and then select Virtual Machine Manager 2008R2 Integration Pack, and then click Next. 6

    6-1
    7 Enter the name of a runbook server or a computer with Runbook Designer installed, on which you want to deploy the integration pack, click Add, and then click Next. 7
    8 In the Installation Options dialog box, select the options that apply to this deployment, and then click Next. 8
    9 To choose a time to deploy the integration pack, select Schedule installation check box, and then select the time and date from the Perform installation list box. 9
    10

    Select one of the following:
    a. Stop all running runbooks before installing the integration pack to stop all running runbooks before deploying the integration pack.
    b. Install the Integration Packs without stopping the running Runbooks to install the integration pack without stopping any running runbooks, then click Next.

     
    11 In the Completing Integration Pack Deployment Wizard dialog box, click Finish. 11
    12 When the integration pack is deployed, the Log Entries dialog displays a confirmation message.

    Note: because we configured a deployment schedule for the integration pack, so to verify that the deployment occurred check the event logs after the schedule time has passed.
    12
    Common Issues to consider when use VMM R2 Integration Pack:
    • Ensure that WinRM quickconfig is running on VMM Server to allow remote management.
    • Set PowerShell ExecutionPolicy Settings on the VMM sever to RemoteSigned.
    • Install the VMM Admin console on Orchestrator server, so the VMM PowerShell snap-in be available.
    Confirm the Windows Management Framework prerequisites
    1. Confirm that you have Windows PowerShell 2.0 installed on the Orchestrator server, and on the Virtual Machine Manager server. One way to do this is to open Registry Editor. Expand the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine subkey. Confirm that the value of the Runtime Version entry begins with v2.0. If this value begins with 1.0, or the subkey is not present, install Windows PowerShell 2.0 using the instructions in article 96829 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?linkID=193574).
    2. Confirm that you have Windows Remote Management 2.0 (WinRM 2.0) installed and configured on the Orchestrator server, and on the Virtual Machine Manager server. One way to confirm your configuration is in the Local Group Policy Editor.
    3. For more information about how to install and configure WinRM 2.0, see Installation and Configuration for Windows Remote Management (http://go.microsoft.com/fwlink/?linkID=171111).
    Enable Windows Remote Management Trusted Hosts:

    Step

    Description

    Screenshot
    1 On the Orchestrator server, open the Local Group Policy Editor. To do this click Start, click Run, type gpedit.msc, and then click OK.  
    2 In the Local Group Policy Editor, under Local Computer Policy, expand Administrative Templates, expand Windows Components, expand Windows Remote Management, expand WinRM Client, and then double-click Trusted Hosts r2
    3 On the Setting tab, click Enabled. Add the name or IP address of the Virtual Machine Manager Server to the Trusted Hosts list. Click OK. r3
    Set the execution policy in Windows PowerShell:

    The execution policy in Windows PowerShell determines which scripts must be digitally signed before they will run. By default, the execution policy is set to Restricted. This prohibits loading any configuration files or running any scripts.

    To run the scripts in this integration pack, you must set the execution policy to RemoteSigned. Use the following command: <System Drive>:\PS>set-executionpolicy remotesigned. For more information abouthow to configure the Windows PowerShell execution policy, see Set-ExecutionPolicy in the Microsoft TechNet Library (http://go.microsoft.com/fwlink/?linkID=113394) .

    Confirm the remote connection quota settings in Windows PowerShell:

    You can use WS-Management quotas in Windows PowerShell remoting to protect the Orchestrator server and VMM computers from excessive resource use, both accidental and malicious. The MaxConcurrentOperationsPerUser quota setting in the WSMan:\<ComputerName>\Service node provides this protection by imposing a limit on the number of VMM objects that can run concurrently.

    By default, MaxConcurrentOperationsPerUser is set to 5. This means that you can run a maximum of five VMM objects (shells) concurrently across all VMM policies.

    If this default setting does not meet the needs of your organization, see About_Remote_Troubleshooting in the Microsoft TechNet Library (http://go.microsoft.com/fwlink/?linkID=135188) for information about how to configure remote operations in Windows PowerShell.

    Configure the System Center Virtual Machine Manager Connections:

    Step

    Description

    Screenshot
    1 In the Runbook Designer, click the Options menu, and then select System Center Virtual Machine Manager. The System Center Virtual Machine Manager dialog box appears. vm1
    2 On the Configurations tab, click Add to begin the connection setup. vm2
    3 In the Name box, type the name or IP address of the computer on which Virtual Machine Manager is running. vm3
    4 In the Type box, click the ellipsis button (...), select Microsoft SCVMM Connection, and then click OK  
    5 In the Properties box, enter values for each of the properties as they apply to your organization. Ensure the values that you enter for the remote connection and authentication properties are compatible with the WinRM settings that you entered or confirmed in the previous procedure  
    6 Click OK, then click Finish.  

    Till this stage we able to deploy and configure the integration pack, and we can see and use all SCVMM activities from Orchestrator 2012 Runbook Designer in any new Runbook as show in screenshot below:

    vmm-ip

    ------------------------------------------------------------------

    Related Posts:
  • Extracting BizTalk Messages Content using XPath in Custom Pipeline Components

    Introduction

    You find yourself writing custom pipeline components in nearly all BizTalk related projects. So this is a common activity. And usually it will mean eventually you will need to extract data from the message coming on the wire using XPath statements.

    Problem

    The issues you usually face while trying to extract data from BizTalk massages is that the message stream would not seekable. And another problem is how to do this data extraction with the minimal memory footprint (no XmlDocument L) and also as fast as possible.

    Solution

    I created mainly two functions that I use commonly for these tasks. The first one is to get the stream from the message and create a seekable one to be used later on.

    private Stream GetMessageStream(Microsoft.BizTalk.Message.Interop.IBaseMessage msg, Microsoft.BizTalk.Component.Interop.IPipelineContext context)

    {

        Stream stream = msg.BodyPart.GetOriginalDataStream();

     

        if (!stream.CanSeek)

        {

            ReadOnlySeekableStream readStream = new ReadOnlySeekableStream(stream);

     

            if (context != null)

            {

                context.ResourceTracker.AddResource(readStream);

            }

     

            msg.BodyPart.Data = readStream;

            stream = readStream;

        }

        return stream;

    }

    The second method is the one that would perform the data extraction as follows.

    private string ExtractDataValueXPath(Stream MsgStream, string MsgXPath)

    {

        XmlReaderSettings settings = new XmlReaderSettings()

        {

            ConformanceLevel = ConformanceLevel.Document,

            IgnoreWhitespace = true,

            ValidationType = ValidationType.None,

            IgnoreProcessingInstructions = true,

            IgnoreComments = true,

            CloseInput = false

        };

        MsgStream.Seek(0, SeekOrigin.Begin);

        XmlReader reader = XmlReader.Create(MsgStream, settings);

        string strValue = null;

        if (!string.IsNullOrEmpty(MsgXPath))

        {

            if (reader.Read())

            {

                XPathDocument xPathDoc = new XPathDocument(reader);

                XPathNavigator xNavigator = xPathDoc.CreateNavigator();

                XPathNodeIterator xNodes = xNavigator.Select(MsgXPath);

                if (xNodes.Count != 0 && xNodes.MoveNext())

                {

                    strValue = xNodes.Current.Value;

                }

                MsgStream.Seek(0, SeekOrigin.Begin);

            }

        }

        return strValue;

    }

    As you can see I am using XPathDocument with a XmlReader to perform this as fast as possible.