September 19, 2009

Debug with Powershell ISE

This is a great post on debugging in powershell. You will also find links to basic debugging in the ISE.

September 18, 2009

Using the AzMan Helper Classes VI

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the sixth and final post regarding the usage of these helper classes:
public string[] GetApplicationGroupMemberNames(string storeUrl, string applicationName, string applicationGroupName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup applicationGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
return ApplicationGroupHelper.GetApplicationGroupMemberNames(applicationGroup);
}


public bool IsApplicationGroupMemberNameExists(string storeUrl, string applicationName, string applicationGroupName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup applicationGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
return ApplicationGroupHelper.IsApplicationGroupMemberNameExists(applicationGroup, memberName);
}

//Get the SIDs
public string[] GetApplicationGroupMembers(string storeUrl, string applicationName, string applicationGroupName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup applicationGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
return ApplicationGroupHelper.GetApplicationGroupMembers(applicationGroup);
}

public bool IsApplicationGroupMemberExists(string storeUrl, string applicationName, string applicationGroupName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup applicationGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
return ApplicationGroupHelper.IsApplicationGroupMemberExists(applicationGroup, memberSID);
}


This concludes what is basically almost everything in AzMan via C#. In the upcoming weeks, I will move to show some more Active Directory code using C#.

September 17, 2009

Using the AzMan Helper Classes V

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the fifth post regarding the usage of these helper classes:
 public void AddMemberToApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.AddMember(memberSID, null);
appGroup.Submit(0, null);
}

public void RemoveMemberFromApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.DeleteMember(memberSID, null);
appGroup.Submit(0, null);
}

public void AddMemberNameToApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.AddMemberName(memberName, null);
appGroup.Submit(0, null);
}

public void RemoveMemberNameFromApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.DeleteMemberName(memberName, null);
appGroup.Submit(0, null);
}

//Add Member to denied list
public void AddDeniedMemberToApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.AddNonMember(memberSID, null);
appGroup.Submit(0, null);
}

public void RemoveDeniedMemberFromApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.DeleteNonMember(memberSID, null);
appGroup.Submit(0, null);
}

public void AddDeniedMemberNameToApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.AddNonMember(memberName, null);
appGroup.Submit(0, null);
}

public void RemoveDeniedMemberNameFromApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.DeleteNonMemberName(memberName, null);
appGroup.Submit(0, null);
}

September 16, 2009

Using the AzMan Helper Classes IV

To everyone who has sent me "thanks" emails regarding these AzMan tutorials, you are very welcome. It has always been perplexing to me why there are not many examples of AzMan out there. Anyway, back to the next post on this...

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the fourth post regarding the usage of these helper classes:
 public string[] GetRoleDefinitions(string storeUrl, string applicationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return RoleDefinitionHelper.GetRoleDefinitionNames(app);
}

public void AddRoleDefinition(string storeUrl, string applicationName, string roleDefinitionName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
RoleDefinitionHelper.AddRoleDefinition(app, roleDefinitionName);
}

public void RemoveRoleDefinition(string storeUrl, string applicationName, string roleDefinitionName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
RoleDefinitionHelper.RemoveRoleDefinition(app, roleDefinitionName);
}

public bool IsRoleDefinitionExists(string storeUrl, string applicationName, string roleDefinitionName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return RoleDefinitionHelper.IsRoleDefinitionExists(app, roleDefinitionName);
}

public string[] GetApplicationGroups(string storeUrl, string applicationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return ApplicationGroupHelper.GetApplicationGroupNames(app);
}

public void AddApplicationGroup(string storeUrl, string applicationName, string applicationGroupName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
ApplicationGroupHelper.AddApplicationGroup(app, applicationGroupName);
}

public void RemoveApplicationGroup(string storeUrl, string applicationName, string applicationGroupName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
ApplicationGroupHelper.RemoveApplicationGroup(app, applicationGroupName);
}

public bool IsApplicationGroupExists(string storeUrl, string applicationName, string applicationGroupName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return ApplicationGroupHelper.IsApplicationGroupExists(app, applicationGroupName);
}
I'll have 1-2 more posts on this and then move onto something else.

September 15, 2009

Using the AzMan Helper Classes III

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the third post regarding the usage of these helper classes:
public void AddMemberToRole(string storeUrl, string applicationName, string roleName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
RoleMemberHelper.AddRoleMember(role, memberSID);
}
public void RemoveMemberFromRole(string storeUrl, string applicationName, string roleName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
RoleMemberHelper.RemoveRoleMember(role, memberSID);
}

//add by UPN
public void AddMemberNameToRole(string storeUrl, string applicationName, string roleName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
RoleMemberHelper.AddRoleMemberName(role, memberName);
}

public void RemoveMemberNameFromRole(string storeUrl, string applicationName, string roleName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
RoleMemberHelper.RemoveRoleMemberName(role, memberName);
}

//Get a list of role member names for a specified role
public string[] GetRoleMemberNames(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
return RoleMemberHelper.GetRoleMemberNames(role);
}

public bool IsRoleMemberNameExists(string storeUrl, string applicationName, string roleName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
return RoleMemberHelper.IsRoleMemberNameExists(role, memberName);
}

//Get a list of role member SIDs for a specified role
public string[] GetRoleMembers(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
return RoleMemberHelper.GetRoleMembers(role);
}

public bool IsRoleMemberExists(string storeUrl, string applicationName, string roleName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
return RoleMemberHelper.IsRoleMemberExists(role, memberSID);
}

September 14, 2009

Using the AzMan Helper Classes II

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the second post regarding the usage of these helper classes:
//Get list of operation names of the application
public string[] GetOperations(string storeUrl, string applicationName)
{
ArrayList operationNames = new ArrayList();

IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
foreach (IAzOperation operation in app.Operations)
{
operationNames.Add(operation.Name);
}

return (string[])operationNames.ToArray(typeof(string));
}

public void AddOperation(string storeUrl, string applicationName, string operationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
OperationHelper.AddOperation(app, operationName);
}

public void RemoveOperation(string storeUrl, string applicationName, string operationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
OperationHelper.RemoveOperation(app, operationName);
}

public bool IsOperationExists(string storeUrl, string applicationName, string operationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return OperationHelper.IsOperationExists(app, operationName);
}

public string[] GetRoles(string storeUrl, string applicationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return RoleHelper.GetRoleNames(app);
}

public void AddRole(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
RoleHelper.AddRole(app, roleName);
}

public void RemoveRole(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
RoleHelper.RemoveRole(app, roleName);
}

public bool IsRoleExists(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return RoleHelper.IsRoleExists(app, roleName);
}

September 13, 2009

CodePlex Foundation?

Thanks Microsoft for this! But, did you really have to use codeplex and confuse us with the current Codeplex.com site?