How to load balance FIM

by Henrik Nilsson 23. November 2009 11:26

Darryl Russi have posted a great article on how to configure for more than one instance of the FIM Service.
If you haven’t discovered Darryl’s blog yet, make sure you bookmark it or add a feed subscription!

Service Partitions - Multiple Middle Tiers, Request & Workflow Processing

Tags: ,

Forefront Identity Manager | Identity Management | Workflow

EnumerateResourcesActivity - the follow-up

by Henrik Nilsson 16. November 2009 22:13

A couple of months ago Joe Zamora (the CShark) was trying to solve the mysteries around the EnumerateResourcesActivity, a great activity that you could use from your own custom activities/workflows but not from the FIM workflow designer, read Joe’s post here. After a lot of work, some help from Nima in the product team and a couple of not that useful tips from me Joe got it working. See the forum post where me and Joe was trying to accomplish this here.

The EnumerateResourcesActivity is the only activity that could search for and return resources in FIM and it does so simply by you giving it an XPath query. It’s a really nice activity except it’s got limitations in that it can only contain a single child activity (actually not strange at all, the same goes for the ReplicatorActivity) and it has a got a designer that doesn’t allow for adding the child activity declaratively so you’re forced to add the single child using code. The EnumerateResourcesActivity work pretty much as the ReplicatorActivity in that it iterates bunch of values only in the case of the EnumerateResourcesActivity it finds the values (resources) before iterating them. An important aspect of workflow crafting is that an activity can’t be executed twice and that is handled by the EnumerateResourcesActivity by creating duplicates of the child activity objects (and descendant objects of the child activity) for each iteration before the iteration is started therefore you can’t use the original activity object references for getting activities within the iterations.

Joe used a CodeActivity as the single child but the solution I’m going to show you will use a SequenceActivity instead making it possible to add more than one single activity because you will probably want to do work suited for other activities like add a user to the group you have found or something like that.

I won’t go through all the stuff around activity crafting, for this you’ll have to turn to the Windows Workflow Foundation developer center , the Forefront Identity Manager 2010 Developer Reference or maybe the oracle scrapheap's named Google and Bing. First of all we need some code in the designer part of our custom Activity class (A custom activity is usually created from two partial classes when you create it in Visual Studio). In the InitializeComponent method I create a EnumerateResourcesActivity, add a SequenceActivity to it and to the SequenceActivity I add a CodeActivity but I leave for you to create more child activities to the SequenceActivity after the CodeActivity. Finally I add the EnumerateResourcesActivity to the custom activity I’m currently creating:

private void InitializeComponent()
{
    this.CanModifyActivities = true;

    // codeActivity
    this.codeActivity = new CodeActivity();
    this.codeActivity.ExecuteCode += new System.EventHandler(this.codeActivity_ExecuteCode);

    // sequenceActivity
    this.sequenceActivity = new SequenceActivity();
    this.sequenceActivity.Activities.Add(this.codeActivity);

    // enumResourcesActivity 
    this.enumResourcesActivity = new Microsoft.ResourceManagement.Workflow.Activities.EnumerateResourcesActivity();
    this.enumResourcesActivity.PageSize = 100;
    this.enumResourcesActivity.XPathFilter = "/Person";
    this.enumResourcesActivity.Activities.Add(this.sequenceActivity);
            
    // MyCustomActivity
    this.Activities.Add(this.enumResourcesActivity);
    this.Name = "MyCustomActivity";

    this.CanModifyActivities = false;
}

Did you notice the XPathFilter property of the EnumerateResourcesActivity that I’ve set to return all person objects? You might think it’s strange that I add a CodeActivity as the only child of the SequenceActivity but I use this for getting the resource for the current iteration and it also gives a method that you could use for assigning values to siblings further down the execution chain from the CodeActivity that I leave up to you to add.

Here’s how I extract the value from the EnumerateResourcesActivity:

void codeActivity_ExecuteCode(object sender, EventArgs e)
{
    SequenceActivity s = (SequenceActivity)((CodeActivity)sender).Parent;
    ResourceType resource = EnumerateResourcesActivity.GetCurrentIterationItem(s) as ResourceType;

    // Perform initialization of any sibling activities here but remember you must reference
// them as I’ve done above with the SequenceActivity
// and a good way of doing it could be for example...
// UpdateResourceActivity u = s.Activities.OfType<UpdateResourceActivity>().First();
// or other generic “queries”.
}

First of all we need to get the SequenceActivity of the current iteration and since we know it’s the parent of the CodeActivity we could get the Parent property object of the current CodeActivity object instance that we’ve got from the sender parameter. Then we call the static GetCurrentIterationItem method passing in the SequenceActivity object instance and this should return the resource for the current iteration.

Next I leave up to you to use the values of the found resources to do whatever you wish and that could be for example update the resources found, delete the resources found or maybe create new resources from whatever values the found resources contain.

Tags: , ,

Forefront Identity Manager | Identity Management | Workflow

FIM 2010 RC1 Breaking change, DesignerHostProvider :-(

by Henrik Nilsson 4. October 2009 13:20

In my activities I’ve been using the ProcessParameterPicker extensively, a control that show’s a button with the text “Lookup” and when clicked you would have the possibility to select from different available attributes.

In RC0 this control was available by calling base.DesignerHostProvider.CreateParameterPickerControl() from a class that inherited ActivitySettingsPart since the DesignerHostProvider property was protected, with other words available from inherited classes.

designerHostProvider RC0

In RC1 the Product Team don’t want us too use the ProcessParameterPicker control from custom activities anymore so they’ve made it internal. This made all my activities useless in RC1 unless the ProcessParameterPicker is removed from the code.

designerHostProvider RC1

Another breaking change is that the Microsoft.IdentityManagement.WebBase.dll has been removed and what it used to contain has been moved to Microsoft.IdentityManagement.WFExtensionInterfaces.dll but this is simply solved by removing the reference to Microsoft.IdentityManagement.WebBase.dll and updating the reference to Microsoft.IdentityManagement.WFExtensionInterfaces.dll.

Currently I’m waiting for the VHD to be released before I’ll update my library for RC1 and we’ll see how I’ll be able to handle the ProcessParameterPicker…

They’ve also forgotten to update the SDK with this change.
(On the “Using Custom Activities in FIM” page, ActivitySettingsPart):
image 

I’ve added a request to the make the ProcessParameterPicker available again because I don’t see the reason why this has been taken away for custom activities: https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=495726&SiteID=433

Update 2009-10-05: Microsoft have chosen to make the ProcessParameterPicker internal with this explanation...

As part of the changes between RC0 and RC1 we locked down the vast majority of our classes, including the class that you identified here, as a best practice of exposing only supported interfaces publically.

Tags:

Forefront Identity Manager | Workflow

Codeless Provisioning Sync Rules – The Patent

by Henrik Nilsson 21. September 2009 20:28

Want to learn codeless provisioning the FIM 2010 way? Have a look at: http://www.patents.com/CODELESS-PROVISIONING-SYNC-RULES/US20090222833/en-US/

Register and you’re able to download the patent as pdf with pictures.

Tags: ,

Forefront Identity Manager | Sync Functions | Workflow

Copyright © 2009 Henrik Nilsson
Log in

About the author

Henrik - the author Hi and welcome to Stockholm, Sweden!
I'm Henrik Nilsson and the author of this blog.
I do hope you find something interesting during your visit...


More about me...

Contact me...

This site and content is my own work and opinion, it does not necessary reflect the opinions of my employers at Cortego.

View Henrik Nilsson's profile on LinkedIn

Followers