<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Mark Renoden’s Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/markrenoden/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/markrenoden/feed.xml</link>
    <description>My contribution to the thought bubble</description>
    <lastBuildDate>Thu, 21 Jun 2018 03:38:16 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>AD FS 2016 and Azure MFA - a few Nuances</title>
      <link>https://docs.microsoft.com/archive/blogs/markrenoden/ad-fs-2016-and-azure-mfa-a-few-nuances</link>
      <pubDate>Wed, 20 Jun 2018 13:14:24 GMT</pubDate>
      <dc:creator><![CDATA[Mark Renoden]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/markrenoden/?p=2525</guid>
      <description><![CDATA[I was recently helping a colleague with AD FS 2016 and Azure MFA integration, specifically in-line...]]></description>
      <content:encoded><![CDATA[<p>I was recently helping a colleague with AD FS 2016 and Azure MFA integration, specifically in-line proof up of users. Working through this, there were a few points of confusion that we were able to clear up and I wanted to share these here</p> <p><strong><font color="#000080">Background</font></strong></p> <p>Before I go any further, there are a few things I want to lay out that will be important later. Refer to the following</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/06/Relying-Parties.png"><img title="Relying Parties" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Relying Parties" src="https://msdnshared.blob.core.windows.net/media/2018/06/Relying-Parties_thumb.png" width="404" height="224"></a></p> <p>This diagram is somewhat simplified but captures the key aspects that are important to this discussion -</p> <p>1. Cloud applications and services have a relying-party trust with Azure Active Directory (Azure AD). This includes Azure subscriptions (the administration portal), Office 365 (O365) and other SaaS applications</p> <p>2. When your Azure AD tenant is federated with on-premises AD FS, there is a relying-party trust (RPT) between your tenant and your AD FS farm. This relying-party trust is named "Microsoft Office 365 Identity Platform". This is sometimes confusing for folks because they think it means O365. It doesn't, it means that the Azure AD tenant trusts the authentication mechanisms of the AD FS farm. Furthermore, any authentication requirement that you apply to the "Microsoft Office 365 Identity Platform" RPT will be enforced for all applications and services that have an RPT with Azure AD (you authenticate against AD FS before you pass back via Azure AD to the application)</p> <p>3. You may (or may not) have other claims-aware applications that have a relying-party trust directly with AD FS. Typically, these would be hosted on-premises or may be third-party applications that are not integrated with Azure AD</p> <p><strong><font color="#000080">Using Azure MFA</font></strong></p> <p>Referring to the diagram, there are two places where Azure MFA may be enforced -</p> <p>1. At Azure AD - preferably using Conditional Access (CA) Policy which you can read more about here - <a title="https://aka.ms/ConditionalAccessDeploymentPlan" href="https://aka.ms/ConditionalAccessDeploymentPlan">https://aka.ms/ConditionalAccessDeploymentPlan</a>. CA allows you to configure different requirements for different applications and users. Requiring MFA is one of them. Taking this approach provides the most granular control</p> <p>2. At AD FS. Taking this approach offers some granular control but generally speaking, you want to avoid using MFA against the "Microsoft Office 365 Identity Platform" RPT because enforcing it here, enforces it for all applications and services that are relying-parties to Azure AD. The real purpose of integrating Azure MFA with AD FS is to provide stronger authentication for your other AD FS relying-parties. To configure AD FS 2016 with Azure MFA, refer to <a href="https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/configure-ad-fs-and-azure-mfa">https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/configure-ad-fs-and-azure-mfa</a></p> <p>For more guidance deploying Azure MFA, refer to the deployment plan here - <a title="https://aka.ms/MFADeploymentPlan" href="https://aka.ms/MFADeploymentPlan">https://aka.ms/MFADeploymentPlan</a></p> <p><strong><font color="#000080">Azure MFA Proof Up</font></strong></p> <p>I'm finally ready to discuss the core point of this post.</p> <p>When Azure MFA is enforced in the Azure AD tenant, either directly or via a Conditional Access Policy, users who have not yet signed up for Azure MFA (chosen their authentication options and provided their mobile phone number) are directed to <a href="https://account.activedirectory.windowsazure.com/Proofup.aspx">https://account.activedirectory.windowsazure.com/Proofup.aspx</a> where they can set this up. This is a requirement at the first sign-in whether CA or direct assignment (which is no longer recommended) is used.</p> <p>When Azure MFA is enforced against an AD FS relying-party, this redirect does not take place automatically. The following customization needs to be made (I assume here that your AD FS deployment is using the Default ADFS Web Theme)</p> <p>1. Open a PowerShell prompt on your Primary AD FS server and create a new AD FS Web Theme by executing<br><strong><font color="#008000" face="Consolas">New-AdfsWebTheme –Name ProofUp –SourceName default</font></strong><br>2. Export the default AD FS Web Theme by executing<br><strong><font color="#008000" face="Consolas">Export-AdfsWebTheme –Name default –DirectoryPath c:\theme </font></strong><br>3. Open the C:\Theme\script\onload.js file in a text editor<br>4. Append the following code to the end of the onload.js file<br></p><pre class="brush: js; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">//Custom Code
//Customize MFA exception
//Begin

var domain_hint = "&lt;YOUR_DOMAIN_NAME_HERE&gt;";
var mfaSecondFactorErr = "The selected authentication method is not available for";
var mfaProofupMessage = "You will be automatically redirected in 5 seconds to set up your account for additional security verification. Once you have completed the setup, please return to the application you are attempting to access.&lt;br&gt;&lt;br&gt;If you are not redirected automatically, please click &lt;a href='{0}'&gt;here&lt;/a&gt;."
var authArea = document.getElementById("authArea");
if (authArea) {
    var errorMessage = document.getElementById("errorMessage");
    if (errorMessage.innerHTML.indexOf(mfaSecondFactorErr) &gt;= 0) {

    //Hide the error message
        var openingMessage = document.getElementById("openingMessage");
        if (openingMessage) {
            openingMessage.style.display = 'none'
        }
        var errorDetailsLink = document.getElementById("errorDetailsLink");
        if (errorDetailsLink) {
            errorDetailsLink.style.display = 'none'
        }

        //Provide a message and redirect to Azure AD MFA Registration Url
        var mfaRegisterUrl = "https://account.activedirectory.windowsazure.com/proofup.aspx?proofup=1&amp;whr=" + domain_hint;
        errorMessage.innerHTML = "&lt;br&gt;" + mfaProofupMessage.replace("{0}", mfaRegisterUrl);
        window.setTimeout(function () { window.location.href = mfaRegisterUrl; }, 5000);
    }
}

//End Customize MFA Exception
//End Custom Code
</pre>
<p>Note that you need to change <strong><font color="#008000" face="Consolas">"&lt;YOUR_DOMAIN_NAME_HERE&gt;";</font></strong> to use your domain name. For example</p>
<p><strong><font color="#008000" face="Consolas">var domain_hint = "contoso.com";</font></strong></p>
<p>5. Save the onload.js file<br>6. Import the onload.js file into your custom theme by executing the following at the PowerShell prompt<br><font color="#008000" face="Consolas"><strong>Set-AdfsWebTheme -TargetName ProofUp -AdditionalFileResource @{Uri=’/adfs/portal/script/onload.js’;path="c:\theme\script\onload.js"}</strong></font><br>7. Apply the custom AD FS Web Theme by executing<br><font color="#008000" face="Consolas"><strong>Set-AdfsWebConfig -ActiveThemeName</strong></font></p>
<p>Following these steps, users who are required to use Azure MFA against an AD FS relying-party but who have not registered for Azure MFA will be redirected to the proof up page -</p>
<p>Redirect -</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/06/RedirectMessage.png"><img title="RedirectMessage" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="RedirectMessage" src="https://msdnshared.blob.core.windows.net/media/2018/06/RedirectMessage_thumb.png" width="244" height="160"></a></p>
<p>Proof Up -</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/06/ProofUp.png"><img title="ProofUp" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="ProofUp" src="https://msdnshared.blob.core.windows.net/media/2018/06/ProofUp_thumb.png" width="244" height="203"></a></p>
<p><strong><font color="#ff0000">IMPORTANT:</font></strong> If you have gone against the recommendation I made earlier - to avoid MFA on the "Microsoft Office 365 Identity Platform" relying-party trust, users will not be able to access the proof up page. This is because the proof up page is a relying-party to Azure AD and by requiring MFA on the "Microsoft Office 365 Identity Platform" relying-party trust, you create a chicken-and-egg scenario</p>]]></content:encoded>
    </item>
    <item>
      <title>New Role for Me!</title>
      <link>https://docs.microsoft.com/archive/blogs/markrenoden/new-role-for-me</link>
      <pubDate>Wed, 20 Jun 2018 09:00:57 GMT</pubDate>
      <dc:creator><![CDATA[Mark Renoden]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/markrenoden/?p=2455</guid>
      <description><![CDATA[It's been a while since I last posted. This is largely due to a change in role. I've moved out of...]]></description>
      <content:encoded><![CDATA[<p>It's been a while since I last posted. This is largely due to a change in role. I've moved out of Microsoft Services (as a Premier Field Engineer) and into the Azure Active Directory Product Group. Moving forward I'm a Program Manager in the Azure Active Directory Get to Production team where we focus on helping larger customers with their cloud identity journey, providing advice and guidance, and acting as the customer voice back to the engineering team.</p> <p>I'm not sure how much this new role will lead to blog posts but if I have something worth sharing, you'll still find it here.</p>]]></content:encoded>
    </item>
    <item>
      <title>Identify ADMX/ADML Files used by Group Policies</title>
      <link>https://docs.microsoft.com/archive/blogs/markrenoden/identify-admxadml-files-used-by-group-policies</link>
      <pubDate>Thu, 11 Jan 2018 11:54:54 GMT</pubDate>
      <dc:creator><![CDATA[Mark Renoden]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/markrenoden/?p=2445</guid>
      <description><![CDATA[The Problem Group Policy ADMX versioning has caused a few concerns for Microsoft customers in the...]]></description>
      <content:encoded><![CDATA[<p><font color="#000080" size="2"><strong>The Problem</strong></font></p> <p>Group Policy ADMX versioning has caused a few concerns for Microsoft customers in the past one to two years. A great description of the issue and how to address it is found <a href="https://blogs.technet.microsoft.com/grouppolicy/2016/10/12/admx-version-history/">here</a>.</p> <p>Recently, one of my customers wanted to identify the ADMX files referenced by Group Policies deployed in their domain so that they could carefully update the ADMX/ADML central store in SYSVOL. This isn't entirely easy because the ADMX file is not used when the GPO is applied to a computer or user.</p> <p><font color="#000080" size="2"><strong>Further Explanation</strong></font></p> <p>The ADMX/ADML file combination may be thought of as the description language that instructs the Group Policy editor. The Group Policy editor shows the policy settings, policy descriptions, drop down boxes and radio buttons that the ADMX/ADML files tell it to. Configuring a policy setting results in the Group Policy editor making changes to a .pol (or other) file in SYSVOL that is ultimately applied to the computer or user.</p> <p>When you generate a Group Policy report, all of the ADMX and ADML files are read and compared with the policy settings stored in SYSVOL. This information is then glued together by the report generator and output as either HTML or XML. No record of the ADML/ADML files required for the report is kept.</p> <p><font color="#000080" size="2"><strong>The Solution</strong></font></p> <p>I managed to construct a PowerShell script that consumes an XML-based GPO Report, parses out all of the settings, reads the ADML store specified in the script and matches settings to ADMLs. ADML file names correspond to ADMX file names used by the Group Policy editor. The output is a CSV (also specified in the script) that looks similar to -</p> <table cellspacing="0" cellpadding="2" width="767" border="1"> <tbody> <tr> <td valign="top" width="102">gpoName</td> <td valign="top" width="105">settingScope</td> <td valign="top" width="327">settingName</td> <td valign="top" width="231">admlFile</td></tr> <tr> <td valign="top" width="102">PolicyA</td> <td valign="top" width="105">Computer</td> <td valign="top" width="327">Site to Zone Assignment List</td> <td valign="top" width="231">InetRes.adml</td></tr> <tr> <td valign="top" width="102">PolicyB</td> <td valign="top" width="105">User</td> <td valign="top" width="327">Allow DFS roots to be published</td> <td valign="top" width="231">SharedFolders.adml</td></tr> <tr> <td valign="top" width="102">PolicyA</td> <td valign="top" width="105">User</td> <td valign="top" width="327">Add Logoff to the Start Menu</td> <td valign="top" width="231">StartMenu.adml</td></tr> <tr> <td valign="top" width="102">PolicyA</td> <td valign="top" width="105">Computer</td> <td valign="top" width="327">Show lock in the user tile menu</td> <td valign="top" width="231">WindowsExplorer.adml</td></tr> <tr> <td valign="top" width="102">PolicyC</td> <td valign="top" width="105">Computer</td> <td valign="top" width="327">Allow remote server management through WinRM</td> <td valign="top" width="231">WindowsRemoteManagement.adml</td></tr> <tr> <td valign="top" width="102">PolicyD</td> <td valign="top" width="105">Computer</td> <td valign="top" width="327">Register domain joined computers as devices</td> <td valign="top" width="231">WorkplaceJoin.adml</td></tr></tbody></table> <p>&nbsp;</p> <p>The script assumes a language match between the GPO Report and the ADML file path provided in the script and has a dependency on the Group Policy PowerShell module.</p> <p>If you wish to use the following code, redefine <strong><font color="#008000">&lt;OUTPUT_PATH&gt;</font></strong> and <strong><font color="#008040">&lt;FULLY_QUALIFIED_DOMAIN_NAME&gt;</font></strong> according to your own environment (I know I could have parameterised this but I'm lazy and this is just a sample).</p> <p>Also note that something whacky is going on with the source code plugin colour formatting below. I can't work it out but the script still works …</p> <p><font color="#000080" size="2"><strong>The Script</strong></font></p><pre class="brush: powershell; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"># Define results file
$results = "&lt;OUTPUT PATH&gt;\Results.csv"

# Define PolicyDefinition ADML Folder
$policyDefs = "\\&lt;FULLY_QUALIFIED_DOMAIN_NAME&gt;\SYSVOL\&lt;FULLY_QUALIFIED_DOMAIN_NAME&gt;\Policies\PolicyDefinitions\en-US"

# Generate a GPO report and capture it as XML
[xml]$GPOs = Get-GPOReport -All -ReportType Xml

# Parse captured XML
$policyInfo = @()

for ($i = 0; $i -lt ($GPOs.DocumentElement.GPO.Count); $i++)
{ 
    #Process Computer Policy
    for ($j = 0; $j -lt $GPOs.DocumentElement.GPO[$i].Computer.ExtensionData.ChildNodes.Count; $j++)
    { 
        if (($GPOs.DocumentElement.GPO[$i].Computer.ExtensionData.ChildNodes[$j].type) -like "*:RegistrySettings")
        {
            if (!($GPOs.DocumentElement.GPO[$i].Computer.ExtensionData.ChildNodes[$j].Policy.Count -eq $null))
            {
                for ($k = 0; $k -lt $GPOs.DocumentElement.GPO[$i].Computer.ExtensionData.ChildNodes[$j].Policy.Count; $k++)
                { 
                    $polInfo = "" | Select-Object gpoName, settingScope, settingName
                    $polInfo.gpoName = $GPOs.DocumentElement.GPO[$i].Name
                    $polInfo.settingScope = "Computer"
                    $polInfo.settingName = $GPOs.DocumentElement.GPO[$i].Computer.ExtensionData.ChildNodes[$j].Policy[$k].Name
                    $policyInfo += $polInfo
                }
            }
            else
            {
                $polInfo = "" | Select-Object gpoName, settingScope, settingName
                $polInfo.gpoName = $GPOs.DocumentElement.GPO[$i].Name
                $polInfo.settingScope = "Computer"
                $polInfo.settingName = $GPOs.DocumentElement.GPO[$i].Computer.ExtensionData.ChildNodes[$j].Policy.Name
                $policyInfo += $polInfo
            }
        }
    }
    #Process User Policy
    for ($j = 0; $j -lt $GPOs.DocumentElement.GPO[$i].User.ExtensionData.ChildNodes.Count; $j++)
    { 
        if (($GPOs.DocumentElement.GPO[$i].User.ExtensionData.ChildNodes[$j].type) -like "*:RegistrySettings")
        {
            if (!($GPOs.DocumentElement.GPO[$i].User.ExtensionData.ChildNodes[$j].Policy.Count -eq $null))
            {
                for ($k = 0; $k -lt $GPOs.DocumentElement.GPO[$i].User.ExtensionData.ChildNodes[$j].Policy.Count; $k++)
                { 
                    $polInfo = "" | Select-Object gpoName, settingScope, settingName
                    $polInfo.gpoName = $GPOs.DocumentElement.GPO[$i].Name
                    $polInfo.settingScope = "User"
                    $polInfo.settingName = $GPOs.DocumentElement.GPO[$i].User.ExtensionData.ChildNodes[$j].Policy[$k].Name
                    $policyInfo += $polInfo
                }
            }
            else
            {
                $polInfo = "" | Select-Object gpoName, settingScope, settingName
                $polInfo.gpoName = $GPOs.DocumentElement.GPO[$i].Name
                $polInfo.settingScope = "User"
                $polInfo.settingName = $GPOs.DocumentElement.GPO[$i].User.ExtensionData.ChildNodes[$j].Policy.Name
                $policyInfo += $polInfo
            }
        }
    }
}

# Define output array
$admlFileUsage = @()

# Search ADML files for policy settings
$admlFiles = Get-ChildItem -Path $policyDefs -Filter *.adml

foreach ($admlFile in $admlFiles)
{
    $admlContent = (Get-Content -Path ($admlFile.FullName))
    $out = "" | Select-Object gpoName, settingScope, settingName, admlFile
    foreach ($polInfo in $policyInfo)
    {
        $settingName = $polInfo.settingName
        if ($admlContent -like "*$settingName*")
        {
            $out.gpoName = $polInfo.gpoName
            $out.settingScope = $polInfo.settingScope
            $out.settingName = $polInfo.settingName
            $out.admlFile = $admlFile.Name
            $admlFileUsage += $out
        }
    }
}

$admlFileUsage | Export-Csv -Path $results -NoTypeInformation -Force
</pre>
<p><font color="#000080" size="2"><strong>Conclusion</strong></font></p>
<p>I hope that this script serves as a useful example for others to build upon. As I've only used this script in a test lab with a small number of Group Policy objects, it's entirely possible I've overlooked something. If you identify a problem or see room for improvement, I'd be happy to take the feedback.</p></td></tr>]]></content:encoded>
    </item>
    <item>
      <title>Authoritative Restore of SYSVOL after Deallocation of Azure DCs</title>
      <link>https://docs.microsoft.com/archive/blogs/markrenoden/authoritative-restore-of-sysvol-after-deallocation-of-azure-dcs</link>
      <pubDate>Tue, 07 Nov 2017 11:21:59 GMT</pubDate>
      <dc:creator><![CDATA[Mark Renoden]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/markrenoden/?p=2435</guid>
      <description><![CDATA[The Problem If you run an isolated lab in Azure IaaS with more than one Domain Controller and are in...]]></description>
      <content:encoded><![CDATA[<p><font color="#000080" size="2"><strong>The Problem</strong></font></p> <p><font size="2">If you run an isolated lab in Azure IaaS with more than one Domain Controller and are in the habit of shutting down and de-allocating the VMs to save money, you may have found that SYSVOL doesn’t replicate when you start them back up.</font> <p><font color="#000080" size="2"><strong>The Cause</strong></font> <p><font size="2">De-allocation/re-allocation of a VM changes the VM generation ID and Active Directory forces a safe recovery on restart. The problem with safe recovery in an isolated Azure IaaS lab is that no DC is authoritative.</font> <p><font color="#000080" size="2"><strong>The Solution</strong></font> <p><font size="2">A manual authoritative restore of DFSR SYSVOL is required using steps outlined in <a href="https://support.microsoft.com/en-us/help/2218556/how-to-force-an-authoritative-and-non-authoritative-synchronization-fo">KB2218556</a>.</font> <p><font color="#000080" size="2"><strong>The Whinge</strong></font> <p><font size="2">I’m fed up with doing this so wrote a PowerShell script</font> <p><font color="#000080" size="2"><strong>The Script</strong></font></p><pre class="brush: powershell; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"># Get the list of all DCs in the local domain
$domainControllers = Get-ADDomainController -Filter *

# Use the first DC in the list as the primary member for DFSR
# If a specific DC is preferred, use Get-ADDomainController -Identity &lt;DC_Hostname&gt;
$primaryDC = $domainControllers[0]

# Stop DFSR on all DCs
foreach ($dc in $domainControllers)
{
    Invoke-Command -ComputerName $dc.HostName -ScriptBlock {Stop-Service DFSR}
}

# Modify DFSR subscription object to disable the SYSVOL replica in AD and replicate it
foreach ($dc in $domainControllers)
{
    $sysvolSubscriptionObject = "CN=SYSVOL Subscription,CN=Domain System Volume,CN=DFSR-LocalSettings," + $dc.ComputerObjectDN
    Get-ADObject -Identity $sysvolSubscriptionObject | Set-ADObject -Server $primaryDC -Replace @{"msDFSR-Enabled"=$false}
    Get-ADDomainController -filter * | foreach {Sync-ADObject -Object $sysvolSubscriptionObject -Source $primaryDC -Destination $_.hostname}
}

# Start and then stop DFSR on all DCs
foreach ($dc in $domainControllers)
{
    Invoke-Command -ComputerName $dc.HostName -ScriptBlock {Start-Service DFSR}
    Start-Sleep -Seconds 20
    Invoke-Command -ComputerName $dc.HostName -ScriptBlock {Stop-Service DFSR}
}

# Modify DFSR subscription to enable the SYSVOL replica in AD and set the primary
# Force replication of these changes
$sysvolSubscriptionObject = "CN=SYSVOL Subscription,CN=Domain System Volume,CN=DFSR-LocalSettings," + $primaryDC.ComputerObjectDN
Get-ADObject -Identity $sysvolSubscriptionObject | Set-ADObject -Server $primaryDC -Replace @{"msDFSR-Options"=1}

foreach ($dc in $domainControllers)
{
    $sysvolSubscriptionObject = "CN=SYSVOL Subscription,CN=Domain System Volume,CN=DFSR-LocalSettings," + $dc.ComputerObjectDN
    Get-ADObject -Identity $sysvolSubscriptionObject | Set-ADObject -Server $primaryDC -Replace @{"msDFSR-Enabled"=$true}
    Get-ADDomainController -filter * | foreach {Sync-ADObject -Object $sysvolSubscriptionObject -Source $primaryDC -Destination $_.hostname}
}

# Start DFSR on all DCs
foreach ($dc in $domainControllers)
{
    Invoke-Command -ComputerName $dc.HostName -ScriptBlock {Start-Service DFSR}
}</pre>
<p><font color="#000080" size="2"><strong>The Warning</strong></font>
<p><font size="2">I’d caution against setting this as a scheduled task or anything too creative. You really do want all DCs booted and running before you do this</font>
<p><font color="#000080" size="2"><strong>The Conclusion</strong></font>
<p><font size="2">Hopefully it’s useful to some</font>]]></content:encoded>
    </item>
    <item>
      <title>Choosing a sourceAnchor for Groups in Multi-Forest Sync with AAD Connect</title>
      <link>https://docs.microsoft.com/archive/blogs/markrenoden/choosing-a-sourceanchor-for-groups-in-multi-forest-sync-with-aad-connect</link>
      <pubDate>Fri, 13 Oct 2017 10:07:04 GMT</pubDate>
      <dc:creator><![CDATA[Mark Renoden]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/markrenoden/?p=2275</guid>
      <description><![CDATA[Introduction Earlier this year I authored a post discussing choices for sourceAnchor in Multi-Forest...]]></description>
      <content:encoded><![CDATA[<p><font color="#0000a0" size="2"><strong>Introduction</strong></font></p> <p><font size="2">Earlier this year I authored a <a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-1-introduction/">post discussing choices for sourceAnchor in Multi-Forest Sync with AAD Connect</a>. Following that series, the Azure Active Directory Product Group included sync rules that use <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> as the <strong><font color="#008000">sourceAnchor</font></strong> for user objects. This was great because it all works out of the box and as an added bonus, there's an action that migrates you from <strong><font color="#008000">objectGUID</font></strong> to <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> built into the AAD Connect wizard.</font></p> <p><font size="2">Recently, I was working with a customer who was migrating between Forests. These latest changes work terrifically well for user objects but on the current build of AAD Connect (1.1.614.0), the sync rules for Groups do not use <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong>. This means, that for groups, you're right back at square one (refer to the earlier series <a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-1-introduction/">Introduction</a> for background information).</font></p> <p><font size="2">In this post, I'll walk through the setup for custom sync rules so that groups migrate cleanly between Forests and continue to sync with Azure Active Directory without duplication.</font></p> <p><font color="#0000a0" size="2"><strong>Preparation</strong></font></p> <p><font size="2">Pause the sync service by opening a PowerShell prompt and executing</font></p> <p><b><font color="#991e93" size="2" face="Consolas">Set-ADSyncScheduler -SchedulerSuspended $true</font></b></p> <p><font size="2">Open <b>"C:\Program Files\Microsoft Azure AD Sync\UIShell\SyncRulesEditor.exe"</b></font></p> <p><font size="2">Observe the lowest precedence built-in inbound sync rule (<b><font color="#008000">100</font></b> in this example) –</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image002.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0021.gif"><img title="clip_image002" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image002_thumb1.gif" width="404" height="314"></a></font></a></p> <p><font size="2">Observe the built-in inbound sync rules for Groups, two of each type for each Forest (4 in this example) –</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image004.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0041.gif"><img title="clip_image004" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image004" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image004_thumb1.gif" width="404" height="314"></a></font></a></p> <p><font size="2">You’ll need to duplicate each of these rules and modify the properties. You’ll set the precedence of the duplicated rules to be lower than the lowest value observed (<b><font color="#008000">100</font></b> in this example)</font></p> <p><font color="#0000a0" size="2"><strong>Creating Custom Join Rules for Groups</strong></font></p> <p><font size="2">Select the first <b><font color="#991e93">In from AD -Group Join</font></b> rule and click <b><font color="#991e93">Edit</font></b></font></p> <p><font size="2">Click <font color="#991e93"><strong>Yes</strong></font> at the Edit Reserved Rule Confirmation</font></p> <p><font size="2">Change <b><font color="#991e93">Description</font></b> to something like <b><font color="#008000">In from AD – Group Join Custom</font></b>, the <b><font color="#991e93">Precedence</font></b> to 4 less than the number observed earlier (<b><font color="#008000">96</font></b> in this example) and click <b><font color="#991e93">Next</font></b> twice –</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image006.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0061.gif"><img title="clip_image006" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image006" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image006_thumb1.gif" width="404" height="269"></a></font></a></p> <p><font size="2">On the Join Rules page, change the <b><font color="#991e93">Source attribute</font></b> to <b><font color="#008000">mS-DS-ConsistencyGuid</font></b></font></p> <p><font size="2">Click <b><font color="#991e93">Add group</font></b> and in the new group, set <b><font color="#991e93">Source attribute</font></b> to <b><font color="#008000">objectGUID</font></b> and <b><font color="#991e93">Target attribute</font></b> to <b><font color="#008000">sourceAnchorBinary</font></b></font></p> <p><font size="2">Click <b><font color="#991e93">Next</font></b> –</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image008.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0081.gif"><img title="clip_image008" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image008" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image008_thumb1.gif" width="404" height="269"></a></font></a></p> <p><font size="2">Click <b><font color="#991e93">Save</font></b></font></p> <p><font size="2">Click <b><font color="#991e93">Yes</font></b> at the Expression Warning</font></p> <p><font size="2">Repeat for additional <b><font color="#991e93">In from AD -Group Join</font></b> rules, this time setting the precedence to one more than last time (<b><font color="#008000">97</font></b> in this example)</font></p> <p><font color="#0000a0" size="2"><strong>Creating Custom Common Rules for Groups</strong></font></p> <p><font size="2">Select the first <strong><font color="#991e93">In from AD - Group Common</font></strong> rule and click <b><font color="#991e93">Edit</font></b></font></p> <p><font size="2">Click <font color="#991e93"><strong>Yes</strong></font> at the Edit Reserved Rule Confirmation</font></p> <p><font size="2">Change <b><font color="#991e93">Description</font></b> to something like <b><font color="#008000">In from AD – Group Common Custom</font></b>, the <b><font color="#991e93">Precedence</font></b> to one more than the last rule (<b><font color="#008000">98</font></b> in this example) and click <b><font color="#991e93">Next</font></b> three times –</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image010.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0101.gif"><img title="clip_image010" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image010" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image010_thumb1.gif" width="404" height="269"></a></font></a></p> <p><font size="2">On the Transformations page,</font></p> <p><font size="2">Change <b><font color="#991e93">sourceAnchor</font></b> from</font></p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">ConvertToBase64([objectGUID])</pre>
<p><font size="2">To</font></p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">IIF(IsPresent([mS-DS-ConsistencyGuid]),ConvertToBase64([mS-DS-ConsistencyGuid]),ConvertToBase64([objectGUID]))</pre>
<p><font size="2">Change <b><font color="#991e93">sourceAnchorBinary</font></b> from <font color="#008000"><strong>Direct</strong></font></font></p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">[objectGUID]</pre>
<p><font size="2">To an <strong><font color="#008000">Expression</font></strong></font></p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">IIF(IsPresent([mS-DS-ConsistencyGuid]),[mS-DS-ConsistencyGuid],[objectGUID])</pre>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image012.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0121.gif"><img title="clip_image012" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image012" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image012_thumb1.gif" width="404" height="269"></a></font></a></p>
<p><font size="2">Click <b><font color="#991e93">Save</font></b></font></p>
<p><font size="2">Repeat for additional <b><font color="#991e93">In from AD -Group Common</font></b> rules, this time setting the precedence to one more than last time (<b><font color="#008000">99</font></b> in this example)</font></p>
<p><font color="#0000a0" size="2"><strong>Create Rules to Write mS-DS-ConsistencyGuid back to AD On-Premises</strong></font></p>
<p><font size="2">Change rule editor to show <b><font color="#991e93">outbound</font></b> rules and take note of the highest precedence rule (<b><font color="#008000">170</font></b> in this example) –</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image014.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0141.gif"><img title="clip_image014" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image014" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image014_thumb1.gif" width="404" height="314"></a></font></a></p>
<p><font size="2">Click <b><font color="#991e93">Add new rule</font></b></font></p>
<p><font size="2">On the Description page, set the <b><font color="#991e93">Name</font></b> to <b><font color="#008000">Out to AD - mS-DS-ConsistencyGuid</font></b></font></p>
<p><font size="2">On the Description page, set <b><font color="#991e93">Connected System</font></b> to the <strong><font color="#008000">&lt;Forest you're currently configuring the rule for&gt;</font></strong></font></p>
<p><font size="2">On the Description page, set <b><font color="#991e93">Connected System Object Type</font></b> to <b><font color="#008000">group</font></b></font></p>
<p><font size="2">On the Description page, set <b><font color="#991e93">Metaverse Object Type</font></b> to <b><font color="#008000">group</font></b></font></p>
<p><font size="2">On the Description page, set the <b><font color="#991e93">Precedence</font></b> to a value higher than the precedence noted above (<b><font color="#008000">171</font></b> in this example) –</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image016.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0161.gif"><img title="clip_image016" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image016" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image016_thumb1.gif" width="404" height="269"></a></font></a></p>
<p><font size="2">Click <b><font color="#991e93">Next</font></b></font></p>
<p><font size="2">On the Scoping filter page, click <b><font color="#991e93">Add group</font></b> and then <b><font color="#991e93">Add clause</font></b> and set the filter to <b><font color="#008000">cloudSourceAnchor ISNOTNULL</font></b> –</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image018.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0181.gif"><img title="clip_image018" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image018" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image018_thumb1.gif" width="404" height="269"></a></font></a></p>
<p><font size="2">Click <b><font color="#991e93">Next</font></b></font></p>
<p><font size="2">On the Join rules page, click <b><font color="#991e93">Add group</font></b></font></p>
<p><font size="2">Set the <b><font color="#991e93">Source attribute</font></b> to <b><font color="#008000">sourceAnchorBinary</font></b> and the <b><font color="#991e93">Target attribute</font></b> to <b><font color="#008000">mS-DS-ConsistencyGuid</font></b></font></p>
<p><font size="2">Click <font color="#991e93"><b>Add group</b> </font>again</font></p>
<p><font size="2">In the second group, set <b><font color="#991e93">Source attribute</font></b> to <b><font color="#008000">sourceAnchorBinary</font></b> and <b><font color="#991e93">Target attribute</font></b> to <b><font color="#008000">objectGUID</font></b> –</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image020.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0201.gif"><img title="clip_image020" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image020" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image020_thumb1.gif" width="404" height="269"></a></font></a></p>
<p><font size="2">Click <b><font color="#991e93">Next</font></b></font></p>
<p><font size="2">On the Transformations page, click <b><font color="#991e93">Add transformation</font></b>. Set the <b><font color="#991e93">Flow type</font></b> to <b><font color="#008000">Expression</font></b>, the <b><font color="#991e93">Target attribute</font></b> to <b><font color="#008000">mS-DS-ConsistencyGuid</font></b> and the <b><font color="#991e93">Expression</font></b> to</font></p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">IIF(IsPresent([sourceAnchorBinary]),[sourceAnchorBinary],IgnoreThisFlow)</pre>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image022.gif"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image0221.gif"><img title="clip_image022" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image022" src="https://msdnshared.blob.core.windows.net/media/2017/10/clip_image022_thumb1.gif" width="404" height="269"></a></font></a></p>
<p><font size="2">Click <b><font color="#991e93">Add</font></b></font></p>
<p><font size="2">Back at the outbound rules editor, click <b><font color="#991e93">Add Rule</font></b> and repeat for each additional Forest, setting the precedence to the next number (<b><font color="#008000">172</font></b> in this example)</font></p>
<p><font color="#0000a0" size="2"><strong>Re-establish Sync</strong></font></p>
<p><font size="2">Resume the sync service by opening a PowerShell prompt and executing</font></p>
<p><b><font color="#991e93" size="2" face="Consolas">Set-ADSyncScheduler -SchedulerSuspended $false</font></b>
<p><font size="2">Trigger a full sync by executing</font></p>
<p><b><font color="#991e93" size="2" face="Consolas">Start-ADSyncSyncCycle -PolicyType Initial</font></b>
<p><strong><font color="#0000a0" size="2">Conclusion</font></strong>
<p><font size="2">This blog post steps through the configuration of sync rules in AAD Connect that use <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> as the <strong><font color="#008000">sourceAnchor</font></strong> for groups when they are synchronised from on-premises Forests to an Azure Active Directory tenant.</font>
<p><font size="2">This approach, aligns with the built-in sync rules used for user objects.</font>
<p><strong><font size="2"></font></strong>]]></content:encoded>
    </item>
    <item>
      <title>An Alternative for DFSR Database GUID-to-Name Resolution</title>
      <link>https://docs.microsoft.com/archive/blogs/markrenoden/an-alternative-for-dfsr-database-guid-to-name-resolution</link>
      <pubDate>Wed, 03 May 2017 10:41:20 GMT</pubDate>
      <dc:creator><![CDATA[Mark Renoden]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/markrenoden/?p=2125</guid>
      <description><![CDATA[Recently I was connected to a support incident where a SYSVOL DFS Replication storm was causing...]]></description>
      <content:encoded><![CDATA[<p><font size="3">Recently I was connected to a support incident where a SYSVOL DFS Replication storm was causing trouble for a customer. Using the DFSR debug logs, the Microsoft support teams were able to identify that one file was being changed over and over again. The log entries were similar to -</font></p><pre class="brush: text; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">+	fid                             0x5000000019841
+	usn                             0x10a7a560
+	uidVisible                      1
+	filtered                        0
+	journalWrapped                  0
+	slowRecoverCheck                0
+	pendingTombstone                0
+	internalUpdate                  0
+	dirtyShutdownMismatch           0
+	meetInstallUpdate               1
+	meetReanimated                  0
+	recUpdateTime                   16010101 00:00:00.000 GMT
+	present                         1
+	nameConflict                    0
+	attributes                      0x10
+	ghostedHeader                   0
+	data                            0
+	gvsn                            {A7088668-9068-4D1F-BEA5-520C67C94967}-v53
+	uid                             {A7088668-9068-4D1F-BEA5-520C67C94967}-v53
+	parent                          {A7088668-9068-4D1F-BEA5-520C67C94967}-v44
+	fence                           Default (3)
+	clockDecrementedInDirtyShutdown 0
+	clock                           20170503 00:17:08.328 GMT (0x1d2c3a29a04c7b7)
+	createTime                      20170503 00:17:08.328 GMT
+	csId                            {9A829445-BA96-4EDB-9033-D08C3D6B308A}
+	hash                            E5C76297-69747039-B2E8590E-FE3AB33E
+	similarity                      00000000-00000000-00000000-00000000
+	name                            SomeFolder</pre>
<p><font size="3">The standard approach for identifying the server on which the change originated is to extract the <strong><font color="#008000">GUID</font></strong> from the <strong><font color="#008000">gvsn</font></strong> (<strong><font color="#008000">A7088668-9068-4D1F-BEA5-520C67C94967</font></strong> in this case) and to use <strong><font color="#008000">DfsrDiag.exe</font></strong> with its <strong><font color="#008000">guid2name</font></strong> command -</font></p><pre class="brush: text; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">C:\Windows\debug&gt;DfsrDiag.exe guid2name /guid:A7088668-9068-4D1F-BEA5-520C67C94967 /rgname:"Domain System Volume"

   Object Type : DfsrVolumeInfo
   Computer    : DC01.contoso.com
   Volume Guid : 37B3C300-0000-0000-0000-100000000000
   Volume Path : C:
   Volume SN   : 2864180062
   DB Guid     : A7088668-9068-4D1F-BEA5-520C67C94967</pre>
<p><font size="3">This is great except that for my customer, their environment has around 90 read-write DCs in a hub site with over 2000 read-only DCs in spoke sites. This <strong><font color="#008000">DfsrDiag.exe</font></strong> command walks across every DC and in the heat of a high priority incident, this takes too long. All we really want to do is retrieve the DFSR database GUIDs from the 90 read-write DCs as these are the only servers where change could originate.</font></p>
<p><font size="3">As it turns out, the DFSR database GUIDs are available via the <strong><font color="#008000">DfsrVolumeInfo</font></strong> class. In response to the problem my customer was experiencing, I've written the following PowerShell script that retrieves a list of read-write DCs in the domain and then iterates over them to retrieve the DFSR database GUIDs on each server -</font></p><pre class="brush: powershell; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">#Retrieve the list of read-write DCs
$rwDCs = (Get-ADDomain).ReplicaDirectoryServers

#Initialize the results array
$results = @()

#Iterate through the list of read-write DCs
foreach ($DC in $rwDCs)
{
    #Retrieve Dfsr Volume Information
    $volumes = $null
    $volumes = Get-WmiObject -Namespace "Root\MicrosoftDfs" -Class DfsrVolumeInfo -ComputerName $DC -ErrorAction SilentlyContinue

    #Extract the DC name and the Dfsr Db GUID for each Dfsr Volume
    #Add this information to the results array
    if ($volumes)
    {
        foreach ($volume in $volumes)
        {
            $result = "" | Select-Object DC,dbGUID
            $result.DC = $DC
            $result.dbGUID = $volume.DatabaseGuid
            $results += $result
        }
    }
}

#If the results array is populated, write it out to CSV 'dfsrDbGuids.csv'
if ($results)
{
    $results | Export-Csv -Path .\dfsrDbGuids.csv -NoTypeInformation
}</pre>
<p><font size="3">The output is a CSV with a name to GUID mapping.</font></p>
<p><font size="3">You could very easily change this script to accept a list of servers as a parameter for scenarios where you're dealing with a replication group other than the SYSVOL replica.</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Choosing a sourceAnchor for Multi-Forest Sync with AAD Connect - Part 7, Migrating Users</title>
      <link>https://docs.microsoft.com/archive/blogs/markrenoden/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-7-migrating-users</link>
      <pubDate>Fri, 24 Feb 2017 16:43:47 GMT</pubDate>
      <dc:creator><![CDATA[Mark Renoden]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/markrenoden/?p=2055</guid>
      <description><![CDATA[Update 25th May 2017:- As of AAD Connect May 2017 release, version 1.1.524, the default sourceAnchor...]]></description>
      <content:encoded><![CDATA[<p><font color="#ff0000" size="2"><strong><u>Update 25th May 2017:-</u> As of AAD Connect May 2017 release, version 1.1.524, the default sourceAnchor used by the setup wizard is mS-DS-ConsistencyGuid. This renders most of this blog post series moot but it will be maintained for reference.</strong></font></p> <p>&nbsp;</p> <p><font color="#ff0000" size="2"><strong>This blog post series is based upon and tested with AAD Connect, December 2016 release, version 1.1.380.0. Test all deployment designs before production implementation.</strong></font></p> <p><font color="#0000a0" size="2"><strong>Table of Contents</strong></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-1-introduction/">Part 1, Introduction</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-2-lab-setup/">Part 2, Lab Setup</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/21/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-3-an-aside-on-employeeid/">Part 3, An Aside on EmployeeID</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/22/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-4-using-msds-sourceanchor/">Part 4, Using msDS-SourceAnchor</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/23/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-5-using-ms-ds-consistencyguid/">Part 5, Using mS-DS-ConsistencyGuid</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/24/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-6-moving-off-objectguid/">Part 6, Moving off objectGuid</a></font></p> <p><font size="2">Part 7, Migrating Users</font></p> <p><font color="#0000a0" size="2"><strong>Changing Issuance Transform Rules for O365</strong></font></p> <p><font size="2">If your Azure Active Directory tenant is federated with an on-premises federation service (AD FS for example), you'll need to make one last configuration change before you migrate users. This final step is to ensure your O365 Relying Party Trust Issuance Transform Rule for <strong><font color="#008000">ImmutableID</font></strong> uses the attribute you've chosen (<strong><font color="#008000">msDS-SourceAnchor</font></strong> or <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong>) instead of <strong><font color="#008000">objectGuid</font></strong>.</font></p> <p><font size="2">I'll provide an example using AD FS on Windows Server 2016 -</font></p> <p><font size="2">Open the AD FS Management console</font></p> <p><font size="2">In the left-hand pane, select <strong><font color="#991e93">Relying Party Trusts</font></strong></font></p> <p><font size="2">In the central pane, right-click <strong><font color="#991e93">Microsoft Office 365 Identity Platform</font></strong> and select Edit <strong><font color="#991e93">Claim Issuance Policy</font></strong></font></p> <p><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa34.jpg"><img title="sa34" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa34" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa34_thumb.jpg" width="604" height="674"></a></font></p> <p><font size="2">Edit the transform rule replacing <strong><font color="#008000">objectguid</font></strong> with <strong><font color="#008000">msds-sourceanchor</font></strong> or <strong><font color="#008000">ms-ds-consistencyguid</font></strong> depending on the attribute you're using -</font></p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">c:[Type == "https://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname"]
 =&gt; issue(store = "Active Directory", types = ("https://schemas.xmlsoap.org/claims/UPN", "https://schemas.microsoft.com/LiveID/Federation/2008/05/ImmutableID"), query = "samAccountName={0};userPrincipalName,objectguid;{1}", param = regexreplace(c.Value, "(?&lt;domain&gt;[^\\]+)\\(?&lt;user&gt;.+)", "${user}"), param = c.Value);</pre>
<p><font size="2">Save the rule changes</font></p>
<p><font color="#0000a0" size="2"><strong>Tools</strong></font></p>
<p><font size="2">I'm going to assume you're using the Active Directory Migration Toolkit (ADMT). This is what I've tested with and can confirm works.</font></p>
<p><font color="#0000a0" size="2"><strong>Migration Process</strong></font></p>
<p><font size="2">Here, I won't be stepping through the use of ADMT. That's not what I want to discuss. I just want to make the migration process clear so that you don't lose any objects. Here we go -</font></p>
<ol>
<li><font size="2">Keep the user objects you want to migrate between Forests in scope for AAD Connect synchronisation. By this I mean, leave it in an OU that AAD Connect is synchronising</font> 
<li><font size="2">Migrate the users so that they are also in scope for AAD Connect synchronisation in the destination Forest - they should land in an OU that AAD Connect is synchronising</font> 
<li><font size="2">Make an edit to a replicated attribute on the destination user object and validate that this shows up in the Azure Active Directory tenant after the next sync cycle (Description attribute for example)</font> 
<li><font size="2">Move the object out of scope for AAD Connect synchronisation in the source Forest (and potentially delete/decommission it)</font></li></ol>
<p><font color="#0000a0" size="2"><strong>Example</strong></font></p>
<p><font size="2">I start with my synchronised users. I'm going to migrate forest2user over to forest1.com</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa29.jpg"><img title="sa29" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa29" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa29_thumb.jpg" width="604" height="106"></a></p>
<p><font size="2">Source user is in a synchronised OU -</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa30.jpg"><img title="sa30" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa30" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa30_thumb.jpg" width="604" height="412"></a></p>
<p><font size="2">After migration, the user object is in a synchronised OU -</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa31.jpg"><img title="sa31" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa31" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa31_thumb.jpg" width="604" height="412"></a></p>
<p><font size="2">At this point, both objects are synchronising into a merged object in the AAD Connect Metaverse. An attribute change on either object will propagate to the Azure Active Directory tenant. I make an edit to the <font color="#008000"><strong>Department</strong></font> attribute on the destination user object -</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa32.jpg"><font size="2"><img title="sa32" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa32" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa32_thumb.jpg" width="604" height="818"></font></a></p>
<p><font size="2">And now I see this after a sync in the Azure Active Directory tenant -</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa33.jpg"><font size="2"><img title="sa33" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa33" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa33_thumb.jpg" width="604" height="104"></font></a></p>
<p><font size="2">I am now able to decommission the user object in the source Forest.</font></p>
<p><font color="#0000a0" size="2"><strong>Conclusion</strong></font></p>
<p><font size="2">This series has covered the proper use of a <strong><font color="#008000">sourceAnchor</font></strong> for an AAD Connect deployment synchronising multiple Forests to an Azure Active Directory tenant. With the right configuration, user migration between Forests is successful without object duplication in the tenant.</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Choosing a sourceAnchor for Multi-Forest Sync with AAD Connect - Part 6, Moving off objectGuid</title>
      <link>https://docs.microsoft.com/archive/blogs/markrenoden/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-6-moving-off-objectguid</link>
      <pubDate>Fri, 24 Feb 2017 12:43:33 GMT</pubDate>
      <dc:creator><![CDATA[Mark Renoden]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/markrenoden/?p=1925</guid>
      <description><![CDATA[Update 25th May 2017:- As of AAD Connect May 2017 release, version 1.1.524, the default sourceAnchor...]]></description>
      <content:encoded><![CDATA[<p><font color="#ff0000" size="2"><strong><u>Update 25th May 2017:-</u> As of AAD Connect May 2017 release, version 1.1.524, the default sourceAnchor used by the setup wizard is mS-DS-ConsistencyGuid. This renders most of this blog post series moot but it will be maintained for reference.</strong></font></p> <p>&nbsp;</p> <p><font color="#ff0000" size="2"><strong>This blog post series is based upon and tested with AAD Connect, December 2016 release, version 1.1.380.0. Test all deployment designs before production implementation.</strong></font></p> <p><font color="#0000a0" size="2"><strong>Table of Contents</strong></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-1-introduction/">Part 1, Introduction</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-2-lab-setup/">Part 2, Lab Setup</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/21/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-3-an-aside-on-employeeid/">Part 3, An Aside on EmployeeID</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/22/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-4-using-msds-sourceanchor/">Part 4, Using msDS-SourceAnchor</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/23/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-5-using-ms-ds-consistencyguid/">Part 5, Using mS-DS-ConsistencyGuid</a></font></p> <p><font size="2">Part 6, Moving off objectGuid</font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/24/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-7-migrating-users/">Part 7, Migrating Users</a></font></p> <p><font color="#0000a0" size="2"><strong>Correcting an earlier choice of objectGuid</strong></font></p> <p><font size="2">As it turns out, if you've previously selected <strong><font color="#008000">objectGuid</font></strong> as you <strong><font color="#008000">sourceAnchor</font></strong>, you can very easily change to using <strong><font color="#008000">msDS-SourceAnchor</font></strong> or <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong>.</font></p> <p><font size="2">Pause the sync service by opening a PowerShell prompt and executing</font></p> <p><font color="#991e93" size="2" face="Consolas"><strong>Set-ADSyncScheduler -SchedulerSuspended $true</strong></font></p> <p><font size="2">Choose either <strong><font color="#008000">msDS-SourceAnchor </font></strong>or <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> and make the rule edits described in </font><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/22/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-4-using-msds-sourceanchor/"><font size="2">Part 4</font></a><font size="2"> of this series for <strong><font color="#008000">msDS-SourceAnchor</font></strong> or </font><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/23/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-5-using-ms-ds-consistencyguid/"><font size="2">Part 5</font></a><font size="2"> of this series for <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong>.</font></p> <p><font size="2">Open <strong>"C:\Program Files\Microsoft Azure AD Sync\UIShell\miisclient.exe"</strong></font></p> <p><font size="2">Navigate to <strong><font color="#991e93">Connectors</font></strong></font></p> <p><font size="2">Select the first Forest connector and click <strong><font color="#991e93">Properties</font></strong></font></p> <p><font size="2">In the properties sheet, click <strong><font color="#991e93">Select Attributes</font></strong></font></p> <p><font size="2">Check <font color="#991e93"><strong>Show All</strong></font></font></p> <p><font size="2">Scroll down and check <strong><font color="#008000">msDS-SourceAnchor</font></strong> (or <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> if you're using that)</font></p> <p><font size="2">Click <strong><font color="#991e93">OK</font></strong></font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa28.jpg"><img title="sa28" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa28" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa28_thumb.jpg" width="604" height="452"></a></p> <p><font size="2">Repeat for all other Forest connectors</font></p> <p><font size="2">Resume the sync service by opening a PowerShell prompt and executing</font></p> <p><font color="#991e93" size="2" face="Consolas"><strong>Set-ADSyncScheduler -SchedulerSuspended $false</strong></font></p> <p><font size="2">Trigger a delta sync by executing</font></p> <p><font color="#991e93" size="2" face="Consolas"><strong>StartADSyncSyncCycle -PolicyType Delta</strong></font></p> <p><font color="#0000a0" size="2"><strong>What about when other attributes are used for sourceAnchor?</strong></font></p> <p><font size="2">Now you're in a world of hurt.</font></p> <p><font size="2">You need to uninstall AAD Connect and have the wizard remove all components including the sync database. You need to delete your users from Azure Active Directory and you need to start again.</font></p> <p><font size="2">An alternative to starting over is to change the ImmutableID by</font></p> <p><font size="2">Logging into <a title="https://manage.windowsazure.com" href="https://manage.windowsazure.com">https://manage.windowsazure.com</a></font></p> <p><font size="2">Navigating to the Azure Active Directory tenant</font></p> <p><font size="2">Selecting <strong><font color="#991e93">Directory Integration</font></strong></font></p> <p><font size="2">Disabling <font color="#991e93"><strong>Directory Sync</strong></font></font></p> <p><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa35.jpg"><img title="sa35" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa35" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa35_thumb.jpg" width="604" height="69"></a></font></p> <p><font size="2"><font color="#ff0000"><em><strong><u>Note:</u></strong> It will take time to disable sync for all users … around 1 hour for every 2000 users. Due to the asynchronous nature of this task under the hood, it may not begin immediately (sometimes a delay of hours and in rare cases days). Sync cannot be enabled again until this task is complete.</em></font></font></p> <p><font size="2">Change the UPN for users to the .onmicrosoft.com tenant domain -</font></p> <p><font color="#991e93" size="2" face="Consolas"><strong>Set-MsolUserPrincipalName -NewUserPrincipalName <font color="#008000">user@tenant.onmicrosoft.com</font> -UserPrincipalName <a href="mailto:user@publicdomain.com"><font color="#ff0000">user@publicdomain.com</font></a></strong></font></p> <p><font size="2">Change the ImmutableID to the value you want to use for each user -</font></p> <p><font color="#991e93" size="2" face="Consolas"><strong>Set-MsolUser -UserPrincipalName user@tenant.onmicrosoft.com -ImmutableId <font color="#008000">newValue</font></strong></font></p> <p><font size="2">Change the UPN back to the public domain name -</font></p> <p><font color="#991e93" size="2" face="Consolas"><strong>Set-MsolUserPrincipalName -NewUserPrincipalName <a href="mailto:user@publicdomain.com"><font color="#008000">user@publicdomain.com</font></a> -UserPrincipalName <font color="#ff0000">user@tenant.onmicrosoft.com</font></strong></font></p> <p><font size="2">Enable sync for the Azure Active Directory tenant again (again more time for sync to start again)</font></p> <p><font size="2">AAD Connect configuration will need to be updated to reflect the use of the new <strong><font color="#008000">sourceAnchor</font></strong></font></p> <p><font size="2">Depending on the services you're using with your Azure Active Directory tenant, you may be facing mailbox export/import operations and various other problems.</font></p> <p><font size="2">I would recommend engaging with Microsoft Premier Field Engineering, Microsoft Consulting or a trusted cloud partner to help you through it.</font></p> <p><font color="#0000a0" size="2"><strong>Conclusion</strong></font></p> <p><font size="2">Moving away from <strong><font color="#008000">objectGuid</font></strong> over to <strong><font color="#008000">msDS-SourceAnchor </font></strong>or <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> as your <strong><font color="#008000">sourceAnchor </font></strong>is relatively easy.</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Choosing a sourceAnchor for Multi-Forest Sync with AAD Connect - Part 5, Using mS-DS-ConsistencyGuid</title>
      <link>https://docs.microsoft.com/archive/blogs/markrenoden/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-5-using-ms-ds-consistencyguid</link>
      <pubDate>Thu, 23 Feb 2017 14:58:19 GMT</pubDate>
      <dc:creator><![CDATA[Mark Renoden]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/markrenoden/?p=1915</guid>
      <description><![CDATA[Update 25th May 2017:- As of AAD Connect May 2017 release, version 1.1.524, the default sourceAnchor...]]></description>
      <content:encoded><![CDATA[<p><font color="#ff0000" size="2"><strong><u>Update 25th May 2017:-</u> As of AAD Connect May 2017 release, version 1.1.524, the default sourceAnchor used by the setup wizard is mS-DS-ConsistencyGuid. This renders most of this blog post series moot but it will be maintained for reference.</strong></font></p> <p>&nbsp;</p> <p><font color="#ff0000" size="2"><strong>This blog post series is based upon and tested with AAD Connect, December 2016 release, version 1.1.380.0. Test all deployment designs before production implementation.</strong></font></p> <p><font color="#0000a0" size="2"><strong>Table of Contents</strong></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-1-introduction/">Part 1, Introduction</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-2-lab-setup/">Part 2, Lab Setup</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/21/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-3-an-aside-on-employeeid/">Part 3, An Aside on EmployeeID</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/22/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-4-using-msds-sourceanchor/">Part 4, Using msDS-SourceAnchor</a></font></p> <p><font size="2">Part 5, Using mS-DS-ConsistencyGuid</font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/24/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-6-moving-off-objectguid/">Part 6, Moving off objectGuid</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/24/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-7-migrating-users/">Part 7, Migrating Users</a></font></p> <p><font color="#0000a0" size="2"><strong>Green Fields Deployment with mS-DS-ConsistencyGuid</strong></font></p> <p><font size="2">The steps to configure <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> as the <strong><font color="#008000">sourceAnchor</font></strong> are almost identical to those for <strong><font color="#008000">msDS-SourceAnchor</font></strong>. For this reason, I'll be less verbose than last than my last post and just highlight the configuration differences.</font></p> <p><font size="2">The rule logic has to be slightly different because <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> and <strong><font color="#008000">msDS-SourceAnchor </font></strong>have different attribute syntax (data types) in Active Directory. For write-back to on-premises Active Directory objects, we will use <strong><font color="#008000">SourceAnchorBinary</font></strong> to populate <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong></font></p> <p><font size="2">Just as I did in the last post, a new deployment starts by choosing <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> in the AAD Connect setup wizard -</font></p> <p><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa21.jpg"><img title="sa21" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa21" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa21_thumb.jpg" width="604" height="426"></a></font></p> <p><font size="2"><strong>Note: </strong>It is unsupported to edit the built-in rules. All you can do is copy them which disables the original.</font></p> <p><font size="2">Notice that the lowest precedence on these rules is 100. Starting from a precedence value of</font></p> <p><font size="2">(100 - (2 x number_of_forests)) we'll number each new rule</font></p> <p><font size="2">In my example, this value will be (100 - (2 x 2)) = 96</font></p> <p><font size="2">I'll have</font></p> <ul> <li><font size="2">In from AD - User Join Custom = 96</font>  <li><font size="2">In from AD - User Join Custom = 97</font>  <li><font size="2">In from AD - mS-DS-ConsistencyGuid = 98</font>  <li><font size="2">In from AD - mS-DS-ConsistencyGuid = 99</font></li></ul> <p><font color="#0000a0" size="2"><strong>Modifying User Join Rules</strong></font></p> <p><font size="2">Note the precedence value you're up to</font></p> <p><font size="2">Click <strong><font color="#991e93">Edit</font></strong> and then click <strong><font color="#991e93">Yes </font></strong>when prompted to copy the rule</font></p> <p><font size="2">Provide a meaningful <strong><font color="#991e93">Name</font></strong> (e.g. In from AD - User Join Custom)</font></p> <p><font size="2">Set the <font color="#991e93"><strong>Precedence</strong></font></font></p> <p><font size="2"></font></p> <p><font size="2">Click <strong><font color="#991e93">Next</font></strong> twice</font></p> <p><font size="2">On the <strong><font color="#991e93">Join Rules </font></strong>page, in the existing join rule, change the <strong><font color="#991e93">Source Attribute</font></strong> to <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> and the <strong><font color="#991e93">Target Attribute </font></strong>to <strong><font color="#008000">sourceAnchorBinary</font></strong></font></p> <p><font size="2">On the <strong><font color="#991e93">Join Rules </font></strong>page, click <strong><font color="#991e93">Add group</font></strong></font></p> <p><font size="2">On the <strong><font color="#991e93">Join Rules </font></strong>page, in the new join rule, change the <strong><font color="#991e93">Source Attribute</font></strong> to <strong><font color="#008000">objectGuid</font></strong> and the <strong><font color="#991e93">Target Attribute </font></strong>to <strong><font color="#008000">sourceAnchorBinary</font></strong></font></p> <p><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa22.jpg"><img title="sa22" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa22" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa22_thumb.jpg" width="604" height="402"></a></font></p> <p><font size="2">Click <strong><font color="#991e93">Next</font></strong></font></p> <p><font size="2">On the <strong><font color="#991e93">Transformation</font></strong> page, edit the second rule so that the <strong><font color="#991e93">FlowType</font></strong> is <strong><font color="#991e93">Expression</font></strong>, <strong><font color="#991e93">Target Attribute</font></strong> is <strong><font color="#991e93"><font color="#008000">sourceAnchor</font> </font></strong>and the <strong><font color="#991e93">source</font></strong> is</font></p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">IIF(IsPresent([mS-DS-ConsistencyGuid]),IIF(IsString([mS-DS-ConsistencyGuid]),CStr([mS-DS-ConsistencyGuid]),ConvertToBase64([mS-DS-ConsistencyGuid])),IIF(IsString([objectGUID]),CStr([objectGUID]),ConvertToBase64([objectGUID])))</pre>
<p><font size="2">On the <strong><font color="#991e93">Transformation</font></strong> page, add a third rule so that the <strong><font color="#991e93">FlowType</font></strong> is <strong><font color="#991e93">Expression</font></strong>, <strong><font color="#991e93">Target Attribute</font></strong> is <strong><font color="#991e93"><font color="#008000">sourceAnchorBinary</font> </font></strong>and the <strong><font color="#991e93">source </font></strong>is</font></p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">IIF(IsPresent([mS-DS-ConsistencyGuid]),[mS-DS-ConsistencyGuid],[objectGUID])</pre>
<p><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa23.jpg"><img title="sa23" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa23" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa23_thumb.jpg" width="604" height="402"></a></font></p>
<p><font size="2">Click <strong><font color="#991e93">Save</font></strong></font></p>
<p><font size="2">If prompted with an <strong><font color="#991e93">Expression Warning</font></strong>, click <strong><font color="#991e93">Yes</font></strong></font></p>
<p><font size="2">Repeat for each additional Forest being synchronised</font></p>
<p><font size="2"><strong><font color="#0000a0">Overriding User AccountEnabled and User Common Rules for sourceAnchor</font></strong></p>
<p>The process for creating a new rule to override each of the other rules is -</p>
<p><font size="2">Note the precedence value you're up to</font></p>
<p><font size="2">Click <strong><font color="#991e93">Add New Rule</font></strong></font></p>
<p><font size="2">Provide a meaningful <strong><font color="#991e93">Name</font></strong> (e.g. In from AD - mS-DS-ConsistencyGuid)</font></p>
<p><font size="2">Set the <font color="#991e93"><strong>Connected System</strong></font><font color="#333333"> to the Forest you're configuring for</font></font></p>
<p><font size="2">Set the <font color="#991e93"><strong>Connected System Object</strong></font><font color="#333333">&nbsp;</font>to <strong><font color="#991e93">user</font></strong></font></p>
<p>Set the <strong><font color="#991e93">Metaverse Object Type</font></strong> to <strong><font color="#991e93">person</font></strong></p>
<p><font size="2">Set the <strong><font color="#991e93">Link Type</font></strong> to <strong><font color="#991e93">Join</font></strong></font></p>
<p><font size="2">Set the <font color="#991e93"><strong>Precedence</strong></font></font></p>
<p>Click <strong><font color="#991e93">Next</font></strong> three times</p>
<p>On the <strong><font color="#991e93">Transformations</font></strong> page, click <strong><font color="#991e93">Add transformation</font></strong></p>
<p>Set <strong><font color="#991e93">FlowType</font></strong> to <strong><font color="#991e93">Expression</font></strong></p>
<p>Set <strong><font color="#991e93">Target attribute</font></strong> to <strong><font color="#008000">sourceAnchor</font></strong></p>
<p>Change the <strong><font color="#991e93">source</font></strong> expression to</font></p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">IIF(IsPresent([msExchRecipientTypeDetails]),IIF([msExchRecipientTypeDetails]=2,NULL,IIF(IsPresent([mS-DS-ConsistencyGuid]),IIF(IsString([mS-DS-ConsistencyGuid]),CStr([mS-DS-ConsistencyGuid]),ConvertToBase64([mS-DS-ConsistencyGuid])),IIF(IsString([objectGUID]),CStr([objectGUID]),ConvertToBase64([objectGUID])))),IIF(IsPresent([mS-DS-ConsistencyGuid]),IIF(IsString([mS-DS-ConsistencyGuid]),CStr([mS-DS-ConsistencyGuid]),ConvertToBase64([mS-DS-ConsistencyGuid])),IIF(IsString([objectGUID]),CStr([objectGUID]),ConvertToBase64([objectGUID]))))</pre>
<p><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa241.jpg"><img title="sa24" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa24" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa24_thumb1.jpg" width="604" height="402"></a></font></p>
<p><font size="2">Click <strong><font color="#991e93">Add</font></strong></font></p>
<p><font size="2">If prompted with an <strong><font color="#991e93">Expression Warning</font></strong>, click <strong><font color="#991e93">Yes</font></strong></font></p>
<p><font size="2">Repeat for each additional Forest being synchronised</font></p>
<p><strong><font color="#0000a0" size="2">Creating a Rule to Write sourceAnchorBinary back into mS-DS-ConsistencyGuid</font></strong></p>
<p><font size="2">Now we have rules that correctly populate <strong><font color="#008000">sourceAnchor</font></strong> and <strong><font color="#008000">sourceAnchorBinary</font></strong> in the Metaverse, we need rules that write <strong><font color="#008000">sourceAnchorBinary</font></strong> back into the on-premises <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong> attribute -</font></p>
<p><font size="2">Change the rule editor filter to show <strong><font color="#991e93">Outbound</font></strong> rules</font></p>
<p><font size="2">Take note of the precedence of the last rule in the list</font></p>
<p><font size="2">Click <strong><font color="#991e93">Add new rule</font></strong></font></p>
<p><font size="2">On the <strong><font color="#991e93">Description</font></strong> page, set the <strong><font color="#991e93">Name</font></strong> to <strong><em>Out to AD - mS-DS-ConsistencyGuid</em></strong></font></p>
<p><font size="2">On the <strong><font color="#991e93">Description</font></strong> page, set <strong><font color="#991e93">Connected System</font></strong> to the Forest you're currently configuring the rule for</font></p>
<p><font size="2">On the <strong><font color="#991e93">Description</font></strong> page, set <strong><font color="#991e93">Connected System Object Type</font></strong> to <strong><font color="#991e93">user</font></strong></font></p>
<p><font size="2">On the <strong><font color="#991e93">Description</font></strong> page, set <strong><font color="#991e93">Metaverse Object Type</font></strong> to <strong><font color="#991e93">person</font></strong></font></p>
<p><font size="2">On the <strong><font color="#991e93">Description</font></strong> page, set the <strong><font color="#991e93">Precedence</font></strong> to a value higher than the precedence noted above (this will need to increase for each new rule created for each Forest)</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa25.jpg"><font size="2"><img title="sa25" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa25" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa25_thumb.jpg" width="604" height="402"></font></a></p>
<p><font size="2">Click <strong><font color="#991e93">Next</font></strong> three times</font></p>
<p><font size="2">On the <strong><font color="#991e93">Transformation</font></strong> page, click <strong><font color="#991e93">Add transformation</font></strong></font></p>
<p><font size="2">In the new transformation set the <strong><font color="#991e93">FlowType</font></strong> to <strong><font color="#991e93">Direct</font></strong>, the <strong><font color="#991e93">Target Attribute</font></strong> to <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong>, the <strong><font color="#991e93">Source</font></strong> to <strong><font color="#008000">sourceAnchorBinary</font></strong> and the <strong><font color="#991e93">Merge Type</font></strong> to <strong><font color="#991e93">Update</font></strong></font></p>
<p><font size="2">Click <strong><font color="#991e93">Add</font></strong></font></p>
<p><font size="2">Repeat for each additional Forest being synchronised</font></p>
<p><font size="2">Close the rules editor</font></p>
<p><strong><font color="#0000a0" size="2">Trigger a Full Sync</font></strong></p>
<p><font size="2">Open a PowerShell prompt and execute</font></p>
<p><strong><em><font size="2">Start-ADSyncSyncCycle -PolicyType Initial</font></em></strong></p>
<p><font size="2">You should now find that users are successfully synchronised to Azure Active Directory and that <strong><font color="#008000">sourceAnchor</font></strong> is written back into <strong><font color="#008000">msDS-SourceAnchor</font></strong> for on-premises objects</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa26.jpg"><font size="2"><img title="sa26" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa26" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa26_thumb.jpg" width="604" height="106"></font></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa27.jpg"><font size="2"><img title="sa27" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa27" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa27_thumb.jpg" width="604" height="818"></font></a></p>
<p><strong><font color="#0000a0" size="2">Conclusion</font></strong></p>
<p><font size="2">The rule changes configured here prefer <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong>as the <strong><font color="#008000">sourceAnchor</font></strong> source but use <strong><font color="#008000">objectGuid</font></strong> when <strong><font color="#008000">mS-DS-ConsistencyGuid</font></strong>is <strong><font color="#008000">NULL</font></strong>. <strong><font color="#008000">sourceAnchorBinary</font></strong> is written back to <strong><font color="#008000">mS-DS-ConsistencyGuid </font></strong>in the on-premises object so that this attribute is always used after the initial sync, even after a migration of the user object between Forests.</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Choosing a sourceAnchor for Multi-Forest Sync with AAD Connect - Part 4, Using msDS-SourceAnchor</title>
      <link>https://docs.microsoft.com/archive/blogs/markrenoden/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-4-using-msds-sourceanchor</link>
      <pubDate>Wed, 22 Feb 2017 14:56:12 GMT</pubDate>
      <dc:creator><![CDATA[Mark Renoden]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/markrenoden/?p=1655</guid>
      <description><![CDATA[Update 25th May 2017:- As of AAD Connect May 2017 release, version 1.1.524, the default sourceAnchor...]]></description>
      <content:encoded><![CDATA[<p><font color="#ff0000" size="2"><strong><u>Update 25th May 2017:-</u> As of AAD Connect May 2017 release, version 1.1.524, the default sourceAnchor used by the setup wizard is mS-DS-ConsistencyGuid. This renders most of this blog post series moot but it will be maintained for reference.</strong></font></p> <p>&nbsp;</p> <p><font color="#ff0000" size="2"><strong>This blog post series is based upon and tested with AAD Connect, December 2016 release, version 1.1.380.0. Test all deployment designs before production implementation.</strong></font></p> <p><font color="#0000a0" size="2"><strong>Table of Contents</strong></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-1-introduction/">Part 1, Introduction</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-2-lab-setup/">Part 2, Lab Setup</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/21/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-3-an-aside-on-employeeid/">Part 3, An Aside on EmployeeID</a></font></p> <p><font size="2">Part 4, Using msDS-SourceAnchor</font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/23/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-5-using-ms-ds-consistencyguid/">Part 5, Using mS-DS-ConsistencyGuid</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/24/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-6-moving-off-objectguid/">Part 6, Moving off objectGuid</a></font></p> <p><font size="2"><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/24/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-7-migrating-users/">Part 7, Migrating Users</a></font></p> <p><font color="#0000a0" size="2"><strong>Green Fields Deployment with msDS-SourceAnchor</strong></font></p> <p><font size="2">Following on from my previous <strong><font color="#008000">sourceAnchor</font></strong> posts, let's assume a new deployment with AAD Connect into an empty Azure Active Directory tenant.</font></p> <p><font size="2">I step through the AAD Connect setup wizard, adding the Forests from my lab (forest1.com and forest2.com), scoping sync to a single OU in each case (SyncOU) and choosing <strong><font color="#008000">msDS-SourceAnchor</font></strong> as my <strong><font color="#008000">sourceAnchor</font></strong> attribute -</font></p> <p><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa10.jpg"><img title="sa10" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa10" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa10_thumb.jpg" width="604" height="426"></a></font></p> <p><font size="2">I complete the wizard allowing initial sync to be triggered and wait … and wait … and <u><font color="#c0504d">nothing</font></u> shows up in my Azure Active Directory tenant!</font></p> <p><font color="#0000a0" size="2"><strong>What's Going On?</strong></font></p> <p><font size="2">If you go back to </font><a href="https://blogs.technet.microsoft.com/markrenoden/2017/02/20/choosing-a-sourceanchor-for-multi-forest-sync-with-aad-connect-part-2-lab-setup/"><font size="2">Part 2</font></a><font size="2"> of this series, I demonstrated that <strong><font color="#008000">msDS-SourceAnchor</font></strong> starts life as a <strong><font color="#008000">NULL</font></strong> value. What this means is that <strong><font color="#008000">sourceAnchor</font></strong> in the AAD Connect Metaverse is not populated when the default sync rules are used. I can see this by running</font></p> <p><font size="2"><em><strong>"C:\Program Files\Microsoft Azure AD Sync\UIShell\miisclient.exe"</strong></em></font></p> <p><font size="2">I then click on <strong><font color="#991e93">Metaverse Search</font></strong> and then the <strong><font color="#991e93">Search</font></strong> button which displays the objects imported from my Forests into the AAD Connect Metaverse -</font></p> <p><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa11.jpg"><img title="sa11" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa11" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa11_thumb.jpg" width="604" height="452"></a></font></p> <p><font size="2">If I double-click on one of these objects, I can see the attributes in the Metaverse that have been populated -</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa12.jpg"><img title="sa12" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa12" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa12_thumb.jpg" width="604" height="474"></a></p> <p><font size="2">In this case, we cannot see <strong><font color="#008000">sourceAnchor</font></strong> (I'll discuss <strong><font color="#008000">sourceAnchorBinary</font></strong> in a later post)</font></p> <p><font size="2">It follows that AAD Connect can't create an object in Azure Active Directory. We'll need to modify the sync rules.</font></p> <h3><font size="2"><font style="font-weight: bold" color="#0000a0">Editing the Sync Rules</font></font></h3> <p><font size="2">The sync rules editor is opened by running</font></p> <p><font size="2"><strong><em>"C:\Program Files\Microsoft Azure AD Sync\UIShell\SyncRulesEditor.exe"</em></strong></font></p> <p><font size="2">When this opens, you'll notice that the rules are filtered by Inbound and that for each Forest, there are three rules that relate to Users -</font></p> <p><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa13.jpg"><img title="sa13" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa13" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa13_thumb.jpg" width="604" height="469"></a></font></p> <p><font size="2">The rules for each Forest are</font></p> <ul> <li><font size="2">In from AD - User Join</font>  <li><font size="2">In from AD - User AccountEnabled</font>  <li><font size="2">In from AD - User Common</font> </li></ul> <p><font size="2"><strong>Note: </strong>It is unsupported to edit the built-in rules. All you can do is copy them which disables the original. I'll copy the User Join rule and create a new rule that overrides the other two rules for just the <strong><font color="#008000">sourceAnchor</font></strong> attribute</font></p> <p><font size="2">Notice that the lowest precedence on these rules is 100. Starting from a precedence value of</font></p> <p><font size="2">(100 - (2 x number_of_forests)) we'll number each new rule</font></p> <p><font size="2">In my example, this value will be (100 - (2 x 2)) = 96</font></p> <p><font size="2">I'll have</font></p> <ul> <li><font size="2">In from AD - User Join Custom = 96</font>  <li><font size="2">In from AD - User Join Custom = 97</font>  <li><font size="2">In from AD - msDS-SourceAnchor = 98</font>  <li><font size="2">In from AD - msDS-SourceAnchor = 99</font><!--EndFragment--></li></ul> <p><font color="#0000a0" size="2"><strong>Modifying User Join Rules</strong></font></p> <p><font size="2">Note the precedence value you're up to</font></p> <p><font size="2">Click <strong><font color="#991e93">Edit</font></strong> and then click <strong><font color="#991e93">Yes </font></strong>when prompted to copy the rule</font></p> <p><font size="2">Provide a meaningful <strong><font color="#991e93">Name</font></strong> (e.g. In from AD - User Join Custom)</font></p> <p><font size="2">Set the <font color="#991e93"><strong>Precedence</strong></font></font></p> <p><font size="2">Click <strong><font color="#991e93">Next</font></strong> twice</font></p> <p><font size="2">On the <strong><font color="#991e93">Join Rules </font></strong>page, in the existing join rule, change the <strong><font color="#991e93">Source Attribute</font></strong> to <strong><font color="#008000">msDS-SourceAnchor</font></strong> and the <strong><font color="#991e93">Target Attribute </font></strong>to <strong><font color="#008000">sourceAnchor</font></strong></font></p> <p><font size="2">On the <strong><font color="#991e93">Join Rules </font></strong>page, click <strong><font color="#991e93">Add group</font></strong></font></p> <p><font size="2">On the <strong><font color="#991e93">Join Rules </font></strong>page, in the new join rule, change the <strong><font color="#991e93">Source Attribute</font></strong> to <strong><font color="#008000">objectGuid</font></strong> and the <strong><font color="#991e93">Target Attribute </font></strong>to <strong><font color="#008000">sourceAnchorBinary</font></strong></font></p> <p><strong><font color="#008000" size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa14.jpg"><img title="sa14" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa14" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa14_thumb.jpg" width="604" height="402"></a></font></strong></p> <p><font size="2">Click <strong><font color="#991e93">Next</font></strong></font></p> <p><font size="2">On the <strong><font color="#991e93">Transformation</font></strong> page, edit the second rule so that the <strong><font color="#991e93">FlowType</font></strong> is <strong><font color="#991e93">Expression</font></strong>, <strong><font color="#991e93">Target Attribute</font></strong> is <strong><font color="#991e93"><font color="#008000">sourceAnchor</font> </font></strong>and the <strong><font color="#991e93">source</font></strong> is</font></p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">IIF(IsPresent([msDS-SourceAnchor]),IIF(IsString([msDS-SourceAnchor]),CStr([msDS-SourceAnchor]),ConvertToBase64([msDS-SourceAnchor])),IIF(IsString([objectGUID]),CStr([objectGUID]),ConvertToBase64([objectGUID])))</pre>
<p><font size="2">On the <strong><font color="#991e93">Transformation</font></strong> page, add a third rule so that the <strong><font color="#991e93">FlowType</font></strong> is <strong><font color="#991e93">Direct</font></strong>, <strong><font color="#991e93">Target Attribute</font></strong> is <strong><font color="#991e93"><font color="#008000">sourceAnchorBinary</font> </font></strong>and the <strong><font color="#991e93">source </font></strong>is <strong><font color="#991e93"><font color="#008000">objectGuid</font></font></strong></font></p>
<p><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa151.jpg"><img title="sa15" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa15" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa15_thumb1.jpg" width="604" height="402"></a></font></p>
<p><font size="2">Click <strong><font color="#991e93">Save</font></strong></font></p>
<p><font size="2">If prompted with an <strong><font color="#991e93">Expression Warning</font></strong>, click <strong><font color="#991e93">Yes</font></strong></font></p>
<p><font size="2">Repeat for each additional Forest being synchronised</font></p>
<p><font size="2"><strong><font color="#0000a0">Overriding User AccountEnabled and User Common Rules for sourceAnchor</font></strong></p>
<p>The process for creating a new rule to override each of the other rules is -</p>
<p><font size="2">Note the precedence value you're up to</font></p>
<p><font size="2">Click <strong><font color="#991e93">Add New Rule</font></strong></font></p>
<p><font size="2">Provide a meaningful <strong><font color="#991e93">Name</font></strong> (e.g. In from AD - msDS-SourceAnchor)</font></p>
<p><font size="2">Set the <font color="#991e93"><strong>Connected System</strong></font><font color="#333333"> to the Forest you're configuring for</font></font></p>
<p><font size="2">Set the <font color="#991e93"><strong>Connected System Object</strong></font><font color="#333333">&nbsp;</font>to <strong><font color="#991e93">user</font></strong></font></p>
<p>Set the <strong><font color="#991e93">Metaverse Object Type</font></strong> to <strong><font color="#991e93">person</font></strong></p>
<p><font size="2">Set the <strong><font color="#991e93">Link Type</font></strong> to <strong><font color="#991e93">Join</font></strong></font></p>
<p><font size="2">Set the <font color="#991e93"><strong>Precedence</strong></font></font></p>
<p>Click <strong><font color="#991e93">Next</font></strong> three times</p>
<p>On the <strong><font color="#991e93">Transformations</font></strong> page, click <strong><font color="#991e93">Add transformation</font></strong></p>
<p>Set <strong><font color="#991e93">FlowType</font></strong> to <strong><font color="#991e93">Expression</font></strong></p>
<p>Set <strong><font color="#991e93">Target attribute</font></strong> to <strong><font color="#008000">sourceAnchor</font></strong></p>
<p>Change the <strong><font color="#991e93">source</font></strong> expression to</p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">IIF(IsPresent([msExchRecipientTypeDetails]),IIF([msExchRecipientTypeDetails]=2,NULL,IIF(IsPresent([msDS-SourceAnchor]),IIF(IsString([msDS-SourceAnchor]),CStr([msDS-SourceAnchor]),ConvertToBase64([msDS-SourceAnchor])),IIF(IsString([objectGUID]),CStr([objectGUID]),ConvertToBase64([objectGUID])))),IIF(IsPresent([msDS-SourceAnchor]),IIF(IsString([msDS-SourceAnchor]),CStr([msDS-SourceAnchor]),ConvertToBase64([msDS-SourceAnchor])),IIF(IsString([objectGUID]),CStr([objectGUID]),ConvertToBase64([objectGUID]))))</pre>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa161.jpg"><img title="sa16" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa16" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa16_thumb1.jpg" width="604" height="402"></a></p>
<p>Click <strong><font color="#991e93">Add</font></strong></p>
<p><font size="2">If prompted with an <strong><font color="#991e93">Expression Warning</font></strong>, click <strong><font color="#991e93">Yes</font></strong></font></p>
<p>Repeat for each additional Forest being synchronised</p>
<p><font size="2"></p>
<p>
<hr>

<p>For reference it may be easier to understand the code if viewed with formatting. Note that the following formatting should <strong><font color="#c0504d">NOT</font></strong> be used in the expression box -</p><pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">IIF(
	IsPresent([msExchRecipientTypeDetails]),
	IIF(
		[msExchRecipientTypeDetails]=2,
		NULL,
		IIF(
			IsPresent([msDS-SourceAnchor]),
			IIF(
				IsString([msDS-SourceAnchor]),
				CStr([msDS-SourceAnchor]),
				ConvertToBase64([msDS-SourceAnchor])
			),
			IIF(
				IsString([objectGUID]),
				CStr([objectGUID]),
				ConvertToBase64([objectGUID])
			)
		)
	),
	IIF(
		IsPresent([msDS-SourceAnchor]),
		IIF(
			IsString([msDS-SourceAnchor]),
			CStr([msDS-SourceAnchor]),
			ConvertToBase64([msDS-SourceAnchor])
		),
		IIF(
			IsString([objectGUID]),
			CStr([objectGUID]),
			ConvertToBase64([objectGUID])
		)
	)
)</pre>
<p>Also understand that the conditions surrounding <strong><font color="#008000">msExchRecipientTypeDetails</font></strong> are used to handle linked mailboxes in a Resource Forest and are implemented by the AAD Connect setup wizard (we want to keep them).</p>
<p>
<hr>

<p><strong><font color="#0000a0">Creating a Rule to Write sourceAnchor back into msDS-SourceAnchor</font></strong></p>
<p>Now we have rules that correctly populate <strong><font color="#008000">sourceAnchor</font></strong> in the Metaverse, we need rules that write <strong><font color="#008000">sourceAnchor</font></strong> back into the on-premises <strong><font color="#008000">msDS-SourceAnchor</font></strong> attribute -</p>
<p>Change the rule editor filter to show <strong><font color="#991e93">Outbound</font></strong> rules</p>
<p>Take note of the precedence of the last rule in the list</p>
<p>Click <strong><font color="#991e93">Add new rule</font></strong></p>
<p>On the <strong><font color="#991e93">Description</font></strong> page, set the <strong><font color="#991e93">Name</font></strong> to <strong><em>Out to AD - msDS-SourceAnchor</em></strong></p>
<p>On the <strong><font color="#991e93">Description</font></strong> page, set <strong><font color="#991e93">Connected System</font></strong> to the Forest you're currently configuring the rule for</p>
<p>On the <strong><font color="#991e93">Description</font></strong> page, set <strong><font color="#991e93">Connected System Object Type</font></strong> to <strong><font color="#991e93">user</font></strong></p>
<p>On the <strong><font color="#991e93">Description</font></strong> page, set <strong><font color="#991e93">Metaverse Object Type</font></strong> to <strong><font color="#991e93">person</font></strong></p>
<p>On the <strong><font color="#991e93">Description</font></strong> page, set the <strong><font color="#991e93">Precedence</font></strong> to a value higher than the precedence noted above (this will need to increase for each new rule created for each Forest)</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa17.jpg"><img title="sa17" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa17" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa17_thumb.jpg" width="604" height="402"></a></p>
<p>Click <strong><font color="#991e93">Next</font></strong> three times</p>
<p>On the <strong><font color="#991e93">Transformation</font></strong> page, click <strong><font color="#991e93">Add transformation</font></strong></p>
<p>In the new transformation set the <strong><font color="#991e93">FlowType</font></strong> to <strong><font color="#991e93">Direct</font></strong>, the <strong><font color="#991e93">Target Attribute</font></strong> to <strong><font color="#008000">msDS-SourceAnchor</font></strong>, the <strong><font color="#991e93">Source</font></strong> to <strong><font color="#008000">sourceAnchor</font></strong> and the <strong><font color="#991e93">Merge Type</font></strong> to <strong><font color="#991e93">Update</font></strong></p>
<p>Click <strong><font color="#991e93">Add</font></strong></p>
<p>Repeat for each additional Forest being synchronised</p>
<p>Close the rules editor</p>
<p><strong><font color="#0000a0">Trigger a Full Sync</font></strong></p>
<p>Open a PowerShell prompt and execute</p>
<p><strong><em>Start-ADSyncSyncCycle -PolicyType Initial</em></strong></p>
<p>You should now find that users are successfully synchronised to Azure Active Directory and that <strong><font color="#008000">sourceAnchor</font></strong> is written back into <strong><font color="#008000">msDS-SourceAnchor</font></strong> for on-premises objects.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa19.jpg"><img title="sa19" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa19" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa19_thumb.jpg" width="604" height="106"></a></p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/sa20.jpg"><img title="sa20" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="sa20" src="https://msdnshared.blob.core.windows.net/media/2017/02/sa20_thumb.jpg" width="604" height="818"></a></p>
<p><strong><font color="#0000a0">Conclusion</font></strong></p>
<p>The rule changes configured here prefer <strong><font color="#008000">msDS-SourceAnchor</font></strong> as the <strong><font color="#008000">sourceAnchor</font></strong> source but use <strong><font color="#008000">objectGuid</font></strong> when <strong><font color="#008000">msDS-SourceAnchor</font></strong> is <strong><font color="#008000">NULL</font></strong>. <strong><font color="#008000">sourceAnchor</font></strong> is written back to <strong><font color="#008000">msDS-SourceAnchor</font></strong> in the on-premises object so that this attribute is always used after the initial sync, even after a migration of the user object between Forests.</font></font></p>]]></content:encoded>
    </item>
  </channel>
</rss>