Today I found myself playing with the BHOLD Access Management Connector for FIM 2010 R2. My earlier implementations have been without this connector so I haven't had much time to work with it.
I did, however, have some trouble getting my exports to go to BHOLD. I had followed the guide and done my provisioning properly (using my provisioning framework). Even so, I kept getting 'cd-error' errors on my exports. There was no information about the error to be found anywhere, so I decided to put on my gloves and accept the challenge.
I eventually found the problem by adding a new diagnostics listener for the BHOLD connector to miiserver.exe.config to be able to gather diagnostics from this Management Agent. I couldn't find any information on how to do this anywhere (probably just me), but after some serious peeking and poking around, I managed to construct a new source that worked -
<source name="Microsoft.AccessManagement.BHOLDConnector" switchValue="Verbose">
<listeners>
<remove name='Default' />
<add name="BHOLDAMCEventLogListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\temp\BHOLD.log" />
</listeners>
</source>
After adding this to the <sources> section under <system.diagnostics> and restarting the FIMSynchronizationService, I started getting traces in the BHOLD.LOG file in my C:\Temp folder.
This tracelog led me on track as the log showed a SQL exception for an user INSERT statement. Turned out that I didn't have an export flow to the bholdDescription attribute for the users I was pushing to BHOLD; and the bholdDescription is apparently mandatory for users (can't find any documentation to support this, though).
Behold, success! Once an export flow for displayName ==> bholdDescription was added, all my users adds went through smoothly.
Showing posts with label diagnostics. Show all posts
Showing posts with label diagnostics. Show all posts
Wednesday, November 13, 2013
Wednesday, September 12, 2012
Nifty little logging function for .NET code
This is not directly related to FIM 2010, but thought I'd share it anyway.
Whenever I write some code (workflows, Management Agents or such), I like to add a little logging. Usually I make sure that it can be switched on and off through a registry key.
In the log, it's nice if you can see just where in the code processing is taking place. Instead of hard coding function names, I use the little function below to get me a string of the current function names.
public static string GetEntryPointName()
{
StackTrace trace = new StackTrace();
int index = 0;
string str = null;
for (index = trace.FrameCount - 2; index >= 2; index += -1)
{
if (str != null)
{
str = str + "->";
}
str = str + trace.GetFrame(index).GetMethod().Name;
}
trace = null;
return str;
}
You'll need to include System.Diagnostics to use the StackTrace method.
Throughout my code, I now just put something similar to this -
Log(string.Format("{0}: {1}", GetEntryPointName(), logMessage);
The output in the logging is similar to this (this is a snippet from a log file for my PowerShell Management Agent) -
InvokeBeginImportWorker->OpenImportConnection->Log InvokeBeginImportWorker->OpenImportConnection: Enter
InvokeBeginImportWorker->OpenImportConnection Getting schema
InvokeBeginImportWorker->OpenImportConnection Type: user
InvokeBeginImportWorker->OpenImportConnection Anchor attribute: objectGuid
InvokeBeginImportWorker->OpenImportConnection Attribute: objectSid
InvokeBeginImportWorker->OpenImportConnection Attribute: homeDirectory
InvokeBeginImportWorker->OpenImportConnection Attribute: sAMAccountName
InvokeBeginImportWorker->OpenImportConnection Attribute: sn
InvokeBeginImportWorker->OpenImportConnection Attribute: givenName
InvokeBeginImportWorker->OpenImportConnection Attribute: objectGuid
InvokeBeginImportWorker->OpenImportConnection Attribute: displayName
InvokeBeginImportWorker->OpenImportConnection Got schema
InvokeBeginImportWorker->OpenImportConnection->InitializeConfigParameters->Log InvokeBeginImportWorker->OpenImportConnection->InitializeConfigParameters: Enter
Now, go log your pants off...
Whenever I write some code (workflows, Management Agents or such), I like to add a little logging. Usually I make sure that it can be switched on and off through a registry key.
In the log, it's nice if you can see just where in the code processing is taking place. Instead of hard coding function names, I use the little function below to get me a string of the current function names.
public static string GetEntryPointName()
{
StackTrace trace = new StackTrace();
int index = 0;
string str = null;
for (index = trace.FrameCount - 2; index >= 2; index += -1)
{
if (str != null)
{
str = str + "->";
}
str = str + trace.GetFrame(index).GetMethod().Name;
}
trace = null;
return str;
}
You'll need to include System.Diagnostics to use the StackTrace method.
Throughout my code, I now just put something similar to this -
Log(string.Format("{0}: {1}", GetEntryPointName(), logMessage);
The output in the logging is similar to this (this is a snippet from a log file for my PowerShell Management Agent) -
InvokeBeginImportWorker->OpenImportConnection->Log InvokeBeginImportWorker->OpenImportConnection: Enter
InvokeBeginImportWorker->OpenImportConnection Getting schema
InvokeBeginImportWorker->OpenImportConnection Type: user
InvokeBeginImportWorker->OpenImportConnection Anchor attribute: objectGuid
InvokeBeginImportWorker->OpenImportConnection Attribute: objectSid
InvokeBeginImportWorker->OpenImportConnection Attribute: homeDirectory
InvokeBeginImportWorker->OpenImportConnection Attribute: sAMAccountName
InvokeBeginImportWorker->OpenImportConnection Attribute: sn
InvokeBeginImportWorker->OpenImportConnection Attribute: givenName
InvokeBeginImportWorker->OpenImportConnection Attribute: objectGuid
InvokeBeginImportWorker->OpenImportConnection Attribute: displayName
InvokeBeginImportWorker->OpenImportConnection Got schema
InvokeBeginImportWorker->OpenImportConnection->InitializeConfigParameters->Log InvokeBeginImportWorker->OpenImportConnection->InitializeConfigParameters: Enter
Now, go log your pants off...
Subscribe to:
Posts (Atom)