{"id":79,"date":"2018-11-14T03:10:43","date_gmt":"2018-11-14T03:10:43","guid":{"rendered":"https:\/\/www.aladan.net\/MIMicry\/?p=79"},"modified":"2018-11-19T03:19:08","modified_gmt":"2018-11-19T03:19:08","slug":"unifybroker-based-ad-provisioning-model","status":"publish","type":"post","link":"https:\/\/www.aladan.net\/MIMicry\/2018\/11\/14\/unifybroker-based-ad-provisioning-model\/","title":{"rendered":"UNIFYBroker-based AD Provisioning Model"},"content":{"rendered":"<h2><u>Background<\/u><\/h2>\n<p>The UNIFYBroker-based Active Directory provisioning model uses a Powershell connector in Broker to action \u201conce-off\u201d operations for an AD user account, such as:<\/p>\n<ul>\n<li>Account creation<\/li>\n<li>Account deletion<\/li>\n<li>Mailbox enable\/disable<\/li>\n<\/ul>\n<p>The Broker Powershell connector has the following configuration components:<\/p>\n<ul>\n<li>\u201cImport All\u201d \u2013 e.g. pre-load all existing users from AD<\/li>\n<li>\u201cImport Changes\u201d \u2013 e.g. identity and load newly created users from AD, and remove any deleted users from AD<\/li>\n<li>\u201cAdd Entities\u201d \u2013 called when a new user record is created in MIM, to trigger and perform creation of the required AD account<\/li>\n<li>\u201cUpdate Entities\u201d \u2013 called when user attributes are updated in MIM, to trigger any required actions (such as enable\/disabling an exchange mailbox)<\/li>\n<li>\u201cDelete Entities\u201d \u2013 called when a user record is deleted in MIM, to trigger and perform deletion of the corresponding AD account<\/li>\n<\/ul>\n<p>The Powershell connector can also be used for AD objects other than users.<\/p>\n<h2><u>[CUSTOMERX] Solution<\/u><\/h2>\n<p>A key element of the user lifecycle at [CUSTOMERX] is the \u201cIdentity State\u201d of each user, which is derived from various user attributes (e.g. HR contract start date, manual disable flag, user last login timestamp, etc) and drives the values of various other attributes (e.g. AD Distinguished Name, account disable\/enable state, exchange mailbox enable\/disable, etc).\u00a0 There are similar attributes (\u201cGroup State\u201d and \u201cContact State\u201d) for AD groups and AD mail contacts.<\/p>\n<p>The following documents the specific actions performed by Broker connectors:<\/p>\n<h3>AD User connector<\/h3>\n<ul>\n<li>Import All: load all user objects from AD (Get-ADUser command)<\/li>\n<li>Import Changes: identity new and deleted user objects in AD (Get-ADObject command)<\/li>\n<li>Add Entities: create AD user account (New-ADUser command)<\/li>\n<li>Update Entities: depending on the Identity State attribute (from MIM), enable or disable the user\u2019s exchange mailbox (enable-mailbox and disable-mailbox commands via a remote PSSession to the Exchange server)<\/li>\n<li>Delete Entities: delete AD user account (Remove-ADObject command)<\/li>\n<\/ul>\n<h3>AD Group connector<\/h3>\n<ul>\n<li>Import All: load all group objects from AD (Get-ADGroup command)<\/li>\n<li>Import Changes: identity new and deleted group objects in AD (Get-ADObject command)<\/li>\n<li>Add Entities: create AD group object (New-ADGroup command)<\/li>\n<li>Update Entities: depending on the Group State attribute (from MIM), hide or show the group\u2019s address in the GAL (Set-DistributionGroup command via a remote PSSession to the Exchange server)<\/li>\n<li>Delete Entities: delete AD group object (Remove-ADObject command)<\/li>\n<\/ul>\n<h3>AD Contact connector<\/h3>\n<ul>\n<li>Import All: load all contact objects from AD (Get-ADObject command)<\/li>\n<li>Import Changes: identity new and deleted contact objects in AD (Get-ADObject command)<\/li>\n<li>Add Entities: create AD contact object (New-ADObject command)<\/li>\n<li>Update Entities: depending on the Contact State attribute (from MIM), mail enable the contact object (Set-MailContact command via a remote PSSession to the Exchange server)<\/li>\n<li>Delete Entities: delete AD contact object (Remove-ADObject command)<\/li>\n<\/ul>\n<p>These three Broker connectors each have a corresponding Broker adapter, but share one \u201cProvisioning\u201d MA within MIM.\u00a0 Please refer to the Provisioning MA configuration and the Powershell connector implementation for important aspects of the solution (e.g. required minimum attributes that must be exported from MIM for use when creating the various AD objects).<\/p>\n<h2><u>Issues Encountered and Key Learnings<\/u><\/h2>\n<p>The following important lessons were learned during implementation.<\/p>\n<p>\u201cImport All\u201d cannot be treated as a periodic baseline as per our normal MIM best practices, because when run it resets (nulls) all connector attribute values other than those it sets directly.\u00a0 This means that the next MIM export operation (after a MIM full import\/sync to identify that the attributes have been cleared \u2013 and not a delta import\/sync as this does not notify MIM of the changes) will have to restore all export attribute values (i.e. Identity\/Group\/Contact State, in the [CUSTOMERX] case) and this will re-trigger any \u201cUpdate Entities\u201d code for all objects (i.e. attempt to re-enable or re-disable every user\u2019s exchange mailbox, in the [CUSTOMERX] case).<\/p>\n<p>\u201cImport Changes\u201d functionality must be implemented and cannot be set to \u201cNone\u201d.\u00a0 Following on from the previous paragraph, because regular baselining of the connector is problematical and best avoided an incremental synchronisation method is needed to keep the connector in sync with the source AD data.\u00a0 If this is omitted then objects that are created directly in AD by other systems will not be visible in the connector (and consequently won\u2019t be created in the MIM \u201cProvisioning\u201d MA, leading to failed provisioning requests from MIM when the attempt is made to create the already-existing AD object).<\/p>\n<p>The default timeout for MIM export profile runs to ECMA2 connectors such as Broker is 60 seconds, and the default batch size is 5,000 objects.\u00a0 At [CUSTOMERX], Broker was unable to process requests from MIM fast enough, leading to timeouts which manifest in MIM as \u201ccd-error\u201d errors on each exported object with no other useful information logged anywhere.\u00a0 Therefore it is highly recommended that the timeout be significantly increased.\u00a0 It may also be effective to decrease the batch size, but this approach was not tested and is therefore unconfirmed.<\/p>\n<p>Errors during export (e.g. problems during the development of the Broker Powershell connector code, or transient errors when executing commands from the Broker Powershell connector code) cause MIM to report errors against exported objects, even though Broker may actually correctly save the updated value of that attribute.\u00a0 If a subsequent export attempt is made then Broker returns an \u201cOther\u201d error on the second export attempt, with error default \u201cInternal error #9 (Cannot add value)\u201d.\u00a0 Debugging this situation and identifying what is causing it to occur can be difficult, since it only occurs on a second export after a previous error has been encountered, for a different reason.\u00a0 Consequently it is recommended that all Broker powershell \u201cUpdate Entities\u201d code must include error-checking and be wrapped in exceptions handling and use the Failed Operations mechanism (\u201c$components.Failures.Push($entity)\u201d) to correctly record operation failures.\u00a0 Refer to the Broker Powershell connector documentation for details of this mechanism.\u00a0 It is arguably a bug in Broker that it fails to correctly handle the second export\u2019s attribute update.<\/p>\n<p>When using PSSessions in the Powershell connector to perform operations remotely, be sure to call Remove-PSSession to free the session as soon as it is no longer required.\u00a0 Failure to do so may contribute to Broker misbehaviour, although this is unconfirmed.<\/p>\n<h2><u>Quick Guide to Common MIM Export Errors<\/u><\/h2>\n<p>\u201ccd-error\u201d with no other details \u2013 a timeout from the MIM side.\u00a0 Increase the export profile\u2019s timeout (\u201cOperation Timeout (s)\u201d on the third screen of the Run Profile wizard \u2013 NOT the Custom Data \u201cTimeout (seconds)\u201d on the second)<\/p>\n<p>\u201cOther\u201d Internal error #9 (Cannot add value) \u2013 a previous export failed and Broker updated the attribute but reported the error back to MIM, which retries the export and confuses Broker which has already saved a value to this attribute.<\/p>\n<p>If you are having other errors during export, remove your powershell code altogether and leave just a empty stub in place that does nothing (not even load a blank external script).\u00a0 Try running your entire export (full data set) and make sure it works correctly first.\u00a0 Then try some delta exports (just a few records) and make sure they work.\u00a0 Once you&#8217;re sure you have that mechanism working correctly, but your code back in gradually &#8211; add functionality bit by bit, making sure you do both the entire export (full data set) and the the delta export (just a few records) each time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Background The UNIFYBroker-based Active Directory provisioning model uses a Powershell connector in Broker to action \u201conce-off\u201d operations for an AD user account, such as: Account creation Account deletion Mailbox enable\/disable The Broker Powershell connector has the following configuration components: \u201cImport All\u201d \u2013 e.g. pre-load all existing users from AD \u201cImport Changes\u201d \u2013 e.g. identity and<span class=\"post-excerpt-end\">&hellip;<\/span><\/p>\n<p class=\"more-link\"><a href=\"https:\/\/www.aladan.net\/MIMicry\/2018\/11\/14\/unifybroker-based-ad-provisioning-model\/\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,10,6,11,7,16],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-bad","category-design-patterns","category-howto","category-learnings","category-sync","category-unifybroker"],"_links":{"self":[{"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":4,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"predecessor-version":[{"id":99,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/posts\/79\/revisions\/99"}],"wp:attachment":[{"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}