index
int64
0
4.08k
text
stringlengths
34
4.9k
url
stringclasses
38 values
696
@RuleTemplate = "PassThroughClaims" @RuleName = "Pass through email" c:[Type == "http://schemas.xmlsoap.org/claims/EmailAddress"] => issue(claim = c); After the text file has been created, append the current issuance transform rules to the file with the following commands: $RPTrust = Get-ADFSRelyingPartyTrust Add-Content C:\temp\RPTrust.txt $RPTrust.IssuanceTransformRules Failure to append the current issuance transform rules to the file will overwrite all existing transform rules for the party trust. Apply the transform rule set to the relying party trust: Set-ADFSRelyingPartyTrust -TargetName "<RPTName>"↵ -IssuanceTransformRulesFile "C:\temp\RPTrust.txt" Discussion For situations that require you to communicate from AD FS 2.x to AD FS 1.x, you must configure claim rules to send claims in a way that AD FS 1.x can comprehend. To do this, create the claim rules as shown in the solution. Default and custom claims can be extracted from attribute stores to send to the AD FS 1.x servers. See Also “Planning for Interoperability with AD FS 1.x” 19.10. Configuring Logging for AD FS Problem You want to configure the logging level captured in the Windows Event Log for AD FS. Solution Using Windows PowerShell Set-ADFSProperties -LogLevel Errors,Warnings,Information 19.10. Configuring Logging for AD FS | 671
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
697
Discussion By default, AD FS performs verbose logging of all events related to the AD FS service. To lower the logging level of the AD FS service, you must set the AD FS LogLevel properties to the logging levels you wish to capture. Available log levels are FailureAu dits, SuccessAudits, Errors, Information, Warnings, Verbose, and None. You can configure multiple logging levels with one command as shown in the solution. Note that you cannot configure the AD FS logging level through the AD FS management console. See Also “Configuring Computers for Troubleshooting AD FS 2.0” 672 | Chapter 19: Active Directory Federation Services
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
698
CHAPTER 20 Microsoft Exchange Server 2013 20.0. Introduction Microsoft Exchange Server is Microsoft’s flagship messaging and collaboration server application. Exchange manages email messages through a proprietary MAPI protocol for rich use with Microsoft Outlook clients as well as the Internet standard protocols POP3, IMAP4, and SMTP. It is a scalable enterprise solution from gateway to mailbox with expected functionality including backup and recovery, message hygiene, and mail‐ box management. Several features that have evolved over the years are still present in the latest version, including Outlook Web App (OWA), Public Folders, cached Exchange mode, and mobile device synchronization with ActiveSync (the primary mechanism for Windows RT devices to communicate with Exchange. Other features have been added or improved significantly for 2013, such as a single unified management console, Data Loss Prevention (DLP), and OWA optimization for smartphones and tablets. Exchange has a set of APIs that can be used to integrate custom applications or access specific Exchange data. Exchange can be an important component of a business col‐ laboration system. We are not going to cover every single PowerShell cmdlet or all possible recipes for configuring Exchange, but we will introduce a good cross section of common tasks that Exchange implementers or administrators may need to perform their duties. 20.1. Exchange Server and Active Directory Even with the major changes in Exchange, one of the mainstays over the past few ver‐ sions is the use of Windows Active Directory as the Directory Services provider. Ex‐ change 2000 Server was one of the first AD-aware applications. Indeed, AD is partly based on the Exchange directory used in Exchange 5.5 and earlier. Installing Exchange requires first extending the AD schema with Exchange-specific attributes. A successful implementation of Microsoft Exchange Server is dependent therefore on a successful 673
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
699
implementation of Active Directory. In addition, Exchange routing is now dependent on AD Site topology instead of its own routing engine, as was present in 2003. This deep integration also means that AD topology design should also consider Ex‐ change messaging requirements. The AD and Exchange relationship also makes an Exchange chapter a suitable addition to this book. 20.2. Exchange Server 2013 Architecture Microsoft has made significant changes to Exchange Server with Exchange 2013. Some of the architecture for the latest version is different from Exchange 2010 and other earlier versions, and as a result, so are the mechanisms for deploying and administering Ex‐ change. Exchange 2013 requires Windows Server 2008 R2 or Windows Server 2012. Exchange 2013 has reverted some of the modularity found in Exchange 2010 by sepa‐ rating functionality into just two different server roles. There are two Exchange roles to choose from at installation: • Client Access Server • Mailbox Server Only the selected role(s) are installed. Other installation options include Clustered Mailbox Roles and the Management Tools. The roles can share residence on a single server or be placed on separate servers as part of a deployment strategy. Exchange Server Tools Exchange administration is shared between the Exchange Management Shell (EMS) and the Exchange Administration Center (EAC); however, the EAC is built upon the EMS. Every configuration performed in the console has an equivalent command-line entry using the shell. Exchange Management Shell As we have seen in the previous chapters, PowerShell revolutionizes the command-line experience in Windows. With Exchange 2013, there are more than 900 cmdlets to assist with Exchange management. PowerShell uses an XML file as a console definition file to identify snap-ins to be loaded with PowerShell. For the EMS, this file is named exshell.psc1 and is called with the parameter -PSConsoleFile. The Exchange Management Shell is an extension of PowerShell. The shortcut for the EMS actually uses the following command: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile↵ "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -noexit↵ -command ".'C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1'" 674 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
700
Exchange Administration Center The EAC is a web-based management center that allows you to easily manage multiple Exchange servers. It is a graphical representation of underlying shell commands in the EMS. The EAC replaces the Exchange Management Console that existed in Exchange 2007 and Exchange 2010. The EAC allows you to manage the Exchange Server envi‐ ronment, regardless of whether it is a local on-premises installation, in the cloud, or in a hybrid Exchange deployment scenario. The EAC can be accessed from a web browser by navigating to https://<CASServer‐ Name>/ecp. Exchange Scripts Folder Not to be overlooked in terms of Exchange administration is the scripts folder. Installed with Exchange Server, the folder includes several PowerShell scripts that can be used to easily make specific changes or that can be amended to customize components: C:\Program Files\Microsoft\Exchange Server\V15\Scripts\ For example, in the scripts folder, there are PowerShell scripts to enable anti-malware scanning on a Mailbox server and to export Message Classifications for distribution to Outlook clients. Administrators can also add their own custom Exchange scripts to this folder as it is added to the Windows Path environment variable when Exchange is in‐ stalled. It is not necessary, therefore, to remember the entire path to the scripts folder when executing scripts from the command line. Third-Party Tools Sometimes third parties create innovative utilities that can accomplish a task with greater ease than the native tools. There are numerous products, both free and com‐ mercially available, that can assist with Exchange management. joe Richards maintains several Active Directory and Exchange utilities through his website. A few tools that we use in this chapter, including ExchMbx, AdFind, and AdMod, are available as freeware. 20.3. Finding Exchange Server Cmdlets Problem You want to generate a reference list of all the Exchange Server cmdlets available in the Exchange Management Shell. 20.3. Finding Exchange Server Cmdlets | 675
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
701
Solution Using PowerShell PowerShell has a cmdlet that can list all the available cmdlets in PowerShell or the EMS, called Get-Command. A subset of this cmdlet, called Get-ExCommand, returns only the cmdlets added to PowerShell with the installation of the EMS. To get a list of all the EMS cmdlets, execute the following cmdlet: Get-ExCommand | FL Name,Definition >> c:\ExCommandList.txt This will generate a formatted list of all of the EMS cmdlets and their definitions in a text file on the C:\ drive. Discussion The purpose of the Get cmdlets is really to serve as a search and query tool. When specific cmdlet properties are designated, Get-Command will return only the cmdlets representing the filter properties requested. Get-ExCommand is actually Get-Command with a built-in filter for cmdlets, called Microsoft.Exchange.Management.Power Shell.Admin, that are part of the PSSnapin, which we know as the Exchange Manage‐ ment Shell. For example, we can show all EMS cmdlets with the word mailbox as part of the object, as follows: Get-ExCommand *mailbox* See Also The Exchange Management Shell Quick Reference 20.4. Preparing Active Directory for Exchange Problem You want to prepare your Active Directory forest and domains for the installation of your first Exchange server. Solution Using a graphical user interface Exchange Server requires that the Active Directory forest schema be extended before installation. Exchange extends AD with new attributes. This step is done automatically through the GUI setup process. Running setup from the GUI therefore requires Schema Admin rights (in addition to Enterprise Admin and Domain Admin rights, which are discussed in more detail in “Discussion” on page 678). 676 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
702
There is no separate mechanism to apply schema extensions or prepare the domain independent of installing the Exchange Server binaries when using the GUI. This makes the GUI a reasonable option for smaller shops; however, larger businesses with division of administrative duties will certainly want to use the command-line option instead. Using a command-line interface Exchange Server uses Setup.exe at the root of the installation media to control aspects of preparation, installation, and even recovery. Setup.exe can be run from the command line with the appropriate parameters applied. The command line allows for easier sep‐ aration of administrative duties based on permission level. The Exchange administrator may not have schema admin rights in AD. For AD preparation, there are several pa‐ rameters to be applied in order. /PrepareSchema This switch updates the Active Directory schema by importing a set of .ldf files for Exchange. /PrepareAD This switch creates the Exchange configuration container in AD, creates the Exchange-related universal security groups (USGs), and applies the appropriate permissions. The /PrepareAD switch will also run the /PrepareSchema switch if it has not been run. /PrepareDomain This switch configures the necessary permissions and configuration of the domain in preparation for installation of Exchange Server. /PrepareAllDomains This switch prepares all the domains in the forest at once. /IAcceptExchangeServerLicenseTerms This switch is required for all command-line operations, and is required each time a command is issued. /OrganizationName This switch accepts input to specify the name of the Exchange organization. This switch has a 64-character limit, including letters, numbers, spaces, hyphens, and dashes. /DomainController This switch allows you to specify the domain controller that setup.exe will use to read from and write to Active Directory. /ActiveDirectorySplitPermissions This switch allows you to enable Active Directory split permissions mode when preparing the Active Directory topology. 20.4. Preparing Active Directory for Exchange | 677
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
703
This series of setup steps is sequential. The schema needs to be extended before AD is configured, and that must complete prior to the domains being prepared. Especially in a wide area topology, you should leave sufficient time in between steps to allow for AD replication between domain controllers. Discussion Microsoft Exchange will not run in an Active Directory forest unless the forest and the domain have been properly prepared. Microsoft did not make the assumption that everyone or every AD forest would use Exchange and therefore did not include all of the Exchange attributes and classes in the base Active Directory schema. The ability to dynamically extend the schema for Active Directory makes it possible to require only those people running Exchange to install the Exchange infrastructure and only in the AD forests where they need Exchange. In addition to schema changes, you have to make security changes to Active Directory and the domain policy, as well as create some basic Exchange infrastructure objects. All of this is completed in the AD and Domain preparation processes for Exchange. Do not confuse these with the Active Directory ForestPrep and DomainPrep processes (using the adprep command); the concept is the same but the specific changes are different. You need to run the PrepareSchema and PrepareAD processes once per forest to make the schema changes, create the Exchange organization structure in the Configura tion container, and set up Exchange-specific permissions. We recommend that you create a security group in your root domain for this delegation. You could use a domain local group in a single domain forest in which you will never create another domain. In a multidomain forest, you must use a global group or a universal group. The group is used to assign rights to objects in the Configuration container. Whether you use a global or universal group is up to you—either will do the job. You need to run the PrepareDomain processes in the root domain of the forest and for every domain that will contain mail-enabled objects. Normally, PrepareDomain is run on every domain in an Active Directory forest. The process creates Exchange security principals, modifies the domain security policy, creates some Exchange-specific infra‐ structure objects, and assigns permissions for Exchange-specific objects. The Prepare‐ Domain processes require the person running the process to be a member of the Domain Admins group of the domain being prepared. Thankfully, Exchange Server has a / PrepareAllDomains switch allowing this step to be run once and have it apply to all accessible domains. However, when running the /PrepareAllDomains step, the person running the process must be a member of the Enterprise Admins group of the forest being prepared. Due to the depth of changes made to the overall structure of Active Directory, the PrepareAD processes require Schema Admin and Enterprise Admin rights, and Pre‐ pareDomain requires Domain Admin rights. This usually prevents anyone but the 678 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
704
centralized administration group responsible for the overall Active Directory forest from preparing the forest and domain(s) for Exchange. For a more in-depth discussion of the Exchange deployment requirements, consider‐ ations, and specifics of what the preparation processes do, please see “Planning and Deployment”. See Also Chapters 7 and 11 for more on groups and the AD schema 20.5. Installing the First Exchange Server 2013 Server in an Organization Problem You want to install the first Exchange server for a new Exchange organization. Solution Using a graphical user interface 1. Log on to a server that is a member of an Exchange-prepared domain with an account that is a member of the delegated group in Recipe 20.4. 2. From the Exchange 2013 media, launch setup.exe. 3. Choose whether to check and download updates or continue without checking, and then click Next. 4. Click Next on the Introduction screen. 5. On the License Agreement screen, read through the agreement, and if you agree, click “I accept the terms in the license agreement” and click Next. 6. On the error reporting screen, select the desired error reporting setting and then click Next. 7. Select the Exchange Server roles for this installation by placing a checkmark next to the roles you wish to install, and then click Next. 8. If necessary, specify a different path for the Exchange Server installation. Or, accept the default and then click Next. 9. As the first Exchange server in a new organization, enter the new organization name. This value cannot be changed later. Place a checkmark in the Apply Active Directory split permissions security model to the Exchange organization if needed, and then click Next. 20.5. Installing the First Exchange Server 2013 Server in an Organization | 679
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
705
10. The next screen asks whether you would like to enable malware scanning. Malware scanning is enabled by default; if you would like to disable it, click Yes, and then click Next. 11. Setup works through a set of Readiness Checks. Click Install if there are no issues to correct. 12. Installation progress is shown in the GUI; when it is done, the Completion screen will be presented. Click Finish to close the window. Using a command-line interface You can also install Exchange Server from the command line. Setup.exe, found in the root of the Exchange Server installation media, has several switches to break down installation into its components. We already covered the preparatory switches in Recipe 20.4. The other command-line switches for setup.exe are shown in the following list. Note that setup.com, used with previous versions of Exchange, is now part of set up.exe. /Mode The mode for setup.exe identifies whether you are performing an install, uninstall, or recovery. The default mode is Install. /Roles These are the main roles that you can select for a custom installation in the GUI. The roles are Mailbox, Client Access, and Management Tools. /OrganizationName This value is required for the first Exchange server in a new organization. /IAcceptExchangeServerLicenseTerms This switch is required for all command-line operations, and is required each time a command is issued. /TargetDir This is the destination directory for binary installation. By default, this is found in %ProgramFiles%\Microsoft\Exchange Server\. /DomainController This switch allows you to specify the domain controller that setup.exe will use to read from and write to Active Directory. /AnswerFile Setup is directed to a text file with preset properties to apply during installation. 680 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
706
/DoNotStartTransport This switch prevents Exchange Server from automatically routing email when it first starts. This is usually used in case there is additional software to install or configure before Exchange is enabled. /CustomerFeedbackEnabled As we saw in the GUI, Microsoft is interested in making the product better by automating error reports submitted to the company. This is optional, and the default is set to True. /DisableAMFiltering This option disables the Exchange server anti-malware feature. /InstallWindowsComponents This option installs all required Windows Server roles and features. /OrganizationName This switch accepts input to specify the name of the Exchange organization. This switch has a 64-character limit, including letters, numbers, spaces, hyphens, and dashes. /UpdatesDir This switch specifies the directory in which Exchange Server updates are located and will be installed during installation. /ActiveDirectorySplitPermissions This switch allows you to enable Active Directory split permissions mode when preparing the Active Directory topology. /DbFilePath This switch allows you to specify the full directory path for the mailbox database if the Mailbox server role is installed. /LogFolderPathUse This switch allows you to specify the full directory path for the mailbox database logfiles if the Mailbox server role is installed. /MdbName This switch allows you to specify the Mailbox server role database name. /TenantOrganizationConfig This switch allows you to specify the file that contains the configuration for an Office 365 tenant. For example, to install the Mailbox and Client Access roles on a new server run: setup.exe /Mode:Install /Roles:Mailbox,ClientAccess↵ /IAcceptExchangeServerLicenseTerms /InstallWindowsComponents 20.5. Installing the First Exchange Server 2013 Server in an Organization | 681
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
707
Using PowerShell For small installations, PowerShell does not offer great benefits for running the setup. Setup.exe can be run from a classic command prompt or a PowerShell prompt. For larger organizations, especially with multiple simultaneous Exchange Server installations, PowerShell affords some opportunities to simplify the process, such as identifying Ex‐ change servers on the network based on specific hostname policies or confirming target directory availability. Discussion If this is the first Exchange server in a new organization, additional parameters are needed at installation. For example, the administrator must specify a name for the new Exchange organization. The Exchange installation has a few prerequisites before installing on Windows Server 2012, which are presented in the UI as follows: • Microsoft Unified Communications Managed API 4.0, Core Runtime 64-bit • Microsoft Office 2010 Filter Pack 64 bit, with SP 1 A Custom installation provides us with the opportunity to select individual roles or a combination. The Management Tools are listed as a separate option, but they are au‐ tomatically installed with any of the other roles. They are listed separately for installation on an administration client computer or on a server. Exchange performs readiness checks based on the roles selected. Should a readiness check fail, the offending situation must be resolved and, if you’re using the GUI, the setup must be restarted. See Also The deployment section of the Exchange Server technical library 20.6. Creating Unattended Installation Files for Exchange Server Problem You want to create an unattended installation file to minimize the administrative effort of installing several Exchange servers while also ensuring a consistent deployment across servers. 682 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
708
Solution Using a command-line interface Exchange 2013 can be installed in unattended mode simply using the command-line setup options. Some of the setup.exe switches can be listed within a text file that in turn is called by the /AnswerFile parameter. The setup.exe switches that can reside in an unattended installation answer file are TargetDir, SourceDir, UpdatesDir, DomainCon troller, MdbName, LogFolderPath, and more. See the full list of switches mentioned previously in the chapter. These switches are listed in a text file without the backslash and are saved as a text file such as UnattendParams.txt. Setup.exe references the answer file as follows: Setup.exe /Mode:Install /Roles:ClientAccess,Mailbox↵ /AnswerFile:C:\UnattendParams.txt Discussion Using unattended installation is a great way to install Exchange on many servers, deploy the Exchange tools to many admin workstations, update service packs for Exchange on many servers, or maintain consistency in installation configurations. To see a complete list of options, run the setup or update executable with the /? option. In Exchange 2010, the parameter is /AnswerFile and is formed using parameters avail‐ able with Setup.com. After you create an unattended installation answer file, you can use it to install additional Exchange servers. See Also Recipe 20.7 for more on installing the Exchange Management Tools; “Install Exchange 2013 Using Unattended Mode” 20.7. Installing Exchange Management Tools Problem You want to install Exchange Management Tools onto a client computer or onto a server that isn’t running Exchange. 20.7. Installing Exchange Management Tools | 683
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
709
Solution Using a graphical user interface 1. Follow the standard installation steps outlined in Recipe 20.5, except bypass the step that creates a new organization. 2. Select the defaults for the remainder of the installation and complete the wizard. Using a command-line interface Setup.exe provides a switch to select the roles to install. The ManagementTools or MT role is one of the options. After the prerequisites are applied, the Exchange Management Tools can be installed as follows: setup.exe /Mode:Install /Role:ManagementTools /IAcceptExchangeServerLicenseTerms Discussion Installing the Exchange Management Tools on a client computer or on a server that is not running Exchange Server is an alternative to using Remote Desktop administration of Exchange. The tools install the following components: • Exchange Administration Center • Exchange Management Shell • Exchange Help files Exchange Management Tools are supported on Windows 7 64-bit, Windows 8 64-bit, Windows Server 2012, and Windows Server 2008 R2. Windows 7 installations require the IIS 6 Management Console, as well as .NET Framework 4.5, Windows Management Framework 3.0, and Windows Identify Foundation. The Windows 7 prerequisites must be installed in that order. See Also Recipe 20.6 for more on unattended installation 20.8. Stopping and Starting Exchange Server Problem You want to stop or start Exchange Server. 684 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
710
Solution Using a graphical user interface 1. Launch the Services management console (services.msc). 2. Locate the services that begin with “Microsoft Exchange.” 3. Right-click the service and select the appropriate action. Using a command-line interface To start a service using the command line, issue the following command: net start "<ServiceName>" To stop a service using the command line, issue the following command: net stop "<ServiceName>" Using PowerShell Stopping and starting Exchange Server services is a little easier because almost every service has the term Exchange in its name. For a list of all of the services on the server with Exchange in their display name, issue the following command: Get-Service *Exchange* | FT Name, Status PowerShell will return the services in alphabetical order. The results can be further piped to the Sort-Objects cmdlet to control how the list is presented. To start an Exchange service using PowerShell, use the following command: Start-Service "<ServiceName>" To stop services that are running and have Exchange in the display name, use the fol‐ lowing command: Get-Service *Exchange* | Where {$_.Status -eq "Running"} | Stop-Service Discussion Several services are involved with Exchange Server, and stopping different services will accomplish different things. Typically, it is not necessary to stop services manually. The services are interdependent, so when you stop or start various services, you may see a message about having to stop dependent services. If you do stop dependent services, don’t forget to restart them again when you restart the service that you began with. 20.8. Stopping and Starting Exchange Server | 685
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
711
Different servers could be running a combination of different services based on the complexity of the environment and the specific function of the server. Not all Exchange servers will run all Exchange services. For the long list of Exchange Server services, see Table 20-1. Table 20-1. Exchange services Exchange service Description Microsoft Exchange POP3 (MSExchangePOP3) Supplies POP3 protocol message server functionality. This is available only on a Client Access Server. POP3Backend (MSExchangePOP3BE) Runs on Exchange servers with the Mailbox role installed and is required when POP3 is being used to access Exchange. Microsoft Exchange IMAP4 (MSExchangeIMAP4) Supplies IMAP4 protocol message server functionality. This is available only on a Client Access Server. IMAP 4 Backend (MSExchangeIMAP4BE) Runs on Exchange servers with the Mailbox role installed and is required when IMAP is being used to access Exchange. Microsoft Exchange Information Store (MSExchangeIS) Is used to access the Exchange mail and public folder stores. If this service is not running, users will not be able to use the Exchange server. Microsoft Exchange Active Directory Topology (MSExchangeADTopology) Queries Active Directory and returns configuration information and other data. Anti-spam Update service (MSExchangeAntiSpamUpdate) Automatically downloads anti-spam filter updates from Microsoft. Mailbox Assistants (MsExchangeMailboxAssistants) Manages the calendar, resource booking, Out-of-Office, and managed folder assistants. Monitoring (MSExchangeMonitoring) Allows diagnostics using an RPC server. Replication (MSExchangeRepl) Performs replication services for highly available environments. Transport (MSExchangeTransport) Manages SMTP. Transport Log Search (MSExchange￾TransportLogSearch) Powers the Message Tracking functionality in Exchange. Unified Messaging (MSExchangeUM) Manages the Unified Messaging engine for Outlook Voice Access. Mailbox Transport Delivery (MSExchangeDelivery) Relays messages from the Transport service to the respective mailbox by using a remote procedure call (RPC). Diagnostics (MSExchangeDiagnostics) Monitors the Exchange server health. Search (MSExchangeFastSearch) Handles indexing and search queries for the Exchange server. Frontend Transport (MSExchangeFrontEndTransport) Relays SMTP connecting to and from hub servers. Health Manager (MSExchangeHM) Manages the Exchange server health. Mailbox Replication (MSExchangeMailBoxReplication) Manages and processes mailbox move requests. RPC Client Access (MSExchangeRPC) Manages client RPC connections for Exchange Server. ServiceHost (MSExchangeServiceHost) Manages services for applications. 686 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
712
Exchange service Description Mailbox Transport Submission (MSExchangeSubmission) Runs on Mailbox servers and processes messages by converting from MAPI to MIME, and then relays them to the hub transport server. Throttling (MSExchangeThrottling) Limits the rate of user operations that could affect Exchange performance. Unified Messaging Call Router (MSExchangeUMCR) Enables the Unified Messaging Call Router features. Tracing Service for Search (SearchExchangeTracing) Enables trace logs for searching in Exchange Server. Extension for Windows Server Backup (wsbexchange) Allows Windows Server Backup to perform backup and recovery operations for Exchange Server. See Also “What’s New in Exchange 2013” 20.9. Mail-Enabling a User Problem You want to mail-enable an existing user. Solution Using a graphical user interface 1. Sign in to the Exchange Administration Center (EAC). To launch the EAC, open a web browser and navigate to https://<CASServerName>/ecp. 2. From the Recipients screen, click Contacts on the top menu. 3. Click the arrow on the plus sign (+) and then click “Mail user.” 4. Ensure that the existing user is selected. Click Browse and select the user account to create the mailbox for, and then click OK. 5. Enter a unique alias for the mailbox and an external email address, and then click Save. This entry now represents a mail-enabled user. This user does not have a mailbox. The external SMTP address we entered can be seen in the E-mail Addresses tab in the user properties looking from the EAC. The mail-enabled user can be found in the Recipi ents Configuration container in the Mail Contacts folder, and this entry represents the primary SMTP address in the multivalued attribute called proxyAddresses. 20.9. Mail-Enabling a User | 687
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
713
Using PowerShell This is one of those tasks that is simple on the surface but makes significant changes beneath. PowerShell and Exchange Server reduce mail-enabling an existing user to a simple one-line cmdlet: Enable-MailUser -Identity "<user_ID_parameter>" -Alias "<Alias_Name>"↵ -ExternalEmailAddress "<SMTP:proxy_SMTP_Address>" An example of the cmdlet might look like this: Enable-MailUser -Identity 'adatum.com/Users/Elias Mereb' -Alias 'Elias'↵ -ExternalEmailAddress 'SMTP: emereb@widetechconsulting.com' Discussion With Exchange Server, these controls are available in the Exchange Administration Center (EAC) and the Exchange Management Shell (EMS). The Enable-MailUser cmdlet mail-enables an existing user; however, the EAC can also be used to configure new users. Note that while a mail-enabled user is similar to a mail-enabled contact, the key difference is that a mail-enabled user can log on to Active Directory and access resources, whereas a mail-enabled contact cannot log on to Active Directory. 20.10. Mail-Disabling a User Problem You want to mail-disable a user. Solution Using a graphical user interface 1. Sign in to the EAC 2. From the Recipients screen, click Contacts from the top menu. 3. Select the user to mail-disable. 4. Click the arrow next to the trashcan icon and then click Disable. 5. Select Yes to confirm. The mail-disabled user then disappears from the Recipient Contact container view; however, it still resides as a regular user in AD, stripped of the Exchange properties. Using PowerShell The cmdlet to mail-disable a user is as follows: 688 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
714
Disable-MailUser -Identity "<user_ID_parameter>" An example of the cmdlet might look like this: Disable-MailUser -Identity "Elias Mereb" or: Disable-MailUser "emereb@widetechconsulting.com" The -Identity parameter can use the Distinguished Name, the User Principal Name, the Domain\Account name, the GUID, or other identifying information (see TechNet for a complete list). This cmdlet also only removes the Exchange properties for the user; it does not remove the user from AD. Because it is a significant change, there is a con‐ firmation step after entering the preceding code. The administrator will be prompted to complete the action, requiring a Yes, Yes to all, No, No to all, Suspend, or Help. This prompt can be suppressed or selected by assigning one of those values in the original cmdlet by using the -Confirm parameter. Discussion This recipe removes the Active Directory Exchange attributes for a previously mail￾enabled user. This is a simple process from EAC or PowerShell, but behind the scenes, several attributes are being updated. Mail-disabling a user requires Exchange View-Only Administrator or higher permis‐ sions, as well as Read and Write permissions to a number of object attributes. See the Microsoft Exchange Tech Center on the Microsoft website for a list of all necessary attributes. See Also Recipe 20.7; Recipe 20.9 for more on mail-enabling a user 20.11. Mailbox-Enabling a User Problem You want to create a mailbox for a user. This is also known as mailbox-enabling a user. Solution Using a graphical user interface 1. Sign in to the EAC by navigating to https://<CASServer>/ecp. 2. From the Mailboxes screen, click the plus sign (+). 20.11. Mailbox-Enabling a User | 689
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
715
3. Enter a unique alias for the mailbox. 4. Select whether this is a new user or whether to add a mailbox for an existing Active Directory user. 5. If enabling a mailbox for an existing user, click Browse and select the user. Click OK and then Save. 6. If creating a new user, click the “new user” radio button. 7. Complete the new user information form and then click Save. Using PowerShell In the EMS, we use the Enable-Mailbox cmdlet to apply the appropriate Exchange attributes to an existing user. A mailbox has to have an associated storage location, which is the message store where it will reside: Enable-Mailbox -Identity "<User_ID_Parameter>" -Alias "<Name>"↵ -Database "<DatabaseName>" An example of this cmdlet might read as follows: Enable-Mailbox -Identity "Alberto Contador" -Alias "Alberto" -Database "DB01" To mailbox-enable a group of users, this command can be piped from a Get-User filter parameter as well: Get-User -RecipientType User | Enable-Mailbox -Database "Mailbox Database" This command retrieves all users with the Recipient Type of User and mail-enables them. After Enable-Mailbox is successfully applied to an object, the Recipient Type will show as UserMailbox. If you have a set of users within an OU that need to be mailbox-enabled, it is just a matter of applying a different filter parameter to the Get-User cmdlet: Get-User -OrganizationalUnit "Sales" | Where-Object{$_.RecipientType -eq↵ "User"} | Enable-Mailbox -Database "DB01" Discussion A mailbox-enabled user is a user object that has a mailbox defined in the Exchange organization that the user object exists in. This is one of the most common objects in an Exchange organization. Mailbox-enabling a user requires Exchange View-Only Administrator or higher permissions, as well as Read and Write permissions to a num‐ ber of object attributes. See the Microsoft Exchange Tech Center on the Microsoft website for a list of all necessary attributes. 690 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
716
When you create a mailbox for a user, in the background, the specific changes occur on the user object in Active Directory and include changes to the following attributes: • mDBUseDefaults • msExchUserAccountControl • homeMTA • msExchHomeServerName • homeMDB • mailNickname • msExchMailboxGuid • msExchMailboxSecurityDescriptor • legacyExchangeDN • mail • msExchPoliciesIncluded • msExchRecipientDisplayType • msExchRecipientTypeDetails • msExchVersion • proxyAddresses • showInAddressBook You can view the attributes before and after the Enable-Mailbox cmdlet is run to see the different attributes of the object to which values have been added. Right-click on the user in the Active Directory Administrative Center and select properties and then scroll down to the Attribute Editor. Click on the Filter button and enable “Show only attributes that have values” to display the attributes in use for that user object. Doing this before and after engaging the Enable-Mailbox cmdlet will allow you to visualize the changes. See Also Recipe 20.7; Recipe 20.13 20.12. Deleting a User’s Mailbox Problem You want to delete a user’s mailbox. This is also known as mailbox-disabling a user. 20.12. Deleting a User’s Mailbox | 691
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
717
Solution Using a graphical user interface 1. Sign in to the EAC by navigating to https://<CASServer>/ecp. 2. From the Recipient screen, select the user to mailbox-disable. 3. Click the arrow next to the trashcan icon and click Disable. 4. Select Yes to confirm. This process disconnects the mailbox from the user object by removing the Exchange￾specific attributes. In the EAC drop-down, there is the option to Disable and also Delete. The latter will disconnect the mailbox and also delete the user from AD. Using PowerShell Disable-Mailbox -Identity <User_ID_Parameter> A basic example might be: Disable-Mailbox ray@adatum.com As with the some other cmdlets, the -Identity parameter is assumed and does not need to be typed out in the command as long as it is the first parameter after the cmdlet. The mailbox for ray@adatum.com will be disconnected from the user. To delete mailboxes from a set of users, just pipe the output of a Get-Mailbox filter to the Disable-Mailbox cmdlet, similar to the examples in Recipe 20.11. Discussion Although the recipe title is “Deleting a User’s Mailbox,” these solutions don’t really delete the mailbox. They actually just clear the Exchange attributes from the user object, and that disassociates the mailbox from the user; the mailbox itself will still exist in the Exchange store. The length of time it will exist depends on the mailbox retention period, which is 30 days by default. While the mailbox exists in that state, it can be reconnected to the same or a different user object. Deleting a user requires Exchange View-Only Administrator or higher permissions, as well as Read and Write permissions to a number of object attributes. See the Microsoft Exchange Tech Center on the Mi‐ crosoft website for a list of all necessary attributes. See Also Recipe 20.7; Recipe 20.10 692 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
718
20.13. Moving a Mailbox Problem You want to move a mailbox to a new database or server. Solution Using a graphical user interface 1. Sign in to the EAC by navigating to https://<CASServer>/ecp. 2. From the Recipients screen, select the mailbox that you want to configure. 3. From the right panel, scroll to the bottom, and under Move Mailbox, click “to another database.” 4. Name the migration job and then select whether to move the primary mailbox, archive mailbox, or both. 5. For the target database, click Browse and select the database that you want to move the mailbox to. Repeat the process for the archive database, if necessary, and then click Next. 6. If necessary, change the batch report recipient by clicking Browse and then selecting a user. 7. Choose whether to automatically or manually start the batch, and whether to au‐ tomatically complete the migration, and then click New. 8. To view the migration job, click Migration from the top menu. 9. Double-click the job name from the list to view the progress or results. Using PowerShell There is a simple PowerShell command to accomplish the same feat. The command to move a mailbox is as follows: New-MoveRequest "<Mailbox>" -TargetDatabase "<MailboxDB>" An example of such a move might be: New-MoveRequest "User5" -TargetDatabase "DB02" Again, the -Identity parameter is assumed, so typing the actual parameter is optional. There are many times where you will have to move groups of mailboxes to new storage or a new database. There are several ways of accomplishing this. The easiest is probably to pipe the output from a Get-Mailbox cmdlet with the appropriate filters to the New￾MoveRequest cmdlet. For example: 20.13. Moving a Mailbox | 693
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
719
Get-Mailbox | Where {$._<Property> -eq "<Value>"} |↵ New-MoveRequest -TargetDatabase "<Database>" You can also assemble the mailboxes in an array that PowerShell can loop through using a foreach command. This works well if the array is loaded at the beginning of the script. If not, the mailboxes are then moved in serial—the next mailbox isn’t moved until the previous one is completed. That is not the most efficient method. The array itself can be piped to the New-MoveRequest cmdlet to work through the items in a multithreaded fashion: $array = "UserA","UserB","UserC","UserD","UserE" $array | New-MoveRequest -TargetDatabase <Database> -Confirm:$false The source can also be a CSV file with a list of usernames and the intended destination store for their mailbox. These are the two required values for the New-MoveRequest cmdlet. If all the mailboxes are to be moved to the same destination database, then the target database is best specified as part of the cmdlet and not pulled from the CSV for each mailbox. The Import-CSV cmdlet calls the .csv file by name and pipes the output to the New-MoveRequest command. Assuming we have a .csv file with a column heading of Username and the users with mailboxes to be moved are listed in the column, then we can import those values and move their mailboxes as follows: Import-CSV <file_name>.csv | foreach {New-MoveRequest -Identity $_.Username↵ -TargetDatabase <Database> -Confirm:$false} Discussion Mailbox moves are commonly performed in many Exchange organizations due to servers getting upgraded, server hardware issues, users changing locations, or if the administrators want to readjust the mailbox location for load distribution. Moving a mailbox in Exchange requires Read and Write permissions to the following attributes: • msexchhomeservername • homemdb • homeMTA • msExchOmaAdminWirelessEnable • msExchOmaAdminExtendedSettings • targetAddress 694 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
720
A mailbox move is an odd operation in terms of permissions. Logically, moving a mailbox is basically a combination of create and delete op‐ erations, which is something a typical Exchange administrator has per‐ missions to do. See MS KB 842033 for details of the permissions needed. Using a graphical user interface The new Local Mailbox Move Wizard allows you to perform the move(s) immediately or at some point later (by manually starting the move[s] later). This is obviously a handy feature for mailbox moves because it isn’t something you tend to want to do in the middle of the day. This allows Exchange administrators who like to sleep at night to schedule the work to be done and then go home with everyone else. Using PowerShell After a move, you may notice that the source mailbox is in a disconnected state. This is helpful in the case of an unsuccessful move or a problem with the new destination mailbox. The disconnected mailbox can be removed by using the Remove￾StoreMailbox cmdlet, or it will automatically be removed based on the retention period. There are several ways to perform this task using PowerShell, depending on the number of mailboxes to move. Looping through an array, importing a CSV file, and applying a cmdlet filter and piping the result to the New-MoveRequest command are all good options. Like the other solutions, PowerShell does not have a mechanism to migrate the recov‐ erable items folder. This is a consideration for companies that require access to the recoverable items folder for compliance reasons. You may need to keep the last backup available prior to the mailbox move. See Also Recipe 20.7; Recipe 20.11 20.14. Viewing Mailbox Sizes and Message Counts Problem You want to view the sizes and message counts of all mailboxes on a server. Solution Using PowerShell Again, this is another scenario where the EMS simplifies Exchange management. An important reporting cmdlet for mailbox reporting is Get-MailboxStatistics. It 20.14. Viewing Mailbox Sizes and Message Counts | 695
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
721
quantifies mailbox size, item count, last logon time, and more. (See this recipe’s “Dis‐ cussion” for the list.) To get summary statistics for a specific server, run the following: Get-MailboxStatistics -Server <Server_name> This lists the mailboxes and their size and message counts on the server specified. Data is easily sorted in ascending or descending order by any value in the Get￾MailboxStatistics output. For example, to sort the list by mailbox size and easily identify the largest mailboxes, we can use: Get-MailboxStatistics -Server <Server_name> | Sort-Object StorageLimitStatus↵ -Descending | FT Administrators often need to act on this information and need it in a timely manner. It is easy to write this information to a file and attach it to a scheduled email using a PowerShell script. This script assigns parts of the email message to variables, collects the data with Get￾MailboxStatistics values, writes the report to a .txt file, and attaches it to an email to the administrator. It specifies only a Recipient Type of UserMailbox, which is a mailbox￾enabled user. This also requires that the sending SMTP server can relay for the host sending the request: $FromAddress = "reports@adatum.com" $ToAddress = "administrator@adatum.com" $MessageSubject = "Daily Mailbox Size Report" $MessageBody = "The Daily Mailbox Size Report is attached." $SendingServer = "EX01" Get-MailboxStatistics -Server "EX01"| Sort-Object StorageLimitStatus↵ -Descending | FT DisplayName, ItemCount | Out-File "C:\temp\mbxreport.txt" Send-MailMessage -To $ToAddress -From $FromAddress -Subject $MessageSubject↵ -SmtpServer $SendingServer -Body $MessageBody↵ -Attachments "C:\temp\mbxreport.txt" Save the script as a PowerShell file such as MbxReportSend.ps1 and schedule it to run every morning so that it is sitting in your inbox when you get to the office. Discussion Mailbox sizes and message counts are items on Exchange systems that administrators routinely want to know about for the purposes of reporting and metrics. Administrators want to know whether their mail system is balanced and whether users are spread across the mailbox stores evenly. Knowing the number of users and the size of their mailboxes in each mailbox store, the administrator can make better decisions about where new user mailboxes should be placed or if some leveling of mailboxes is required. 696 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
722
Using PowerShell The Get-MailboxStatistics cmdlet is a powerful reporting resource. It can be used as a standalone command to review a snapshot of mailbox properties, or it can be used as a filter for other queries. The output can be saved on a regular basis to compare values over time and identify trends of how users leverage their mailboxes. By running the cmdlet with the Format List option at the end, the full set of variables captured by Get-MailboxStatistics is displayed: Get-MailboxStatistics "user5" | FL RunspaceId : 2d75e969-834f-4eee-9897-73cdd0f4abb8 AssociatedItemCount : 12 DeletedItemCount : 0 DisconnectDate : DisconnectReason : DisplayName : User5 ItemCount : 3 LastLoggedOnUserAccount : LastLogoffTime : LastLogonTime : 12/26/2012 1:41:24 AM LegacyDN : /o=AdatumExchange/ou=Exchange Administrative↵ Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=60f0b069318↵ a4edca0b06bfe11b9170d-User5 MailboxGuid : 4ea903e2-fd9d-49ec-9ae8-b51dd0015a05 MailboxType : Private ObjectClass : Unknown StorageLimitStatus : TotalDeletedItemSize : 0 B (0 bytes) TotalItemSize : 829.94 MB (870,255,165 bytes) MailboxTableIdentifier : Database : MailboxDB2 ServerName : EX01 DatabaseName : MailboxDB2 MoveHistory : IsQuarantined : False PersistableTenantPartitionHint : 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-↵ 00 IsArchiveMailbox : False IsMoveDestination : False DatabaseIssueWarningQuota : 1.899 GB (2,039,480,320 bytes) DatabaseProhibitSendQuota : 2 GB (2,147,483,648 bytes) DatabaseProhibitSendReceiveQuota : 2.3 GB (2,469,396,480 bytes) Identity : 4ea903e2-fd9d-49ec-9ae8-b51dd0015a05 MapiIdentity : 4ea903e2-fd9d-49ec-9ae8-b51dd0015a05 OriginatingServer : ex01.adatum.com IsValid : True ObjectState : Unchanged 20.14. Viewing Mailbox Sizes and Message Counts | 697
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
723
Any of these output values can be used to filter another cmdlet or be saved to file or database for reporting over time. The LastLogonTime is valuable in identifying stale mailboxes that have not been archived and deleted. Be wary of the LastLogonTime if you have third-party software (such as archiving software) that logs on to mailboxes, as the date and time may not be accurate. See Also Get-MailboxStatistics cmdlet reference 20.15. Configuring Mailbox Limits Problem You want to enable storage limits for user mailboxes on an Exchange server. Solution Using a graphical user interface To configure storage quota settings on a database, follow these steps: 1. Sign in to the EAC by navigating to https://<CASServer>/ecp. 2. Navigate to Servers→Databases. 3. Double-click the database that needs to have quota limits changed. 4. Click on the Limits link. 5. Set the values for the storage quota. To configure storage quota settings on a mailbox, follow these steps: 1. Open the EAC by navigating to https://<CASServer>/ecp. 2. Double-click the mailbox that needs to have quota limits changed. 3. Click on the “Mailbox usage” link. 4. Click “More options,” and then select “Customize the settings for this mailbox.” 5. Set the storage quota values as required for the user. Using PowerShell To set the different quota levels on a database, use the following command: Set-MailboxDatabase "<Database>" -IssueWarningQuota "<Value>"↵ -ProhibitSendQuota "<Value>" -ProhibitSendReceiveQuota "<Value>" 698 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
724
An example of this command is as follows: Set-MailboxDatabase "DB01" -IssueWarningQuota "3GB" -ProhibitSendQuota "4GB"↵ -ProhibitSendReceiveQuota "5GB" To set the different quota levels on a mailbox, use the following command: Set-Mailbox "<MailboxAlias>" -UseDatabaseQuotaDefaults <$true|$False>↵ -IssueWarningQuota "<Value>" -ProhibitSendQuota "<Value>"↵ -ProhibitSendReceiveQuota "<Value>" Discussion It’s not uncommon for administrators to want to set reasonable size limits on individual users’ mailboxes. You can configure this globally at the mailbox store level. Since you can have multiple stores on a single server, this allows you to create multiple stores with multiple storage limits for departments or groups that have greater storage needs. You can also override the mailbox store defaults for individual user accounts by program‐ matically modifying the same three attributes and then setting the mdBUseDefaults attribute to FALSE. In Exchange Server, this is an EMS parameter on the Set-Mailbox cmdlet called -UseDatabaseQuotaDefaults. The following explains each quota setting and its default values: “Issue warning at” Warns users that they have exceeded the storage limit, but their mailbox will con‐ tinue to function. The default value is 1.9 GB. “Prohibit send at” Warns users that they have exceeded the storage limit and then prevents them from sending new messages until their mailboxes are brought back underneath the con‐ figured storage limit. Users can still receive messages. The default value is 2 GB. “Prohibit send and receive at” Warns users that they have exceeded the storage limit and then prevents them from both sending and receiving messages until they have corrected the situation. The default value is 2.3 GB. You can set the quota values using PowerShell to KB, MB, GB, or even TB. The quota levels are relative to each other. The IssueWarningQuota value should not be greater than the ProhibitSendQuota value, which in turn should not be greater than the Pro hibitSendReceiveQuota value. See Also Set-Mailbox cmdlet reference 20.15. Configuring Mailbox Limits | 699
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
725
20.16. Creating an Address List Problem You want to create an address list. Solution Using a graphical user interface 1. Sign in to the EAC by navigating to https://<CASServer>/ecp. 2. Navigate to Organization→Address lists. 3. Click the plus sign (+) to create a new address list. 4. Enter a name for the new list. 5. Select the container for the address list. 6. If necessary, identify the recipient types to include in this address list. 7. To further define the recipient list, click “add a rule” and then select the attribute from the drop-down list. 8. Click Save to create the new address list. Using PowerShell There is a simple cmdlet for creating address lists in Exchange Server, as follows: New-AddressList -Name "<AddressList_Name>" -Container↵ "<AddressListIDParameter>"-IncludedRecipients Here is an example of this cmdlet creating a new address list container named Regions: New-AddressList -Name "Regions" -Container "\" -IncludedRecipients "None" In addition, there is an Update-AddressList to generate members independent of list creation or to apply any changes in list membership: Update-AddressList -Identity "<AddressListIDParameter>" A custom address list placed in the new Regions container based on a state, in this case Nevada, might read as follows: New-AddressList -Name "Nevada" -IncludedRecipients "MailboxUsers, MailContacts,↵ MailGroups, MailUsers" -ConditionalStateOrProvince "NV"↵ -Container "\Regions" After the list is created, it needs to be applied. This is done with a separate command as follows: 700 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
726
Update-AddressList -Identity "\Regions\Nevada" Discussion Address lists are special groupings of email accounts that allow users to quickly find specific email users that are part of some logical grouping in the GAL. In essence, they are a subset of the GAL. Exchange Server provides some precanned address lists and allows for more complete Opath filter creation with the Recipient Filter option. Address lists should employ friendly and descriptive names, as they are options for users to query in finding other users through Outlook. In addition, address lists should be added after consideration. Too many address lists can confuse users as to which one they should be using. Using a graphical user interface Using the GUI for this process is straightforward and is the most likely way you’ll want to create address lists unless you need to create a lot of them on the fly or you are importing them from a test lab. Using PowerShell There is a set of cmdlets to manage address lists in Exchange Server. First the New￾AddressList cmdlet is used to create the list. Subsequently, Update-AddressList is used to populate the address list or specifically apply the filters and build the list, and even schedule when it should be updated. For larger enterprises with tens of thousands or hundreds of thousands of Active Directory recipients, address list generation is not trivial. See Also “Email Addresses and Address Books” 20.17. Creating a Database Availability Group Problem You want to create a new Database Availability Group (DAG) for automatic database￾level recovery. Solution Using a graphical user interface 1. Sign in to the EAC by navigating to https://<CASServer>/ecp. 20.17. Creating a Database Availability Group | 701
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
727
2. Navigate to Servers→Database Availability Groups. 3. Click the plus sign (+) to open the new DAG window. 4. Enter a name for the DAG. 5. If you would like a specific server to be the witness server, specify it in the Witness Server field; otherwise, leave it blank. 6. If you need to designate a specific directory for the witness server, specify it in the Witness Directory field; otherwise, leave it blank. 7. Enter one or more IP addresses to be used for the DAG. Leave this field blank to use DHCP. 8. Click Save to create the DAG. Using PowerShell New-DatabaseAvailabilityGroup -Name "<DAGName>" -WitnessServer "<ServerName>" An example of this command might be as follows: New-DatabaseAvailabilityGroup -Name "DAG01" -WitnessServer "EX01" Discussion Database Availability Groups (DAGs) are used to automatically recover at the database level, regardless of whether the failure is database-, server-, or network-related. In ad‐ dition, DAGs are useful for supporting server maintenance because they allow admin‐ istrators to perform maintenance without causing downtime for users. Mailbox servers are added to a DAG to provide automatic recovery. A common deployment for a DAG provides high availability at the primary data center and disaster recovery capability at a remote site (often a DR site). You can add up to 16 Exchange mailbox servers to a DAG. If you plan to create a DAG in an environment where there are still Windows Server 2008 R2 domain controllers, you must pre-stage the object in Active Directory. For more information, see the TechNet article “Pre-Stage the Cluster Network Object for a Database Availability Group”. The witness server parameter for both the GUI and the PowerShell solutions is optional. By default, the witness server is applied only on an Exchange server with the Client Access Server role installed, but not the Mailbox Server role. This can be overridden by specifying the witness server manually. See Also “High Availability and Site Resilience” 702 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
728
20.18. Creating a Mailbox Database Problem You want to create a mailbox database. Solution Using a graphical user interface 1. Sign in to the EAC by navigating to https://<CASServer>/ecp. 2. Navigate to Servers→Databases. 3. Click the plus sign (+) to add a new database. 4. Assign the mailbox database a relevant name. 5. Click Browse and select the server to create the database on. 6. The default database file path is generated. Choose whether to mount the new database. 7. Click Save to create the database. Using PowerShell Here is the command for creating a new mailbox database: New-MailboxDatabase -Name <Name_ID_Parameter> -Server <ServerName> An example of this command is as follows: New-MailboxDatabase -Name "DB07" -Server "EX01" A final step for the PowerShell-generated database is to mount it if needed: Mount-Database "DB07" Discussion Mailbox databases are where mailboxes are located. There are quite a few configuration settings for mailbox databases that are beyond the scope of this chapter, but going through the EAC when manually creating a mailbox store should give you an idea of what can be configured. In Exchange Server, depending on the version (Standard or Enterprise) of Exchange, you can have up to five mailbox databases mounted. EAC and EMS enforce these limits, but it is possible to directly modify Active Directory to exceed these limits. If you create more databases or storage groups than are allowed, the additional databases will not 20.18. Creating a Mailbox Database | 703
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
729
mount. Exchange Server allows for up to 50 databases with the Enterprise edition (this was reduced from a maximum of 100 databases in Exchange 2010). Mailbox databases are represented in Active Directory by the msExchPrivateMDB class. This class is not as simple as some of the other classes used by Exchange. In addition, several of the attributes hold binary data, so working with these Active Directory objects directly can be difficult. One of the more notable attributes of the mailbox store objects is a backlink attribute called homeMDBBL. This is a multivalued attribute linking back to all of the user objects that have mailboxes in this mailbox store. See Also “Manage Mailbox Databases in Exchange 2013” 20.19. Enabling or Disabling Anti-Malware Scanning Problem You want to enable Exchange Server anti-malware scanning. Solution Using PowerShell Within the scripts folder on any Exchange server, there is a precanned PowerShell script to enable anti-malware scanning. This is found in the scripts folder located by default at C:\Program Files\Microsoft\Exchange Server\V15\scripts\. You can enable anti￾malware scanning by running the script as follows: & $env:ExchangeInstallPath\Scripts\Enable-Antimalwarescanning.ps1 Changing the anti-malware scanning settings requires the transport service to be restarted before the settings will take place. Running the built-in PowerShell scripts will automatically restart this service without prompting. Discussion To confirm the installation, run the Get-MalwareFilteringServer cmdlet, which will also show the anti-malware settings. To disable anti-malware filtering, run the following command: & $env:ExchangeInstallPath\Scripts\Disable-Antimalwarescanning.ps1 704 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
730
See Also “Disable or Bypass Anti-Malware Scanning” 20.20. Enabling Message Tracking Problem You want to enable message tracking on Exchange Server. Solution Using a graphical user interface Message tracking in Exchange can be set on servers running with the Mailbox role installed. To enable message tracking on an Exchange server, follow these steps: 1. Sign in to the EAC by navigating to https://<CASServer>/ecp. 2. Navigate to Servers→Servers. 3. Double-click the server that you want to configure and then click the “Transport logs” link. 4. Select or deselect the checkbox next to “Message Tracking logging” to enable or disable the feature. 5. Accept the default message tracking log path or specify an alternate path. 6. Click Save to close the window and save the settings. Using PowerShell To enable the message tracking log for an Exchange server, use the following syntax: Set-MailboxServer <Server_Name> -MessageTrackingLogEnabled $True There are a few other parameters that are easily configured with the cmdlet. These include: MessageTrackingLogPath This parameter is used to set a nondefault local path for the message tracking logs. The default location is C:\Program Files\Microsoft\Exchange Server\TransportRoles \Logs\MessageTracking\. MessageTrackingLogSubjectEnabled By default, message subjects are logged in message tracking; however, a privacy or compliance policy may require subjects be omitted from logging content. 20.20. Enabling Message Tracking | 705
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
731
MessageTrackingLogMaxDirectorySize Controlling the directory size where message tracking logs are stored can prevent unexpected drive space usage. MessageTrackingLogMaxFileSize The default file size for message tracking logs is 10 MB. To control the frequency of new logfiles and the total number of files, it may be beneficial to increase or decrease the individual file size. MessageTrackingLogMaxAge For policy, compliance, or storage reasons, it may benefit a company to have logs expire. A full example of this configuration is: Set-MailboxServer EX01 -MessageTrackingLogEnabled:$True -MessageTrackingLogPath↵ "e:\Logs\" -MessageTrackingLogMaxDirectorySize 1GB Discussion Message tracking logs are an invaluable aid when troubleshooting message delivery in any Exchange environment. A message can be tracked from submission to the Infor‐ mation Store all the way through to its departure out of the Exchange environment. As long as the administrator doing the tracking has the rights to and can resolve the Net‐ BIOS name of each server along the message path, the administrator will be able to see how a particular message traveled through the network and how long it took to go through each server. Message tracking is enabled by default on all Exchange servers running the Mailbox role. The EMS allows for full configuration of message tracking. When changing the location of the message tracking logs, the existing logs are not automatically transferred to the new location. See Also “Message Tracking Role” 706 | Chapter 20: Microsoft Exchange Server 2013
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
732
CHAPTER 21 Microsoft Forefront Identity Manager 21.0. Introduction Microsoft Forefront Identity Manager (FIM) is the successor to Microsoft Identity Life‐ cycle Manager (ILM). The core focus areas of FIM are managing policy, managing credentials, managing and provisioning users and groups, access control, and compli‐ ance. The product includes a Credential Management (CM) feature for use in environ‐ ments that have a Public Key Infrastructure (PKI) and need to provide self-service and policy-based certificate management. While FIM is typically thought of as a solution for smart-card enrollment and life-cycle management, it excels at providing policy management for any certificate type. In light of the new product name, the community has struggled to differentiate between what was the synchronization engine and the product itself, not wishing to drag CM into what has typically been an MIIS/ILM/FIM conversation. In cases where differentiation is important, the two server products are usually referred to as the “sync engine” and Certificate Lifecycle Manager (CLM); how‐ ever, for the purposes of simplification in this chapter, we will use the term ILM to refer to the sync engine. FIM is a robust .NET application platform built on Microsoft’s highly successful data‐ base platform—SQL Server. FIM provides services for the synchronization and recon‐ ciliation of identity data, and in some cases passwords, between multiple disparate re‐ positories, including (but not limited to): • Enterprise directories — Active Directory/Active Directory Application Mode — Novell eDirectory — Sun Directory Server — IBM Tivoli Directory Server 707
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
733
• Databases — Microsoft SQL — Oracle — IBM DB2 • Email — Microsoft Exchange Server — Lotus Notes • Flat text files — DSML — LDIF — Attribute Value Pair — CSV — Delimited — Fixed width FIM is considered to be in a class of products known as metadirectory synchroniza‐ tion tools. This is in contrast to other products like virtual directories that have no central reconciliation or synchronization mechanism. For an up-to-date list of supported FIM management agents, visit TechNet. While the depth of connector coverage for identity management products is often a popular topic, it is typically irrelevant for two reasons: • FIM is a SQL Server application, and with SQL Server comes connectivity via ODBC, Linked Servers, and Integration Services, all of which provide access to databases and systems that do not have native management agent support. • FIM has what is known as the Extensible MA for Connectivity (XMA or ECMA), which is a framework for writing your own MA to proprietary applications and platforms; the XMA allows you to write the connectivity components and hand them back to FIM using its standard interface. Given the options for aggregating data sources through SQL Server or creating an XMA to consume a custom interface or web service, FIM provides an extremely flexible plat‐ form on top of which to develop an identity management solution. While the term MA is fairly common in the Microsoft community, the generic term connector is also commonly used across multiple identity management products. 708 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
734
Requirements for FIM 2010 R2 Each FIM component has a specific set of prerequisite software, with the high-level pieces listed here: Windows Server 2008 Standard or Enterprise Edition (x64) or Windows Server 2008 R2 Standard or Enterprise All of the FIM components rely on Windows Server 2008 at a minimum. SQL Server 2008 (x64) Standard or Enterprise Edition with SP1 or later Either version or edition is sufficient; however, x64 editions are supported only if the SQL server and the FIM server are loaded onto separate servers. Windows SharePoint Services 3.0 Service Pack 2 (SP2) or Microsoft SharePoint Foun‐ dation 2010 SharePoint is used for the FIM Portal, FIM Password Registration portal, and FIM Password Reset portal. While not strictly required, most deployments make use of Visual Studio 2008 or later to build and compile rules extensions. SQL and FIM collocation In previous versions of FIM (e.g., ILM/MIIS), there was sometimes a performance ben‐ efit when collocating with SQL. However, with FIM 2010 R2, it is recommended that you separate SQL onto a dedicated server (or cluster) and avoid collocating FIM com‐ ponents with SQL. While FIM itself does not officially support failover clustering of the application, some users have noted that it works using a Cluster Generic Script resource. For most deployments, deploying a supported topology is the best course of action. FIM does support Network Load Balancing (NLB), which can distribute the processing load of the FIM Service. FIM Primer The really attractive thing about FIM is that it is a streamlined .NET engine for syn‐ chronizing and reconciling identity information. That, in effect, is all it does, and it does it really well. What makes the product so versatile is that at pretty much any point in a data flow you can “go to code” via an extension, resolve the issue in your preferred .NET language, and return the manipulated data back to your data flow. All the product does is take information from one source, and transform it or flow it to another source. We’re hoping the power of the tool will begin to make itself more apparent as you read on. 21.0. Introduction | 709
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
735
The synchronization engine is an application that relies completely on SQL Server, and all data, code, rule sets, attribute flows, and consolidated data sets are stored within SQL tables (see Figure 21-1). Figure 21-1. FIM architecture Since FIM is a complex application and not something most AD administrators have experience with, we are going to discuss the basic features and terminology in more depth. Importing data There are several terms that you will hear attributed to a data source within FIM: data source, directory, and connected directory (CD). “CD” can refer to a database, a flat file, or a full-fledged directory such as Active Directory. There are two ways we can get data into the product for processing: full imports and delta imports. Since AD exposes delta changes natively via DirSync, you are spoiled into thinking you can do delta imports with any CD, but that is not the case. When data is brought in for processing, it’s stored in a special location called the Connector Space (CS). Full imports (stage only) Also called “staging,” full imports read the entire CD every time. Full imports can be scoped or limited to specific containers or organizational units, and the entire MA can be scoped to process only specific object types. 710 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
736
Delta imports (stage only) If the CD is capable of differentiating changes like AD is, you can ask the CD for objects that have changed since your last full import. The caveat here is that you always have to start with at least one error-free full import in order to get a delta import. You get data into FIM by “staging” the data into a special area called the Connector Space (CS) through a full import. Subsequent imports may be able to utilize delta imports if the CD supports it. In Figure 21-2, the (A) actions depict the import process from CD to CS. While this could be a full or a delta import, the very first import should always be a full import. Figure 21-2. Importing data The connector space Technically speaking, the connector space is just a table in SQL, but the important concepts to understand here are that the CS is where objects go once they’ve been staged (through either a full or delta import) and that the CS effectively becomes a localized copy of the CD you’re connecting to. From that point on, all of the processing happens against the objects in the CS—not directly against the CD; this is an important distinc‐ tion between a metadirectory product, like FIM, and a Virtual Directory. This is a good 21.0. Introduction | 711
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
737
thing because you can grab a copy of the data and then build and validate your rules against it without risking data corruption, access rights, or network traffic. Getting objects staged into the CS takes minutes to set up and is limited only by your rights to read the directory and the time it takes to iterate through the directory and create the entries in SQL. Now, this is very important: before you can read from an Active Directory connected directory, the account you will use to connect must have at least the Replicating Direc‐ tory Changes right. For information on how to set that up, refer to the KB article. Beyond this detail, any authenticated user can read public attributes; however, sooner or later you may run into areas of the directory that require greater access rights. Once objects have been staged into the connector space, they can synchronize with another section of the engine called the metaverse. The metaverse The metaverse (MV) holds the consolidated representation of identities from each con‐ nector space. For instance, if you have an account in AD LDS and an account in an AD domain, and both have been staged into their respective connector spaces, you can choose to represent those objects either independently through a process called projec‐ tion, or as a single object through a process called a join. As a general practice, the MV holds a single object representing the consolidated identity information mined from objects in the individual data sources; think of it as a many (CS) to one (MV) relation‐ ship. Most importantly, the way data is synchronized from one CS to another CS is through the MV. Without an MV object, you cannot flow information between one CS and another. So what’s this we were saying about projection and joins? Projection and joins One of the immutable laws of FIM is that every MV object has to start out its life cycle as a projection from one CS object. Incidentally, the converse is also true: once all of your CS objects are disconnected from an MV object, that MV object will cease to exist. A projection rule simply states, “Create an MV object of a specific type for this specific CS object.” Once you’ve projected a set of CS objects into the MV, you can set up some rules for objects in another CS to join the MV object. There are tons of ways you can specify this, but once you have two CS joined via a common MV object, you can then synchronize data between the respective CS and MV objects, creating a “bridge” of sorts. 712 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
738
After using a full or delta import to stage data into the CS, we can then project those objects into the MV using a projection rule. Objects in a separate CS can be connected through an MV object through the join process, which allows for the synchronization of data between connec‐ ted objects. Now, projecting an object into the MV doesn’t mean that any of its data goes with it. On the contrary, we have to create attribute flow rules to tell the engine exactly which CS attribute goes to which MV attribute. Before we can discuss how synchronization works, we need to talk briefly about connectors, what states they can be in, and how we can filter them. In Figure 21-3, action (1) depicts the projection of a CS object into the metaverse, which results in the creation of the MV object, while action (2) depicts inbound attribute flow. Figure 21-3. Projection In Figure 21-4, actions (3) and (5) depict joins occurring between CS objects in the file and AD, respectively, while actions (4) and (6) depict inbound and outbound attribute flow. 21.0. Introduction | 713
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
739
Figure 21-4. Joins The many faces of the connector Whenever you project a CS object into the MV, a connector is created. Of particular importance is the type of that connector—in this case it is considered a normal connec‐ tor. You can also create connectors of type explicit, and you can remove a connector by disconnecting it. When an object is first staged into the CS, it is a normal disconnector. If that object is joined or projected, it becomes a normal connector. Suffice it to say that normal disconnectors can become connectors again, whereby if it is explicit then it must be manually made a connector or disconnector. If you disconnect an existing connector, you can place that disconnector as one of two types: a normal disconnector or an explicit disconnector. A connector is really just a special relationship between CS and MV objects that absolves the need to reevaluate the relationship every time a sync is run, which makes the connector a static entity within the engine. This is an important concept to understand, as join rules for a particular CS object are evaluated only under two conditions: the CS object is not currently connected, and the CS object is not assigned as an explicit disconnector. Once a join is made the rule is never executed again for that CS object. The bottom line here is never to create anything that is explicit, and your life will be much easier—explicit disconnectors are designed to provide a temporary state until infor‐ mation can be “breadcrumbed” back into the originating system, and are not intended to be a permanent solution (although for many people, they are nonetheless a permanent problem). 714 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
740
State-based synchronization There are two basic types of Identity Management (IdM) products on the market today: state-based and event-based. FIM is a state-based product, which simply means that things happen when an object or attribute changes state. Where event-based systems are concerned, an event is generated based upon some predefined threshold or application trigger that tells the IdM system to do something. Without devolving into a religious discussion regarding which is better, the first truth you need to understand is that all systems on the market today have aspects of both systems. While one system may claim to be one or the other, all products include both state- and event-based aspects. The important thing to note is how you approach a problem with one system versus another. The only thing you need to understand is that as a synchronization engine, the product will process each object in turn (serially) and resolve the state of that object (and all of its attributes) completely each and every time that object is touched. This is probably the most difficult concept to understand with the product, and it generally confounds people trying to understand why full or delta synchronizations cause extensions in other management agents to fire. (Don’t worry, we’re not there yet.) The problem facing any IdM product vendor is that if you change the set of rules for synchronization of data, then how do you reapply those new rules to objects that have not been triggered by an event or state change? We’ll come back to this, but suffice it to say that this product enforces the current set of rules against all objects when a full synchronization is run; so full synchronization reconciles every connector. Running a delta synchronization applies the current rule set to objects that have changed, or are currently disconnected, since the last full or delta import (i.e., the state changed). Full synchronization Forces all rules and attribute flows to process every object in the CS. This ultimately will flow data from the CS to the MV and out to any other CS that is joined to the MV object in question. Delta synchronization Forces all rules and attribute flows to process only the objects in the CS that have changed since the last synchronization. This will flow data from the CS to the MV only for changed objects. It is important to recognize that the process of reconciliation is critical for issues of compliance. Products that do not ensure full reconciliation for all objects are not telling you the whole story. 21.0. Introduction | 715
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
741
We use full or delta imports to stage data into the CS, but we also do full or delta syncs to copy data between the CS and the MV. The im‐ portant thing to note is that while imports are always one-way (import, not export), synchronizations are always two-way (import and export). There is simply no way around this—if you have export attribute flow rules set up, they must be processed to complete the state evaluation of every object, even if you only intend for this to happen in one place. If that CS object is tied to a CS object through an MV object (through a join), then a sync run on one CS will process changes all the way to the other CS object. Figure 21-5 depicts normal synchronization convergence. Running a full or delta sync will cause synchronization to occur across all three connectors; however, inbound at‐ tribute flow only occurs on the management agent that the synchronization was triggered from (depicted as the DB-connected directory). Figure 21-5. Synchronization Now that we’ve talked about how to get data into the CS and sync it with an MV object, we need to talk more about management agents. We will touch on attribute flow in a moment. 716 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
742
Management Agents The management agent (MA) is a set of processes comprising the native APIs of the product we are connecting to combined with a nice little GUI to configure it. All the stuff we talked about—imports and syncs, joins and projections, and connector filters —is part of the management agent itself. In fact, it is not an agent at all—at least not in the sense that you have to install anything on the CD. This is a fundamental difference between state-based and event-based products: event-based systems require some sort of agent or driver that must reside on the system or application in question, whereas state-based systems require nothing but a local instance of the APIs in question. To get the APIs needed for connectivity to Lotus Notes, the Lotus Notes client needs to be installed on the FIM server. The same can be said for Oracle connectivity requiring the Oracle client, SQL connectivity re‐ quiring the SQL client, and so on. The MA is responsible for determining how you connect to the CD, which object types you want to see (e.g., user, group, or computer), and which attributes you care to have copied to the CS. Only selected attributes can flow into the MV through attribute flow. Sometimes the terms MA and CS are used interchangeably, but while they represent the entirety of the CS relative to the CD, they are much more. The MA is where you store the credentials for connecting to the CD, as well as all of the connectivity, scopes, filters, join and projection rules, attribute flows, deprovision rules, extension configuration, and password sync setup. Suffice it to say that you will have one MA for every CD you want to talk to, which will be represented by its own CS. MAs also provide a way to store and represent sets of potentially schedulable operation profiles, called run profiles. Run profiles You tell FIM that you want to perform a full import or a delta sync by creating a series of run profiles that contain at least one of the following prebuilt operations: • Full import (stage only) • Delta import (stage only) • Full synchronization • Delta synchronization • Full import and delta synchronization • Delta import and delta synchronization 21.0. Introduction | 717
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
743
• Export The export operation is solely for exporting pending changes in the CS out to the CD. This is critical for actually sending the changes back to the directory. You should feel reassured to know that the product cannot automatically affect the CD simply by ma‐ nipulating objects in the MV or the CS. You must do an export to send changes out. Consequently, if the credentials you supplied to the MA do not have rights to modify the requested attributes or create a newly provisioned user, for example, the exports will fail. The credentials in the MA must have all of the appropriate rights to affect the pending changes. You can also string combinations of operations together in one profile. For instance, you might want to start with a delta import and delta synchronization and follow that immediately with an export, followed by a delta import. That would get data in, process it, and send it back out with the changes, all in one run. At this point, don’t worry too much about the “special” run profiles; you’ll touch on them more if you begin working with the full product. But suffice it to say that they pretty much do what you’d think, with one exception. The “delta import delta synchro‐ nization” profile will only synchronize changes that were imported as part of the current delta import. This is not the same as performing the same two operations in separate steps. Now, before we talk about attribute flow we need to talk briefly about the Metaverse Designer. The Metaverse Designer Suppose you have an attribute in your AD called extensionAttribute3, but it really represents your cost center. What you’d really like to do is just call it “Cost Center” in the MV so that it actually makes sense when you decide to flow this to some other CS. With the Metaverse Designer you can create custom object types and attributes as needed and you don’t have to have OID numbers like you do in AD. You can create a costCenter of type String (indexable), make it multivalue or not, index it if you want to, and assign it to the person object class. You can then flow data into that from any CS as long as it is of type String. The Metaverse Designer is what you use when you want to add custom attributes to objects in the metaverse. Attribute flow rules Simply stated, an attribute flow rule is a mapping between a CS attribute (such as extensionAttribute3) and an MV attribute (such as costCenter). An attribute flow can be either import or export, and either direction can be one of the following mapping types: 718 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
744
Direct Flowing data from a CS attribute to an MV attribute of the same type (e.g., String/ String). The attribute names can be completely different, but you just want to flow the data over unaltered—for example, flow EIN into employeeID. Advanced There are three types of advanced flows: Extension Flows data from one or more CS attributes to a single MV attribute, whereby the data needs to be transformed or concatenated in some way. The attributes can even be of different types, as long as you perform the type conversion within the code. The term extension implies that we have to write code to accomplish this mapping. For example, take a user’s last name and add the first character of the first name to form the logon ID. Constant Flows a constant or arbitrary String to a single MV object of type string. Since it’s a constant, the data is not originating from any CS attribute. No code is required; however, if you want to “blank” out an attribute (flow a null), you have to do this with an extension—as of SP1, this was not an option available in the GUI. For example, everyone’s company attribute is “My Company.” Distinguished name Flows a component of a DN into an MV object of type string. You can pick apart a large DN by choosing which section of the string to flow across. No code is required, unless you want to transform the component itself, and then you’re back to the extension. For example, you know that the second compo‐ nent of the DN is always the department name, so flow that information un‐ altered into the department attribute. This is available only for importing attribute flows into the metaverse; it cannot be used to export components of a DN to another CS. To do that, you need to flow the component into an MV attribute and then set up a direct export attribute flow to the CS. With any rules extension, you have the opportunity to resolve the situation in any .NET language. The good news is that if you are a VB.NET or C# programmer, FIM will create the entire project template for you. You will find the greatest number of examples online in VB.NET, and that is the language we will use in this chapter. 21.0. Introduction | 719
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
745
MAs are used to connect natively to a CD; they define the objects in which you are interested, whether those objects should be filtered, how they are joined or projected, and what attribute flow rules exist between the CS and MV. You can create custom attributes to flow information into the MV through the Metaverse Designer, and run profiles are used to bundle together various methods to pull data into the CS and syn‐ chronize it with the MV. FIM also supports password management via a web-based application and password synchronization from AD to other systems. Many additional scenarios are covered in the Microsoft Identity and Access Management Series (refer to “See Also” on page 721). The scenario Figure 21-6 outlines the example scenario of synchronizing AD from an HR database, which is used throughout this chapter. The numbered points will be referenced in later recipes. Figure 21-6. Example scenario We’ll start with an employee database that runs on SQL Server, referred to from now on as the HR Database. 720 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
746
Let’s walk through how FIM will synchronize the HR Database with Active Directory and define some of the specialized terms Microsoft uses to describe the process. The numbers in parentheses refer to the numbered points in the diagram. First, we will import or stage (1) records from the HR Database into the HR Database MA connector space. The import process creates connector space objects (2). Next, we will synchronize the data in the HR Database MA connector space. The first time we do this, and any time FIM discovers a new user record in the MA connector space, FIM will project (3) a new object (4) into the metaverse, and join, or link, the HR Database MA object to the metaverse object. FIM will then flow attribute data from the HR Database MA connector space object to the joined metaverse object through the MA’s rules (5). Synchronizing the HR Database MA will also provision (6) a new connector space object (7) in the Active Directory MA’s connector space and join the new Active Directory connector space object to the metaverse object (4). FIM will then flow the appropriate attribute information from the metaverse object (4) into the AD connector space object (7) through the Active Directory MA’s rules (8). We will export (9) objects (7) from the AD connector space into Active Directory itself to create Active Directory user objects (10). We will also import (11) the telephoneNumber attribute from AD user objects (10) into the related AD connector space objects (7) and synchronize the AD management agent. This will flow attribute data through the ADMA rules (8) and into the joined metaverse object (4); from there, attribute data will flow through the HR Database MA’s rules (5) to the joined HR Database MA connector space object (2). At this stage, the updated HR Database MA connector space object (2) will be exported (12) to the HR Database, resulting in the [telephoneNumber] column being updated. We also will test deprovisioning by deleting a row in the HR Database and then im‐ porting (1) objects from the HR Database into the HR Database connector space. This will result in the related connector space object (2) being marked as deleted. Synchro‐ nizing the HR Database MA will cause the joined metaverse object (4) to be deleted. This will, in turn, cause the joined AD connector space object (7) to be deleted. Finally, the delete operation is exported to Active Directory, resulting in the deletion of an Active Directory user object (10). See Also Microsoft provides a great deal of useful documentation for MIIS on its website. This section lists some of the most useful documents: 21.0. Introduction | 721
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
747
The FIM help file FIM comes with a very useful and complete help file. You can find it in the FIM Synchronization Service installation folder, typically at C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\UIShell\Helpfiles. The file is named mms.chm, and it contains general help for configuring and running FIM. The FIM home page The FIM home page is the starting point for all the current information about FIM, including recent releases and other news. Microsoft TechNet: FIM product page The first stop for technical and training information for FIM can be found at the product page. Microsoft TechNet: Forums - Forefront Identity Manager 2010 Here you can find the link to the FIM forum, which is frequented by the product team as well as many of the FIM MVPs. FIM 2010 Technical Overview This document provides an overview of FIM and describes core scenarios of the product features. Visit the FIM 2010 Technical Overview. FIM Installation Guide The guide contains a series of articles covering the requirements and installation of FIM. FIM 2010 R2 Documentation Roadmap The Documentation Roadmap contains a series of links that include an overview of the newest features and a complete series of links walking through the various features and functions. TechNet Virtual Labs: Forefront Security There are several virtual labs for FIM that are available as free downloads. Each download includes FIM and a manual, along with a 90-minute block of lab time. 21.1. Creating a SQL Server Management Agent Problem You want to get employee records from a SQL Server database to FIM so that they can be used as the source for new accounts in AD. Solution You need to start by creating a management agent (MA) for the SQL Server database: 722 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
748
1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Actions pane on the right, click Create. 4. In the Create Management Agent Wizard, select SQL Server from the “Management Agent for” drop-down list. 5. Type HR Database into the Name text box. 6. Type a description in the Description field—this is where you can be creative. 7. Click Next. 8. In the Connect to Database pane on the right side: a. Type the SQL server name into the Server Name text box. b. Type the name of the database in the Database text box. c. Type the name of the table or view that contains the employee records in the Table/View text box. d. Leave the Delta View and Multivalue Table text boxes blank. e. Select the radio button for the type of authentication the SQL server is set up to use. f. Fill in the User Name, Password, and Domain text boxes with the credentials of a user who has permissions to read and update the table we will create. 9. Click Next. 10. On the Configure Columns page: a. Click the Set Anchor button. This will display the Set Anchor dialog box. b. In the Set Anchor dialog box, select Badge Number and click the Add button. c. Click OK to save the anchor attribute definition and then click Next. 11. On the Configure Connector Filter page, click Next. 12. On the Configure Join and Projection Rules page, click Next. 13. On the Configure Attribute Flow page, click Next. 14. On the Configure Deprovisioning page, click the “Make them disconnectors” radio button. 15. Click Next. 16. On the Configure Extensions page, click Finish. 21.1. Creating a SQL Server Management Agent | 723
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
749
Discussion Following these steps will create a SQL Server management agent. Associated with the MA is a namespace known as the connector space. FIM will store the data from the relevant columns of the database here and use them to provision, synchronize, and deprovision user accounts in Active Directory. Creating the SQL Server management agent is the first of several steps to get the data into FIM. You should now see a man‐ agement agent in the Management Agents pane of the Synchronization Service Manager with the name and comments displayed. See Also Recipe 21.2 for more on creating a SQL Server MA 21.2. Creating an Active Directory Management Agent Problem You want to provision user accounts into Active Directory from the records in a SQL database. Solution The first step to accomplish this is to create an Active Directory management agent (in Recipe 21.1, see (13) of Figure 21-6): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Actions pane on the right side, click Create. 4. In the Create Management Agent Wizard, select Active Directory Domain Services from the “Management Agent for” drop-down list. 5. In the Name box, type a name. The forest name is usually a good choice. 6. If you feel creative, type a meaningful description into the Description text box. 7. Click Next. 8. In the Connect to Active Directory Forest pane on the right side: a. Type the fully qualified DNS name of the forest into the Forest Name text box. b. Fill in the username, password, and domain name of an appropriate user ac‐ count. The account must have sufficient access permissions. See this recipe’s “Discussion” on page 725 for more details. c. Click Next. 724 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
750
9. In the Configure Directory Partitions pane on the right side: a. Select the domain(s) you wish to manage in the Select Directory Partitions field. b. Click the Containers button in the lower-right portion of the dialog box. c. In the Select Container dialog, select the containers you wish to manage. d. Click OK. e. Click Next. 10. On the Configure Provisioning Hierarchy screen, click Next. 11. On the Select Object Types screen, select the user object type and then click Next. FIM requires that the organizationUnit, domainDNS, and con tainer object types always be selected. FIM uses these objects to maintain the hierarchical structure of Active Directory in the MA’s connector space. 12. In the Select Attributes pane on the right side, select the attributes you wish to manage from the Attributes field. You can check the Show All checkbox to display a full list of all attributes in the AD. Some AD attributes are mandatory; a typical minimal list would be cn, displayName, employeeID, givenName, sAMAccount Name, sn, userAccountControl, userPrincipalName, and unicodePwd. (You need to select the Show All checkbox to see the unicodePwd attribute.) Click Next to save the selected attributes. 13. On the Configure Connector Filter page, click Next. 14. On the Configure Join and Projection Rules page, click Next. 15. On the Configure Attribute Flow page, click Next. 16. On the Configure Deprovisioning page, click “Stage a delete on the object for the next export run” and then click Next. 17. On the Configure Extensions page, click Finish. Discussion The account used to connect to AD must have the following rights to the containers that you intend to write to: • Standard • Read • Write 21.2. Creating an Active Directory Management Agent | 725
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
751
• Advanced • Delete • Replicate directory changes • Create all child objects • Delete all child objects • List contents • Read all properties • Write all properties • Delete subtree • Read permissions • All validated writes A popular question that surfaces in the discussion boards has to do with why FIM doesn’t support the use of anonymous binds to LDAP directories. While there is quite a bit of development involved in connecting to a given directory’s change log for the purposes of being able to process deltas, there was obviously a hard choice made during the original product planning to avoid direct support for binding anonymously. Most of the use cases involving FIM have to do with ongoing delta processing, so supporting an anonymous bind provides little or no value except for the small percentage of cases where a quick solution precipitates the need for an anonymous bind. If you find yourself in the latter situation, consider using ldifde or another tool to extract the directory to an LDIF file for processing or build an extensible MA (XMA). See Also Recipe 21.1; Recipe 21.5; Recipe 21.8 21.3. Setting Up a Metaverse Object Deletion Rule Problem You have decided on a single authoritative source for new employees: a SQL Server database. When a user record is deleted from it, you want FIM 2010 R2 to delete the corresponding Active Directory account. Solution One of the configuration options required to have deletions propagated from a SQL Server database to Active Directory is the metaverse object deletion rule: 726 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
752
1. Open the Synchronization Service Manager. 2. Click the Metaverse Designer button on the toolbar. 3. In the Actions pane on the far-right side, click Configure Object Deletion Rule. 4. Select the “Delete metaverse object when connector from this management agent is disconnected” radio button and ensure that the SQL Server database MA has a checkmark in the box next to the name. 5. Click OK. Discussion The object deletion rule informs FIM of when to delete metaverse objects. Deleting a metaverse object does not necessarily cause anything to happen in the connected data source, but it does disconnect any connected objects in all of the connector spaces. This will cause the deprovisioning rule to fire for each disconnected object. The deprovi‐ sioning rule is configured for each management agent in the Configure Deprovisioning page for the management agent. It is critical to plan accordingly for the life cycle of every object. In many cases, deleting the MV object is not desirable if not all of the connectors are to be deleted. If you find yourself needing to maintain objects in other connected directories even after an au‐ thoritative source object has changed to an inactive status or been removed entirely, consider leaving the connectors in place and allowing the default metaverse object de‐ letion rule to prevail. This is incredibly helpful if you are doing any sort of reporting based off of aggregated identity data derived from the metaverse. See Also Recipe 21.1; Recipe 21.28 for deleting data in the connector space and metaverse; Recipe 21.15 for the provisioning run profile 21.4. Setting Up a Simple Import Attribute Flow Problem You have already created the MAs you need, but you want to flow the column data from a SQL Server database to attributes in Active Directory. Solution You need to configure the AD MA’s attribute flow rules page (in Recipe 21.1, refer to (5) in Figure 21-6): 21.4. Setting Up a Simple Import Attribute Flow | 727
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
753
1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, double-click the SQL Server database MA. 4. In the Management Agent Designer pane on the lefthand side, select Configure Attribute Flow. 5. Ensure that “person” is selected in the data source object type drop-down list. 6. Ensure that “person” is selected in the metaverse object type drop-down list. 7. In the Data Source attribute list, select the attribute whose data you wish to flow into the metaverse. (See “Discussion” for some suggestions.) 8. In the Metaverse attribute list, select the attribute you want the data to flow into. (See “Discussion” for some suggestions.) 9. In the Mapping Type section of the dialog, select Direct. 10. In the Flow Direction section of the dialog, select Import. 11. Click New. The new attribute mapping will appear in the attribute mapping list, with an arrow indicating that it is an import attribute flow. 12. Click OK. Discussion FIM has been configured to flow an attribute from the SQL Server database MA’s con‐ nector space into the metaverse. In general, we can map any attribute from the connected system to any attribute in the metaverse. However, if a Mapping Type of Direct is issued, the attributes in the MA and the metaverse must be of the same data type (e.g., string or integer). To map from one data type to another, configure the advanced attribute flow (see Recipe 21.6). Here are some typical simple mappings: • FirstName→givenName • LastName→sn • Dept→department • StaffNumber→employeeID • TelNo→telephoneNumber You need to make your own decisions about what data in the SQL Server database maps onto what data in the metaverse attributes, but these are usually fairly obvious. If you want to construct a name—for example, you’d like the sAMAccountName to be derived 728 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
754
from the first character of the first name prepended to the last name—you need an advanced flow. As a rule of thumb (and personal preference), it is generally better to do advanced flows to assemble data on the inbound flow so that the correct information is contributed to the metaverse. This approach scales better since syncs process only the inbound attribute flow for the MA that the run profile was executed from, and having direct flows on all outbound attribute rules translates to less overhead for converging a single identity. So consider moving as many of your advanced rules to import flows as possible, and use advanced rules only when necessary for export flows. See Also Recipe 21.1; Recipe 21.5 for setting up a simple export attribute flow to AD; Recipe 21.6 for defining a more advanced attribute flow; Recipe 21.7 for writing a rules extension to take the advanced flow even further (all these flows are eventually exported to AD) 21.5. Setting Up a Simple Export Attribute Flow to Active Directory Problem You want to flow attributes in the metaverse to attributes in AD. For example, the givenName field in the metaverse needs to map to the givenName field in AD. Solution You need to configure the attribute flow pages on the AD MA (in Recipe 21.1, refer to (8) in Figure 21-6): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, double-click the AD MA. 4. In the Management Agent Designer pane on the lefthand side, select Configure Attribute Flow. 5. Ensure that “user” is selected in the data source object type drop-down list. 6. Ensure that “person” is selected in the metaverse object type drop-down list. 7. In the data source attribute list, select the connector space attribute you want to flow data into. See “Discussion” on page 730 for some suggestions. 8. In the Metaverse attribute list, select the attribute you want to flow data from. See “Discussion” on page 730 for some suggestions. 21.5. Setting Up a Simple Export Attribute Flow to Active Directory | 729
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
755
9. In the Mapping Type section of the dialog, select Direct. 10. In the Flow Direction section of the dialog, select Export. 11. Click New. The new attribute mapping will appear in the attribute mapping list, with an arrow indicating that it is an export attribute flow. 12. Click OK. Discussion This will configure a simple export attribute flow from the metaverse to the AD MA. You need to determine what attributes in the metaverse should flow to AD attributes. Here are some typical simple mappings: • givenName→givenName • sn→sn • department→department • employeeID→employeeID • telephoneNumber→telephoneNumber • cn→displayName • cn→cn • uid→sAMAccountName In many FIM scenarios, data is manipulated on its way into the metaverse, and then copied on its way out to other connected systems. In this example, the cn comes from the displayName. This is because you will later create an advanced import flow that will write the first name followed by a space and the last name into the displayName in the metaverse. Something similar will be done for uid, only you will take the first character of the first name and append the last name; for example, Fred Smith gets an sAMAc countName of FSmith. See Also Recipe 21.1; Recipe 21.4; Recipe 21.6; Recipe 21.7 (these recipes are interesting because most of the data you are exporting to AD in this recipe was first imported from them) 730 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
756
21.6. Defining an Advanced Import Attribute Flow Problem You want to create an Active Directory username using the first and last names from a SQL Server database. Simple attribute-to-attribute mapping is not sufficient. You need to take partial strings from different attributes and combine them to form a new name. Solution This will involve writing some VB or C# code for an advanced attribute flow, which is covered in Recipe 21.7. To start, you must define the flow rule—an entity that connects the UI elements to the coding we will do later (refer to (5) in Figure 21-6): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, double-click the HR Database MA. 4. In the Management Agent Designer pane on the lefthand side, select Configure Attribute Flow. 5. Ensure that “person” is selected in the data source object type drop-down list. 6. Ensure that “person” is selected in the metaverse object type drop-down list. 7. In the Mapping Type section of the dialog, select Advanced. 8. In the Flow Direction section of the dialog, select Import. 9. Select FirstName and LastName from the data source attributes text box. (To select multiple entries, hold down the Ctrl key.) FirstName and LastName in this example are the names of fields in the SQL Server database. Your available field options will depend on the database used. 10. Select cn from the Metaverse attribute list. 11. Click New. 12. In the Advanced Import Attribute Flow Options dialog, delete the default name, type cn, and then click OK. The flow rule name you defined here will appear in the VB or C# code you will write later. A convention among MIIS developers is to use the name of the destination attribute (in this case, cn). 21.6. Defining an Advanced Import Attribute Flow | 731
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
757
13. Notice that in the Type column in the upper pane, the newly created attribute map‐ ping is detailed as Rules-Extension. A rules extension is a unit of managed .NET code. 14. Select FirstName and LastName from the Data Source attribute mapping list. (Re‐ member to use the Ctrl key to select multiple attributes.) 15. Select uid from the Metaverse attribute mapping list. 16. Click New. 17. In the Advanced Import Attribute Flow Options dialog, type uid into the “Flow rule name” text box and click OK. 18. Notice in the Type column in the upper pane the newly created attribute mapping is detailed as Rules-Extension. 19. Select Configure Extensions in the lefthand pane. 20. Type HR DatabaseExtension into the Rules Extension Name text box. 21. Click OK. Discussion In this recipe, an advanced attribute flow rule was defined. The rule extension is im‐ plemented in managed .NET code in Recipe 21.7. There are two additional types of advanced attribute flow. One is where a constant is defined that will always be written to the selected attribute. The other is used if you are flowing a distinguished name (the source attribute must be defined as a Reference DN) and only wish to flow a specific component of the DN and not the entire DN itself into a string attribute in the metaverse. No rules extension code is required for either type of advanced attribute flow. However, if you need to manipulate the attributes being flowed using code, you must define an advanced attribute flow and provide a flow rule name. Even though you may not have created the DLL that will be used at this stage, you still have to put a name in the dialog to exit the MA designer. See Also Recipe 21.1; Recipe 21.4 for setting up a simple import attribute flow; Recipe 21.5; Recipe 21.7 for creating a rules extension to further extend advanced attribute flow; Recipe 21.8 to export data to AD 732 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
758
21.7. Implementing an Advanced Attribute Flow Rules Extension Problem You want to perform advanced attribute flow from a SQL Server database. Solution You’ve already defined an advanced attribute flow rule for the MA in the Identity Man‐ ager console. You now need to write the code and produce the DLL that implements that flow rule (refer to (5) in Figure 21-6): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. Right-click the SQL Server MA in the Management Agents pane and select Create Extension Projects→Rules Extension. 4. Ensure that the dialog box is filled in similar to Figure 21-7. (You can specify your own name and location.) Figure 21-7. Create Extension Project dialog 5. Click OK. This will launch Visual Studio. 21.7. Implementing an Advanced Attribute Flow Rules Extension | 733
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
759
This recipe assumes that you have already installed Visual Studio 2008 or later on the machine running FIM. If you are doing your development on another machine, you have two choices. You can map a drive to the FIM server and modify the code through the mapped drive, or you can copy the entire project to your develop‐ ment machine and work on it there. In any case, you will have to be sure to copy the resultant DLL back to the server any time you make a code change. 6. In the Solution Explorer in the far-righthand pane in Visual Studio, double-click the HR DatabaseExtension.vb node. This file contains the source code for your rules extension. 7. The main code window should show the automatically generated code. (This auto￾code generation is provided for VB and C#.) The first few lines of code should look like this: Imports Microsoft.MetadirectoryServices Public Class MAExtensionObject Implements IMASynchronization 8. Scroll to the code section that looks like this: Public Sub MapAttributesForImport(ByVal FlowRuleName As String, ByVal↵ csentry As CSEntry, ByVal mventry As MVEntry) Implements IMASynchronization.MapAttributesForImport ' TODO: write your import attribute flow code Select Case FlowRuleName Case "uid" ' TODO: remove the following statement and add your scripted ' import attribute flow here Throw New EntryPointNotImplementedException() Case "cn" ' TODO: remove the following statement and add your scripted ' import attribute flow here Throw New EntryPointNotImplementedException() Case Else ' TODO: remove the following statement and add your default ' script here Throw New EntryPointNotImplementedException() End Select End Sub 734 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
760
9. Edit this section to make the code look like this (the bold sections are new code that we typed in): Select Case FlowRuleName Case "uid"If Not csentry("Last Name").IsPresent Then Throw New↵ UnexpectedDataException("No Last Name!")End If If Not csentry("First Name").IsPresent Then Throw New↵ UnexpectedDataException("No First Name!")End If mventry("uid").Value = csentry("First Name").StringValue.Substring(0, 1)↵ + csentry("Last Name").Value Case "cn"If Not csentry("Last Name").IsPresent Then Throw New↵ UnexpectedDataException("No Last Name!") End If If Not csentry("First Name").IsPresent Then Throw New↵ UnexpectedDataException("No First Name!") End If mventry("cn").Value = csentry("First Name").Value + " "↵ ;+ csentry("Last Name").Value Case Else ' TODO: remove the following statement and add your default script here Throw New EntryPointNotImplementedException End Select First Name and Last Name in this example are the names of fields in the SQL Server database. Your available field options will depend on the database used. 10. Go to the Build menu and select Build Solution. Ensure that in the output panel at the bottom of the screen you see a message that looks like this: ---------------------- Done --------------------- Build: 1 succeeded, 0 failed, 0 skipped 11. Close Visual Studio. 12. Open Windows Explorer and browse to C:\Program Files\Microsoft Forefront Iden‐ tity Manager\2010\Synchronization Service\Extensions (this assumes you installed FIM 2010 R2 on the C: drive in the default location; if you didn’t, substitute the relevant parts of the path), and ensure that the DLL is present. The DLL will be called <SQL Server MA>.dll. 13. To be absolutely sure you have the correct rules extension selected in FIM, open the Synchronization Service Manager. 14. Click the Management Agents button. 15. In the Management Agents pane, double-click the SQL Server MA. 21.7. Implementing an Advanced Attribute Flow Rules Extension | 735
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
761
16. In the lefthand pane of the Management Agent Designer, click Configure Exten‐ sions. 17. Click the Select button. 18. Select HR DatabaseExtension.dll and click OK. 19. Click OK to close Management Agent properties. 20. Close the Synchronization Service Manager. Discussion This code does some fairly simple string manipulation. This chapter doesn’t venture into the world of advanced FIM coding, but there are many examples in the Developer Reference off the help menu in the Synchronization Service Manager. The FIM development environment is so flexible that human-driven digital identity business processes can be encapsulated in extension rules. However, there is no work‐ flow engine, which means you may have to call workflow processes on another engine, such as BizTalk. See Also Recipe 21.1; Recipe 21.8 for setting constants on certain attributes 21.8. Setting Up Advanced Export Attribute Flow in Active Directory Problem Simple attribute-to-attribute mapping is not flexible enough to create the attribute val‐ ues you want. You want to set constant values on some attributes. In this case, there is a bit mask of great interest: the mask used to set properties for accounts, such as whether the account is disabled. Solution This will involve writing some VB or C# code, like the script for advanced attribute flow covered in Recipe 21.9, but we must set up flow rule names for the code in this section (refer to (8) in Figure 21-6): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, double-click the AD MA. 736 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
762
4. In the Management Agent Designer pane on the lefthand side, select Configure Attribute Flow. 5. Ensure that “user” is selected in the data source object type drop-down list. 6. Ensure that “person” is selected in the metaverse object type drop-down list. 7. In the Mapping Type section of the dialog, select Advanced. 8. In the Flow Direction section of the dialog, select Export. 9. Select userAccountControl from the Data Source attributes list. 10. Click New. 11. In the Advanced Attribute Flow Options dialog, select Constant. 12. Type 512 into the Value text box and then click OK. 13. Notice that in the Type column in the upper pane, the newly created attribute map‐ ping is detailed as Constant, with an arrow indicating export attribute flow. 14. Click OK to close the Management Agent Designer. Discussion Active Directory requires a minimal set of attributes in order to create normal, usable, enabled accounts. In this recipe we have set the required attributes. We set the userAc countControl flag to 512 (bit 9 set), which indicates that this account is a normal ac‐ count. In other cases we might use a rules extension and set bit 1 to disable the account; for example, if there was an employee status field in the SQL Server database that indi‐ cated the employee was inactive. See Also Recipe 21.1; Recipe 21.9; Recipe 21.14 for writing a rules extension to provision user objects to the AD MA from objects in a SQL Server MA 21.9. Configuring a Run Profile to Do an Initial Load of Data from a SQL Server Management Agent Problem You need to get the data from the SQL Server database to its connector space. Solution Before you can run a management agent, you must create a run profile for it (refer to (9) in Figure 21-6, which shows data being loaded from AD to the AD connector space): 21.9. Configuring a Run Profile to Do an Initial Load of Data from a SQL Server Management Agent | 737
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
763
1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the SQL Server MA. 4. In the Actions pane on the far-right side, click Configure Run Profiles. 5. In the Configure Run Profiles for “<MA Name>” dialog box, click New Profile. 6. In the Name text box, type Full Import (Stage Only) and then click Next. 7. Ensure that Full Import (Stage Only) is selected in the Type drop-down list and then click Next. 8. Ensure that “default” is showing in the Partition drop-down list and then click Finish. 9. Click OK to create the run profile. Discussion Three steps are required to get data into the SQL Server MA connector space: 1. Create the MA. 2. Create a run profile to run the MA. 3. Execute the run profile. In this recipe you have created the run profile. It is generally a good idea to give the run profiles exactly the same names as the step type they represent. You will later create scripts that call run profiles. It is possible to give a run profile a name such as “Complete Cycle” and combine many steps in the run profile. However, when calling such entities from scripts, the calling script isn’t self￾documenting, in that it hides what it is doing. It is also much easier to debug scripts when you know exactly what step is being called. Hence, you have created a run profile called Full Import (Stage Only), which consists of a single step of type Full Import (Stage Only). The one exception to this general rule is discussed in Recipe 21.17. See Also Recipe 21.10 for more on how to use the run profile to load data; Recipe 21.17 738 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
764
21.10. Loading Initial SQL Server Database Data into FIM 2010 R2 Using a Run Profile Problem With the MA and run profile created, you now want to load the data into FIM 2010 R2. Solution You need to execute the run profile to load the data (refer to (1) in Figure 21-6, which shows data being loaded from the SQL Server database to the SQL Server database MA connector space): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the SQL Server MA. 4. In the Actions pane on the far-right side, click Run. 5. In the Run Management Agent dialog, select Full Import (Stage Only) and click OK. You’ll have to be quick if there is only a small amount of data in the database. Notice the MA says “Running” in the State column of the Management Agents pane. 6. In the Synchronization Statistics pane in the bottom-lefthand corner, statistics showing the number of adds are displayed. If you click the hyperlink, you can nav‐ igate to the information that was loaded. The SQL Server database you are importing from must have records in it before FIM can import any data. Discussion When designing a large system, work with a very small, representative set of data during development (maybe 10 records). This is because you will frequently find errors in your rules and set about deleting everything in FIM, reconfiguring your rules, and starting again. It is much better to do these initial data loads with 10 or so records rather than 100,000 records, which will take a long time to load. When you are convinced your rules are good, start working with larger data sets. 21.10. Loading Initial SQL Server Database Data into FIM 2010 R2 Using a Run Profile | 739
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
765
See Also Recipe 21.1; Recipe 21.9 for more on how this run profile was configured 21.11. Configuring a Run Profile to Load the Container Structure from Active Directory Problem Before you can provision and synchronize data in the AD connector space, you need to build the container structure in the connector space to reflect the container structure of Active Directory. Solution To do this, you have to create an appropriate run profile for the AD MA and import the AD container structure into the connector space. The fact that you have to separately import the container structure from AD into the MA’s connector space is not obvious and is frequently overlooked by even the most experienced FIM developers. If you fail to perform this step, the synchronization process will fail when it tries to provision new objects into the AD connector space. Refer to (9) in Figure 21-6, which shows data being loaded from AD to the AD connector space: 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar 3. In the Management Agents pane, click the AD MA. 4. In the Actions pane on the far-right side, click Configure Run Profiles. 5. In the Configure Run Profiles dialog, click New Profile. 6. In the Name text box, type Full Import (Stage Only) and then click Next. 7. Ensure that Full Import (Stage Only) is selected in the Type drop-down list and then click Next. 8. Ensure that the correct domain partition is showing in the Partition drop-down list and then click Finish. 9. Ensure that the details in the Step Details field look like Figure 21-8. 740 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
766
Your partition name may be different. 10. Click OK. Figure 21-8. Configure Run Profiles dialog for the AD MA Discussion Three steps are required to get data into the AD MA connector space: 1. Create the MA. 2. Create the run profile. 3. Execute the run profile. In this recipe you created the run profile. When you create an AD MA, you specify which partitions (naming contexts) you wish to synchronize. When creating a run profile, you must be careful to select the correct 21.11. Configuring a Run Profile to Load the Container Structure from Active Directory | 741
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
767
partition (Naming Context in AD terms, which will usually be after the domain NC) from which to load the container structure. A common mistake among FIM novices is to get “object does not have a parent” errors when running a synchronization step. This is because the container structure for Active Directory isn’t loaded into the AD MA’s connector space. FIM can create missing containers based on rules, but you need to configure and write those rules. That is beyond the scope of this book. See Also Recipe 21.1; Recipe 21.12 for more on how to use the run profile that was configured in this recipe; the TechNet FIM 2010 R2 Forum for many discussion threads on programming techniques for the creation of missing containers (search for “OU cre‐ ation” after you have joined the forum) 21.12. Loading the Initial Active Directory Container Structure into FIM 2010 R2 Using a Run Profile Problem With the AD MA and run profile created, you need to get the data into FIM. Solution You now need to run the AD MA run profile to import the AD container structure (refer to (9) in Figure 21-6, which shows the data being loaded from AD into the AD connector space): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the AD MA. 4. In the Actions pane on the far-right side, click Run. 5. In the Run Management Agent dialog, select Full Import (Stage Only) and click OK. 6. You’ll have to be quick if there is only a small amount of data in AD. Notice the MA briefly says “Running” in the State column of the Management Agents pane. 7. Notice the Synchronization Statistics pane in the bottom-lefthand corner, where statistics showing the number of adds are displayed. If you click the hyperlink, you can navigate to the information that was loaded. 742 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
768
Discussion The first time you load the container structure into FIM, you need to use a full import step. Once the container structure is loaded, subsequent imports can use delta import steps, which in normal daily operations will be considerably faster to execute and will consume fewer resources on the FIM server, the AD domain controller, and the network. See Also Recipe 21.1; Recipe 21.11 for more on how to configure the run profile that was used in this recipe 21.13. Setting Up a SQL Server Management Agent to Project Objects to the Metaverse Problem The objects in the SQL Server MA’s connector space now need to be projected into the metaverse. There are three steps: 1. Configuring the MA for projection 2. Creating a synchronization run profile 3. Executing the synchronization run profile Solution Refer to (3) in Figure 21-6, which shows objects being provisioned from the SQL Server MA’s connector space to the metaverse: 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, double-click the SQL Server MA. 4. In the Management Agent Designer pane on the lefthand side, select Configure Join and Projection Rules. 5. Click the New Projection Rule button. 6. In the Projection dialog, ensure that Declared is selected and that the drop-down list shows “person”, and then click OK. 7. Notice in the “Join and Projection Rules for person” frame, the columns are detailed thusly: 21.13. Setting Up a SQL Server Management Agent to Project Objects to the Metaverse | 743
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
769
• Mapping Group: 1 • Action: Project • Metaverse Object Type: person 8. Click OK. Discussion The synchronization process projects (or creates) metaverse objects that are joined to objects in the SQL Server MA connector space. When projected, FIM can provision new objects to the AD MA’s connector space. Hence, in our demonstration it is projection that initiates provisioning; however, it is perfectly legal for changes in attribute states to trigger provisioning if you have written your provisioning extensions to observe such workflows. The most common example would be looking for a change in an HR em‐ ployee status attribute to trigger creation of a new account in AD. While novices often use the terms project and provision interchangeably, they mean quite different things. From the FIM perspective, provision means “to create a new CS object in a CS where there was no object previously.” From an AD administrator’s perspective, provision generally means creation of an AD account complete with all of the standard accoutre‐ ments (home directory, terminal server profile, etc.), so it is important to be clear, de‐ pending on your audience. Table 21-1 clarifies this and introduces some new terminology: csentry for connector space objects and mventry for metaverse objects. Table 21-1. Synchronization process HR Database connector space Action Metaverse Action AD connector space csentry objects → Project to metaverse → mventry objects → Provision to connector space → csentry objects See Also Recipe 21.1; Recipe 21.14 for more on provisioning 21.14. Writing a Rules Extension to Provision User Objects Problem This recipe specifically covers writing a rules extension to provision user objects to the AD MA from objects in the SQL Server MA. You want FIM to provision objects to the AD MA’s connector space based on objects in the SQL Server MA. 744 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
770
Solution There are three steps to provisioning: 1. Write a rules extension. 2. Configure a run profile. 3. Execute the run profile. In this recipe, you will write a Provisioning-Rules-Extension. FIM will help you with the initial project creation. Refer to (6) in Figure 21-6, which shows objects being pro‐ visioned from the metaverse to the AD connector space: 1. Open the Synchronization Service Manager. 2. From the Tools menu, select Options. 3. In the Options dialog, place a checkmark next to “Enable metaverse rules extension”. 4. Click the Create Rules Extension Project button. 5. Ensure that the Create Extension Project dialog looks like Figure 21-9. Figure 21-9. Dialog for creating the metaverse Provisioning-Rules-Extension 6. Click OK. 7. In Visual Studio, double-click MVExtension in the Solution Explorer. 8. The first few lines of the code pane should look like this: Imports Microsoft.MetadirectoryServices Public Class MVExtensionObject Implements IMVSynchronization 9. Navigate to the section that looks like this: Public Sub Provision(ByVal mventry As MVEntry) Implements IMVSynchronization.Provision ' TODO: Remove this throw statement if you implement this method 21.14. Writing a Rules Extension to Provision User Objects | 745
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
771
Throw New EntryPointNotImplementedException() End Sub 10. Modify it to contain the following code: Public Sub Provision(ByVal mventry As MVEntry) Implements ↵ IMVSynchronization.Provision Dim container As String Dim rdn As String Dim ADMA As ConnectedMA Dim numConnectors As Integer Dim myConnector As CSEntry Dim csentry As CSEntry Dim dn As ReferenceValue ' Ensure that the cn attribute is present. If Not mventry("cn").IsPresent Then Throw New UnexpectedDataException("cn attribute is not present.") End If ' Calculate the container and RDN.↵ container = "cn=users,DC=adatum,DC=com" rdn = "cn=" & mventry("cn").Value ADMA = mventry.ConnectedMAs("adatum.com") dn = ADMA.EscapeDNComponent(rdn).Concat(container) numConnectors = ADMA.Connectors.Count ' create a new connector. If numConnectors = 0 Then csentry = ADMA.Connectors.StartNewConnector("user") csentry.DN = dn csentry("unicodePwd").Value = "Password1" csentry.CommitNewConnector() ElseIf numConnectors = 1 Then ' If the connector has a different DN rename it. myConnector = ADMA.Connectors.ByIndex(0) myConnector.DN = dn Else Throw New UnexpectedDataException("Error: There are" + ↵ numConnectors.ToString + " connectors") End If End Sub 11. Notice the highlighted entries "cn=users,DC=adatum,DC=com". You will need to enter your own domain and container information here. 12. Notice the highlighted entry mventry.ConnectedMAs("adatum.com"). You will need to modify this to your own AD MA name. 13. From the File menu, select Build→Build Solution. 746 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
772
14. Open the Synchronization Service Manager. 15. From the menu select Tools→Options. 16. In the Options dialog, click Browse. 17. Select MVExtension.dll and click OK to close the Options dialog. Discussion Because you can use any .NET programming language, FIM is very flexible in a multi‐ team environment. As with many modern systems, it is not great programming skills that help you build good rules extensions with FIM: it is experience and familiarity with the object model. It is well worth getting to know the FIM object model. Many novices spend hours or days coding a function, only to find there is already a method on the object that does the thing they have spent all their time on. If you are working on distributing the workload for provisioning to multiple systems (e.g., each MA is assigned to a developer or team), consider adopting the MV Router model whereby each MA is compartmentalized into its own project DLL and controlled by a single “router” DLL. In this manner, you reduce the amount of testing involved whenever code for a single MA is changed, since you are not affecting code in other projects. See Also Recipe 21.1; Recipe 21.4 for a description of how the code in this recipe is triggered; Recipe 21.13 for setting up a SQL Server MA to project objects to the metaverse (re‐ member, in this demonstration it is projection that triggers provisioning) 21.15. Creating a Run Profile for Provisioning Problem You need to synchronize data using the management agent to provision new accounts in the AD connector space. Before you can run the MA, you have to create a run profile that will synchronize the MA’s connector space with the metaverse. Solution You now need to create a provisioning run profile for a SQL Server MA to synchronize user objects from it to the AD MA’s connector space. The run profile step is of type synchronization: 1. Open the Synchronization Service Manager. 21.15. Creating a Run Profile for Provisioning | 747
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
773
2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the SQL Server MA. 4. In the Actions pane on the far-right side, click Configure Run Profiles. 5. In the Configure Run Profiles dialog, click New Profile. 6. In the Name text box, type Full Synchronization and then click Next. 7. Ensure that Full Synchronization is selected in the Type drop-down list and then click Next. 8. Ensure that “default” is showing in the Partition drop-down list and then click Finish. 9. Ensure that the details in the Step Details field look like Figure 21-10. 10. Notice in the Management Agent run profiles list that the Full Import (Stage Only) profile you created earlier is still there. 11. Click OK. Figure 21-10. Dialog showing a Full Synchronization run profile added to the SQL Server MA 748 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
774
Discussion There are two types of synchronization run profiles: full and delta. A full synchroniza‐ tion will process every object in the connector space. This is obviously necessary when it is the very first synchronization on the data. But in normal daily operations, you only want to perform delta synchronization steps because they process only objects that have changed since the last synchronization. Full synchronization is also used when you have made a change to the management agent configuration; for example, you have added a new attribute flow. Usually you will want to run the reconfigured MA against all of the objects in the connector space. A delta synchronization would apply the rule only to objects that had changed since the last synchronization. See Also Recipe 21.13 for setting up a SQL Server MA to project objects to the metaverse; Recipe 21.14 for writing a rules extension to provision user objects to the AD MA from objects in a SQL Server MA; Recipe 21.16 for executing the run profile created in this recipe 21.16. Executing the Provisioning Rule Problem You need to provision new objects to the AD connector space. Solution You need to run the provisioning run profile. The provisioning run profile triggers projection ((3) in Figure 21-6). The arrival of new objects in the metaverse ((4) in Figure 21-6) in turn triggers provisioning ((6) in Figure 21-6) and creates new objects ((7) in Figure 21-6) in the AD connector space. Follow these steps: 1. Open the Identity Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the HR Database MA. 4. In the Actions pane on the far-right side, click Run. 5. In the Run Management Agent dialog, select Full Synchronization and click OK. 6. Notice that the MA says “Running” in the State column of the Management Agents pane and then says “Idle.” 21.16. Executing the Provisioning Rule | 749
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
775
7. Notice that in the Synchronization Statistics pane in the bottom-lefthand corner, statistics showing the number of projections and provisioned entries are displayed. If you click one of the hyperlinks, you can navigate to the information that was projected and provisioned. Discussion Inbound attribute flow is processed only on the MA that the run profile is executed against. That includes joins and projections, and since we have to have an MV object from which to provision, we will need to run a synchronization run profile against the HR MA in order to trigger provisioning to create the objects in the AD MA. If you were to run a synchronization run profile against the AD MA at this stage, nothing would be provisioned. See Also Recipe 21.13 for setting up the HR Database MA to project objects to the metaverse; Recipe 21.14 for writing a rules extension to provision user objects to the AD MA from objects in the HR Database MA; Recipe 21.15 for creating the run profile that was executed in this recipe 21.17. Creating a Run Profile to Export Objects from the AD MA to Active Directory Problem You want to create the new accounts in Active Directory. Solution There are two steps to get the data from an MA to a connected system: creating an export run profile and executing the profile. This is the first step (the second step is in Recipe 21.18): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the AD MA. 4. In the Actions pane on the far-right side, click Configure Run Profiles. 5. In the “Configure Run Profiles for” pane, click New Profile. 6. In the Name text box, type Export and then click Next. 750 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
776
7. Ensure that Export is selected in the Type drop-down list and then click Next. 8. Ensure that the correct domain partition is showing in the Partition drop-down list and then click Finish. 9. Click New Step. 10. In the Configure Step dialog, ensure that Delta Import (Stage Only) is selected in the Type drop-down list and then click Next. 11. Ensure that the correct domain is selected in the Partition drop-down list and then click Finish. 12. Ensure that the details in the Step Details field look like Figure 21-11. Your partition name may be different. 13. Click OK. Figure 21-11. AD MA Export run profile showing an Export step followed by a Delta Import (Stage Only) step 21.17. Creating a Run Profile to Export Objects from the AD MA to Active Directory | 751
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
777
Discussion We mentioned earlier that it is a good idea to name the run profiles you create exactly the same as the run profile steps; that is, a run profile of type Full Import (Stage Only) is named Full Import (Stage Only). The one exception to this general rule applies to export run profiles. When an export is completed, the only way the MA can truly know the data was successfully written to the target data store is to reimport the changes and compare them to what it believes was written out. This is known as a confirming im‐ port. In AD, for example, if we programmatically create a user account without a pass‐ word, AD will automatically disable the user account by setting a flag in the userAc countControl attribute. For FIM to maintain knowledge of this state, the confirming import brings this knowledge back into FIM. Therefore, exports need to include a con‐ firming import stage. If the system we are exporting to supports some form of change logging (as AD does through USNs), then the type of confirming import can be a delta import (stage only). If the system doesn’t expose any form of change logging (e.g., Novell eDirectory), a full import (stage only) step will be necessary. FIM’s sync engine performs delta imports using the Active Directory DirSync control. You need to assign the “Replicate Directory Changes” right to the user associated with the AD MA for delta imports to work (see MS KB 303972 for instructions). See Also Recipe 21.18 for more on how to use this run profile to export objects to AD; MS KB 303972 (How to Grant the “Replicating Directory Changes” Permission for the Micro‐ soft Metadirectory Services AD MA Service Account) 21.18. Exporting Objects to Active Directory Using an Export Run Profile Problem You need to execute the export run profile. Solution The second step is executing the export run profile to get the data into AD (the first step is in Recipe 21.17). Refer to (9) in Figure 21-6, which shows the objects being exported to AD; (10) in the same figure shows the objects created in AD. Follow these steps: 1. Open the Identity Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the AD MA. 752 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
778
4. In the Actions pane on the far-right side, click Run. 5. In the Run Management Agent dialog, select Export and click OK. 6. You’ll have to be quick if there is only a small amount of data in the AD MA. Notice that the MA says “Running” in the State column of the Management Agents pane. 7. Notice that in the Synchronization Statistics pane in the bottom-lefthand corner, statistics showing the number of adds are displayed. If you click a hyperlink, you can navigate to the information that was written to AD. 8. Open Active Directory Users and Computers. 9. Navigate to the Users container. 10. Ensure that the user objects have been created. Discussion User accounts in Active Directory may be flagged as disabled even though you think they should be active. Assuming you set the userAccountControl attribute correctly, the usual reason for this is that some other attribute has not been set correctly and Active Directory has disabled the account. For example, if you do not set a password on an account, or the password you set does not meet the domain password requirements, Active Directory will disable the account. If you do not set a password on a user object using the Active Directory Users and Computers MMC snap-in, you will receive a warning. If you do it programmatically, as FIM does, the account will be disabled. By performing all the previous recipes successfully, you have provisioned user accounts from records in the SQL Server database to AD. See Also Recipe 21.1; Recipe 21.17 for how to configure the run profile that was used in this recipe 21.19. Creating a Run Profile Script Problem It is impractical to continually use the UI every time you wish to execute a run profile. You want to automate the process by calling FIM run profiles to perform the required actions. 21.19. Creating a Run Profile Script | 753
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
779
Solution You need to create a run profile script: 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the SQL Server MA. 4. In the Actions pane on the far-right side, click Configure Run Profiles. 5. In the Configure Run Profiles dialog, select the Export run profile. 6. Click the Script button. 7. Browse to a location to save the script files. 8. In the “File name” text box, type SQL Server MA Export. 9. In the “Save as type” text box, select VB Script. 10. Click the Save button. 11. Repeat steps 3–9 for the other run profiles in the SQL Server MA and the AD MA. Follow the same file-naming convention. Discussion The scripts free you from the UI and can also form the building blocks of a FIM im‐ plementation that runs unattended. You have several options, including: • Submit the scripts to the Windows Task Scheduler Service to run on a specified daily schedule. To do this, open the Task Scheduler, double-click Add Scheduled Task, and follow the steps in the wizard. • Create a Windows service that calls the scripts according to your own criteria, per‐ haps by submitting them to the Task Scheduler using its APIs. • Use the SQL Server Agent process to invoke run profiles on the FIM server. This approach is especially useful if you are using a SQL Server cluster and need your profiles to follow the active node in case of a failure condition. • If you already have a script execution environment, incorporate the new scripts. See Also Recipe 21.20 to create a controlling script; the MSDN walkthrough about creating a Windows Service Application; the Task Scheduler API reference 754 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
780
21.20. Creating a Controlling Script Problem You want a self-contained script that controls an entire sequence of operations; for example, import the SQL Server database records, synchronize, and then export to AD. Solution Before you start this recipe, you may want to make sure you have the GroupPopulator Sync.cmd and RunMA.vbs files available. Refer to “See Also” on page 760 for the URLs. 1. Open Notepad. 2. Type this script (or copy and paste the contents of the GroupPopulatorSync.cmd file from the MIIS Scenarios, referenced in this recipe’s “See Also” on page 760): @echo off rem rem Copyright (c) Microsoft Corporation. All rights reserved. rem setlocal set zworkdir=%~dp0 pushd %zworkdir% set madata=" C:\Program Files\Microsoft Forefront Identity Manager\2010\↵ Synchronization Service\MaData" rem Full Import of SQL Database Records rem ------------------------------------------- cscript runMA.vbs /m:"<SQL Server MA Name>" /p:"Full Import (Stage Only)" if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) ↵ & (goto exit_script) rem Full Sync of SQL Database Records rem ---------------------------------------- cscript runMA.vbs /m:"<SQL Server MA Name>" /p:"Full Sync" if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) ↵ & (goto exit_script) rem Export users in to AD rem -------------------- cscript runMA.vbs /m:"<Domain FQDN>" /p:"Export" if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) ↵ & (goto exit_script) :exit_script popd endlocal 21.20. Creating a Controlling Script | 755
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
781
3. In this case, insert the SQL Server MA name and domain FQDN where appropriate. This example also shows Full Import (Stage Only), which is the name of the run profile. If you named the steps differently, replace them with the appropriate name here. 4. Save the file with a .cmd file extension. 5. Close Notepad. 6. Open Notepad. 7. Type the following script (or copy and paste the contents of the RunMA.vbs file in the FIM scenarios, referenced in the “See Also” section): option explicit on error resume next '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 'SCRIPT: runMA.vbs 'DATE: 2003-02-05 '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= '= Copyright (C) 2003 Microsoft Corporation. All rights reserved. '= '**************************************************************************** '* Function: DisplayUsage '* '* Purpose: Displays the usage of the script and exits the script '* '**************************************************************************** Sub DisplayUsage() WScript.Echo "" WScript.Echo "Usage: runMa </m:ma-name> </p:profile-name>" WScript.Echo " [/s:mms-server-name]" WScript.Echo " [/u:user-name]" WScript.Echo " [/a:password]" WScript.Echo " [/v] Switch on Verbose mode" WScript.Echo " [/?] Show the Usage of the script" WScript.Echo "" WScript.Echo "Example 1: runMa /m:adma1 /p:fullimport" WScript.Echo "Example 2: runMa /m:adma1 /p:fullimport /u:domain\user /a:mysecret /v" WScript.Quit (-1) End Sub '**************************************************************************** ' Script Main Execution Starts Here '**************************************************************************** '--Used Variables-------------------------- dim s dim runResult dim rescode dim managementagentName 756 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
782
dim profile dim verbosemode dim wmiLocator dim wmiService dim managementagent dim server dim username dim password '----------------------------------------- rescode = ParamExists("/?") if rescode = true then call DisplayUsage verbosemode = ParamExists("/v") managementagentName = ParamValue("/m") if managementagentName = "" then call DisplayUsage profile = ParamValue("/p") if profile = "" then call DisplayUsage if verbosemode then wscript.echo "%Info: Management Agent and Profile is ↵ <"& managementagentName &":"& profile &">" if verbosemode then wscript.Echo "%Info: Getting WMI Locator object" set wmiLocator = CreateObject("WbemScripting.SWbemLocator") if err.number <> 0 then wscript.echo "%Error: Cannot get WMI Locator object" wscript.quit(-1) end if server = ParamValue("/s") password = ParamValue("/a") username = ParamValue("/u") if server = "" then server = "." ' connect to WMI on local machine if verbosemode then wscript.Echo "%Info: Connecting to MMS WMI Service on↵ <" & server &">" if username <> "" then wscript.Echo _ "%Info: Accessing MMS WMI Service as <"& username &">" end if if username = "" then set wmiService = wmiLocator.ConnectServer _ (server, "root/MicrosoftIdentityIntegrationServer") else set wmiService = wmiLocator.ConnectServer_ (server, "root/MicrosoftIdentityIntegrationServer", username,↵ password) end if 21.20. Creating a Controlling Script | 757
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
783
if err.number <> 0 then wscript.echo "%Error: Cannot connect to MMS WMI Service <" ↵ & err.Description & ">" wscript.quit(-1) end if if verbosemode then wscript.Echo "%Info: Getting MMS Management Agent↵ via WMI" Set managementagent = wmiService.Get( " MIIS_ManagementAgent.Name='" & _ managementagentName & "'") if err.number <> 0 then wscript.echo _ "%Error: Cannot get Management Agent with specified WMI Service <"↵ & err.Description & ">" wscript.quit(-1) end if wscript.echo "%Info: Starting Management Agent with Profile <"& ↵ managementagent.name &":"& profile &">" runResult = managementagent.Execute(profile) if err.number <> 0 then wscript.Echo "%Error: Running MA <"& err.Description & ↵ ">. Make sure the correct profile name is specified." wscript.quit(-1) end if wscript.Echo "%Info: Finish Running Management Agent" wscript.Echo "%Result: <" & CStr(runResult) & ">" wscript.quit(0) '************************************************************************** '* Function: ParamValue '* '* Purpose: Parses the command line for an argument and '* returns the value of the argument to the caller '* Argument and value must be seperated by a colon '* '* Arguments: '* [in] parametername name of the parameter '* '* Returns: '* STRING Parameter found in commandline '* "" Parameter NOT found in commandline '* '************************************************************************** Function ParamValue(ParameterName) Dim i '* Counter 758 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
784
Dim Arguments '* Arguments from the command-line command Dim NumberofArguments '* Number of arguments from the command-line Dim ArgumentArray '* Array to store arguments from command-line Dim TemporaryString '* Utility string '* Initialize Return Value to e the Empty String ParamValue = "" '* If no ParameterName is passed into the function exit if ParameterName = "" then exit function '* Check if Parameter is in the Arguments and return the value Set Arguments = WScript.Arguments NumberofArguments = Arguments.Count - 1 For i=0 to NumberofArguments TemporaryString = Arguments(i) ArgumentArray = Split(TemporaryString,":",-1,vbTextCompare) If ArgumentArray(0) = ParameterName Then ParamValue = ArgumentArray(1) exit function End If Next end Function '*************************************************************************** '* Function: ParamExists '* '* Purpose: Parses the command line for an argument and '* returns the true if argument is present '* '* Arguments: '* [in] parametername name of the paramenter '* '* Returns: '* true Parameter found in commandline '* false Parameter NOT found in commandline '* '*************************************************************************** Function ParamExists(ParameterName) Dim i '* Counter Dim Arguments '* Arguments from the command-line command Dim NumberofArguments '* Number of arguments from the command-line Dim ArgumentArray '* Array to store arguments from command-line Dim TemporaryString '* Utility string '* Initialize Return Value to e the Empty String 21.20. Creating a Controlling Script | 759
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
785
ParamExists = false '* If no ParameterName is passed into the function exit if ParameterName = "" then exit function '* Check if Parameter is in the Arguments and return the value Set Arguments = WScript.Arguments NumberofArguments = Arguments.Count - 1 For i=0 to NumberofArguments TemporaryString = Arguments(i) If TemporaryString = ParameterName Then ParamExists = true exit function End If Next end Function 8. Save the file in the same folder as the previous script we created and name it run MA.vbs. 9. Close Notepad. Discussion A script to control these operations, known as a controlling script, is required. You could simply create a script that called each of your other scripts in turn, but managing large numbers of scripts as the solution gets more complex becomes a problem. Using the RunMA.vbs script inside a batch file to create a wrapper around your run profile execution is a common way to control when profiles get called. In a majority of solutions, you will find yourself needing to halt the processing of one run profile should a preceding run profile end in an error condition. By using this process, you ensure that any errorlevel other than 0 is an error, and you can either choose to halt processing altogether or branch accordingly. See Also FIM 2010 R2 Developer Reference; the runMA.vbs and GroupPopulatorSync.cmd script files in the Group Management folder in the ILM scenarios 760 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
786
21.21. Enabling Directory Synchronization from Active Directory to the HR Database Problem You want AD to become the authoritative source for the telephoneNumber attribute of Active Directory users. Solution You need to configure both the import attribute flow from the AD MA connector space to the metaverse, as well as the export attribute flow from the metaverse to the SQL Server MA connector space (refer to (5) and (8) in Figure 21-6, which show where the rules will be configured): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, double-click the AD MA. 4. In the Management Agent Designer pane on the lefthand side, highlight Select Attributes. 5. In the Attributes pane on the righthand side, select “telephoneNumber.” 6. In the Management Agent Designer pane on the lefthand side, highlight Configure Attribute Flow. 7. In the Mapping Type section of the dialog, select Direct. 8. In the Flow Direction section of the dialog, select Import. 9. Ensure that “user” is selected in the data source object type drop-down list. 10. Ensure that “person” is selected in the metaverse object type drop-down list. 11. In the data source object type attribute list, select “telephoneNumber.” 12. In the metaverse object type attribute list, select “telephoneNumber.” 13. Click New. 14. Notice that in the Attribute Flow pane, the arrow for this mapping indicates an import attribute flow. Click OK. 15. In the Management Agents pane, double-click the SQL Server MA. 16. In the Management Agent Designer pane on the lefthand side, highlight Configure Attribute Flow. 17. In the Mapping Type section of the dialog, select Direct. 18. In the Flow Direction section of the dialog, select Export. 21.21. Enabling Directory Synchronization from Active Directory to the HR Database | 761
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
787
19. Ensure that “person” is selected in the data source object type drop-down list. 20. Ensure that “person” is selected in the metaverse object type drop-down list. 21. In the data source object type attribute list, select “telephoneNumber.” This assumes that the SQL Server database contains a field called “telephoneNumber.” 22. In the metaverse object type attribute list, select “telephoneNumber.” 23. Click New. 24. Notice that in the Attribute Flow pane, the arrow for this mapping indicates an export attribute flow. Click OK. Discussion You configured import attribute flow (IAF) from the AD MA to the metaverse and export attribute flow (EAF) to the SQL Server MA. Notice that these flows only dealt with attribute data. The object-level operations of projection and provisioning were not required because the objects already exist. To put the new configuration to work, you will need to configure run profiles to import, synchronize, and export the data. These steps are covered in Recipe 21.22. See Also Recipe 21.1; Recipe 21.22 21.22. Configuring a Run Profile to Load the telephoneNumber from Active Directory Problem You need to get the AD telephoneNumber attribute into FIM and synchronize it. 762 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
788
Solution Configure a run profile that combines import and synchronization as demonstrated in this recipe, and then execute it (see Recipe 21.23): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the AD MA. 4. In the Actions pane on the far-right side, click Configure Run Profiles. 5. In the Configure Run Profiles for “adatum.com” (the name in quotes will reflect the name you chose when creating the AD MA), click New Profile. 6. In the Name text box, type Delta Import and Delta Synchronization and then click Next. 7. Ensure that Delta Import and Delta Synchronization is selected in the Type drop￾down list and then click Next. 8. Ensure that the correct domain partition is showing in the Partition drop-down list and then click Finish. 9. Ensure that the details in the Step Details field look like Figure 21-12. Your partition name may be different, and the assumption is that you have completed the previous recipes. 10. Click OK. 21.22. Configuring a Run Profile to Load the telephoneNumber from Active Directory | 763
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
789
Figure 21-12. Dialog showing Delta Import and Delta Synchronization run profile add‐ ed to the existing AD MA run profiles Discussion Because a previous import step was completed in an earlier recipe, you can use the combined Delta Import and Delta Synchronization step so that FIM imports and syn‐ chronizes changes that have occurred in AD since the last time it connected. You can use this run profile from now on since it keeps track of changes internally using the DirSync control. The Delta Import (Stage Only) step in the AD Export run profile (the confirming import from Recipe 21.17) also imports changes, which suggests you could simply configure a delta synchronization run profile to process those changes in this recipe. Such an approach will work. The decision about which approach to use will depend on the service-level agreements you make. If it is two hours since the last AD import, your service-level agreement might force you to import and synchronize the changes that have occurred over the past two hours and feed them to the SQL Server database; how‐ ever, you may only need to export to AD every four hours. If you only rely on the changes detected in the confirming import step, you will only be able to update the SQL Server database with changes every four hours. 764 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
790
See Also Recipe 21.17; Recipe 21.23 for how to use the run profile configured in this recipe 21.23. Loading telephoneNumber Changes from AD into FIM Using a Delta Import/Delta Sync Run Profile Problem You need to pull the data from AD into FIM. Solution With the MA and run profile created, you can now load telephoneNumber attribute data into FIM by executing the run profile. In Recipe 21.1, (11) in Figure 21-6 shows the telephoneNumber data being loaded into the AD connector space. The synchronization process then flows the data to the met‐ averse ((6) in Figure 21-6) and from there to the AD connector space ((3) in Figure 21-6). 1. Open Active Directory Users and Computers. 2. Navigate to a user in the container you are managing with FIM. 3. Double-click the user object. 4. Ensure that the General tab is selected and then type a telephone number into the Telephone Number text box and click OK. 5. Open the Synchronization Service Manager. 6. Click the Management Agents button on the toolbar. 7. In the Management Agents pane, click the AD MA. 8. In the Actions pane on the far-right side, click Run. 9. In the Run Management Agent dialog, select Delta Import and Delta Synchroni‐ zation and click OK. 10. Because you have changed the rules but not yet run a full synchronization on all the existing objects, a Run Step Warning dialog appears, as shown in Figure 21-13. Click No. 11. Notice that the MA briefly says “Running” in the State column of the Management Agents pane. 21.23. Loading telephoneNumber Changes from AD into FIM Using a Delta Import/Delta Sync Run Profile | 765
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
791
Figure 21-13. Run Step Warning dialog box 12. Notice that the Synchronization Statistics pane in the bottom-lefthand corner dis‐ plays statistics showing the number of updates and connectors with flow updates. If you click one of the hyperlinks, you can navigate to the information that was loaded. Discussion The Run Step Warning dialog will pop up to annoy you any time you change any of the FIM rules or configuration settings. Even changing (adding, updating, or deleting) files in the Extensions directory will cause this warning to pop up on all run profile executions until every MA undergoes a full synchronization. This is done to force you into recon‐ ciling the state of every connector whenever there is a policy change. In this manner, FIM is one of the few Identity Management products that places such a serious emphasis on complete reconciliation and convergence of identity—often at the cost of some per‐ formance. If you ignore the warning, the updates will apply only to connectors processed by the run profile (in our case, only the records we changed). However, the warning will con‐ tinue to generate FIMSynchronizationService Event ID 6127 Warning messages in the Application Event log until you do so. This is also a cheap but effective method of monitoring for unscheduled changes to your FIM server. With respect to the telephoneNumber data that already exists in the connector space, that data won’t be subjected to those new rules. The warning is asking whether you’d like to apply the new rules to the existing objects. Essentially, you ignored the warning because if you have followed these recipes exactly, you should have only one new object in the AD MA’s connector space with a telephone number, and that is the only one that will be synchronized. 766 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
792
See Also Recipe 21.1; Recipe 21.18 for exporting objects to AD using an export run profile, which contains information about the confirming import (a Delta Import [Stage Only] step type) 21.24. Exporting telephoneNumber Data to a SQL Server Database Problem You need to export the data from a SQL Server MA connector space into a SQL Server database. Solution You need to configure and execute an export run profile. First, create the run profile: 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the SQL Server MA. 4. In the Actions pane on the far-right side, click Configure Run Profiles. 5. In the “Configure Run Profiles for” pane, click New Profile. 6. In the Name text box, type Export and then click Next. 7. Ensure that Export is selected in the Type drop-down list and then click Next. 8. Ensure that “default” is showing in the Partition drop-down list and then click Finish. 9. Click New Step. 10. In the Configure Step dialog, ensure that Full Import (Stage Only) is selected in the Type drop-down list and then click Next. 11. Ensure that “default” is selected in the Partition drop-down list and then click Finish. 12. Ensure that the details in the Step Details field look like Figure 21-14. 21.24. Exporting telephoneNumber Data to a SQL Server Database | 767
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
793
Figure 21-14. Export Run Profile added to the existing HR Database MA run pro‐ files 13. Click OK. Discussion You had to select Full Import (Stage Only) for the confirming import step in this run profile because the SQL Server MA hasn’t been configured to provide deltas. See Also Recipe 21.17 for similarities in how a run profile is configured to export objects to AD 21.25. Using a SQL Server MA Export Run Profile to Export the telephoneNumber to a SQL Server Database Problem The run profile is configured, but you need to actually move the data from FIM to a SQL Server database. 768 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
794
Solution You need to execute the run profile (refer to (12) in Figure 21-6, which shows the telephoneNumber data being exported to a SQL Server database): 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 3. In the Management Agents pane, click the SQL Server MA. 4. In the Actions pane on the far-right side, click Run. 5. In the Run Management Agent dialog, select Export and click OK. 6. Notice that the MA briefly says “Running” in the State column of the Management Agents pane. 7. Notice that in the Synchronization Statistics pane in the bottom-lefthand corner, statistics showing the number of updates are displayed. Discussion Now is a good time to add the last two run profiles you created to the controlling script in Recipe 21.20. Then we can make multiple changes to AD and the SQL Server database and watch the effects by simply running the script. We could even put a simple loop into the script so that it is executing continuously and watch new users, deleted users, and telephoneNumber change as they propagate around the systems. See Also Recipe 21.1; Recipe 21.18 for similarities in how a run profile is used to export objects to AD; Recipe 21.20 21.26. Searching Data in the Connector Space Problem You have started to use FIM, but things aren’t going according to plan. You want to see if the changes you made to either the SQL Server database or AD have made it into the associated connector space. Solution 1. Open the Synchronization Service Manager. 2. Click the Management Agents button on the toolbar. 21.26. Searching Data in the Connector Space | 769
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
795
3. In the Management Agents pane, click the MA you wish to search. 4. In the Actions pane on the far-right side, click Search Connector Space. 5. In the Search Connector Space dialog, click the Search button. You will notice records returned in the main search pane. If this is the SQL Server MA, the DN of each record will be the primary key in the database that ensures uniqueness in the record set. If this is the AD MA, the DN will be the object’s DN in LDAP format (e.g., cn=Steve Plank,OU=Users,DC=ada tum,DC=com). 6. Record the RDN of a record from the previous step. If it’s the SQL Server MA, the RDN is the same as the DN. If it’s the AD MA, it’s the element that contains the least-significant object in the DN (e.g., cn=Steve Plank). 7. Select RDN in the Scope drop-down list. 8. Type the RDN you have recorded into the text box (e.g., cn=Steve Plank). 9. Click Search. You will notice a single record returned, which matches the RDN you have specified. 10. If you double-click any of the returned records, you can examine the object in detail. Discussion You will see in the Scope drop-down list that there are more entries than just Subtree and RDN. The error collections are useful when trying to debug records that give errors from a large connector space with many thousands of objects in it. We find it particularly useful to use the Pending Export scope to look at outbound changes whenever we are performing a change to a production system. The Pending Export scope allows you to filter additionally by selecting Add, Modify, or Delete to include in the result set. It’s very reassuring to verify that there are no delete operations pending when you make a new change. Also, once you have double-clicked a record and are viewing its properties, you will notice a Lineage tab at the top of the page. On it, there is a Metaverse Object Properties button. This will show you the properties held on the related metaverse object as well as when the last change was imported from the connected directory. Validating when the last change was seen by FIM can be extremely helpful when troubleshooting why FIM didn’t process a change. See Also Recipe 21.27 for searching data in the metaverse; MSDN: How to: Find Specified Con‐ nector Space Objects 770 | Chapter 21: Microsoft Forefront Identity Manager
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf