October 15, 2009

AzMan Bulk Import/Export Tool V2

So I started writing a v2 a while back that was a complete UI using .NET 3.5 and XAML. It was done so that I can finally upgrade the code and play a bit with XAML. I never finished that code and plan to go back to it, but will have to label it v3.0. The v2.0 that I am adding here is a console based application based off my original work and some work done by David E. This code will do a bulk import/export for:
  • Xml store
  • AD store
  • SQL Store
The code was modified a bit and can be used like this:
AzManBulkImport.exe {source policy store}{source policy store}{copy users}
There are a few minor things to keep in mind with this new version:
  • Migrating App Groups with incorrect LDAP Strings crashes the migration.
  • There is no check to make sure the database in the connection string exists.
  • XML AzMan store defaults to no-users in policy store administrators group, meaning everyone has access. SQL AzMan says that no-one in the policy store administrators group means no one has access. Migrating an XML store without any administrators to a SQL store results in an access problem, as no-one will have access to the policy store after the policy store administrators are deleted from SQL server. There is an error message to reflect this situation.
  • David has changed the Operations migration to compare old and new operations using the Operation ID, instead of the old comparison on Operation Name.
An example of the usage can be:
AzManBulkImport.exe "mssql://Driver=SQL Server;Server=dbserver01;Trusted_Connec
tion=True;/MyAzmanDatabase/MyPolicyStore" "d:\Azman.xml" "true"
This basically says to copy from the specified SQL Server store to the specified XML Store, including all user role assignments. You can change from XML to AD Ldap connection string or Ldap connection string to SQL server.

To recap, v2.0 of this code is console based and has a few updates with the major being SQL Server capability. Some of the code is a bit rough, but it works :) I do hope to release v3.0 if I ever get time to work on it again.

You can download the code here.

3 comments:

  1. Hey Joe,

    Was tinkering with the Azman tool and wondered if you might have any suggestions on something I'm working on. We need to, in a web service, create an XML representation of the AzMan store for transit.

    Unfortunatley AzMan doesn't seem to give you access to the XML, only writing it to a file). Am I missing something?

    Also two quick code notes, I think in your usage examples in the code, files are referred to without the "msxml://" pre-pended.

    Also there’s a conditional of "if (false == true)" in TransportHelper.cs line 575, and I was curious if that's an oversight or on purpose.

    Anyway, your thoughts would be greatly appreciated.

    Regards,
    Rob

    ReplyDelete
  2. Hey Rob!

    First to the questions:
    1. msxml should be there...good catch, I'll update that.
    2. That is kind of odd :) I'll take a look...lol.

    Regarding your other question, I think I need more details..let's take it offline. Send me an email to my hotmail account...it should be there in the notes, if not, let me know.

    ReplyDelete
  3. Hi Rob,

    When I'm trying to run your tool to export from xml to SQL server I only get this error:

    System.Runtime.InteropServices.COMException (0x800704B4): The specified network provider name is invalid. (Exception from HRESULT: 0x800704B4)

    I use this:
    AzManBulkImport.exe "MyAuthorizationStore.xml" "mssql://Driver={SQL Server};Server={MyServer};/test/MyPolicyStore" "true"

    It is no problem with the sql connection string since I can create a new store using the AzMan mmc.

    Any ideas what it can be?

    ReplyDelete