Direct Access + Network Access Protection – part 4 – Potential issue with multiple CAs. Lessons learned.

Hi, Andrzej Kaźmierczak (KAZM) again with the last article on DA + NAP integration. In my previous articles I have successfully configured and tested Direct Access with NAP integration using single, enterprise Issuing CA (DA + NAP part 3. Single CA work flows explanation).

There is a Microsoft MSDN article (http://msdn.microsoft.com/en-us/library/cc731916.aspx) recommending to use a dedicated standalone subordinate CA for NAP health certificates. And so I did in my LAB to show that it isn’t that simple with multiple CAs around. This is how my LAB changed comparing to its original setup (DA + NAP part 2: LAB configuration and overview):

  1. I added a Standalone CA role on SRVNLS server that will be used only for issuing health certificates (CN=Standalone CA,C=PL):
    image1
  2. I have reconfigured Health Registration Authority to use Standalone CA and not to use enterprise certificate templates (which by the way can be used even with standalone CA):
    image2
  3. On the properties of the Standalone CA in the Security tab I gave the SRVNPS computer account full permissions. Also, in Policy Module tab I set Request Handling to “Follow the settings in the certificate template, if applicable. Otherwise, automatically issue the certificate” so that HRA request will not hit “Pending” state but will be automatically issued:
    image3

Everything is setup, so I start the client connected to the Internet (External) network and…. Hhmm… from the client machine I am able to connect to the SRVDC (Domain Controller) and to SRVNPS (NPS + HRA) – which means that infrastructure tunnel was working. Unfortunately I could only ping my internal server SRVFS as seen on below figure:

image4

Let’s start troubleshooting:

  1. Quick look on the Direct Access server, everything looks green and good:
    image5
  2. What about the Remote Access Clients Status console? Ok, so user doesn’t have User Kerberos Authentication Method which is used for accessing intranet resources – that confirms that user cannot connect to SRVFS, but have to look deeper to get the cause:
    image6
  3. On the SRVNPS I can see that HRA has approved the request and enrolled a health certificate to the user, which means that the user was able to send statement of health (infrastructure and management tunnels are working fine) and HRA can “talk” to the new standalone CA as well:
    image7
  4. I confirm on the Standalone CA that health certificates have been issued to the SRVNPS (on behalf of the user):
    image8
  5. But have the user received health certificate? Yes, he did:
    image9
  6. Let’s have a look in client’s Windows Firewall – there is no User Kerberos – so no corp/intranet tunnel is created:
    image10
  7. In Event viewer on the SERVER and CLIENT there are NO THINGS that can lead to the problem cause. On the client, IKE negotiations logs are not shown by default, but you can view the success or failure of IKE negotiations in the Event Viewer security log doing little trick. To view these events, enable success or failure auditing for the Audit logon events audit policy for your domain or local computer (http://technet.microsoft.com/en-us/library/cc737812(v=ws.10).aspx). After doing this I could see more useful data:
    1. EVENT ID 4653 “An IPsec main mode negotiation failed” with Failure reason “No policy configured”
    2. EVENT ID 4984 “An IPsec extended mode negotiation failed” with Failure reason “SA establishment is not authorized”

    image11

  8. So everything seems to be ok, the client machine receives health certificate, but still no corp/intranet tunnel is setup. This has to be something with the health certificate! New Standalone CA certificate is trusted for the client computer (it is added to the Trusted Root Certification Authorities). I verify certificates for Main Mode SA with “netsh adv mon show mmsa” and everything should be clear now:
    image12
  9. Although certificates issued by the Standalone CA are trusted by the client computer and operating system, but they are not trusted by the service to setup IPsec Security Association (http://technet.microsoft.com/en-us/library/cc759130(v=ws.10).aspx). Why? Well, let me remind you that Standalone CA was not configured as trusted for Direct Access. Only TST Root CA (my issuing CA that issued certificate for workstation used for infrastructure and management tunnel) is setup to be trusted in Direct Access configuration wizard:
    image13

But wait… what? so I’m using enterprise CA to issue computer certificate and a standalone CA to issue health certificates and there’s only one place in the DA configuration to setup a CA trust for that? How is that possible? The answer is very simple: in the DA configuration use common Root CA for both Enterprise and Standalone CA!

Lessons learned:

  1. If you want to have only 1 Issuing CA for both certificates: computer (workstation) certificate and a health certificate – that’s fine! You can even have a Standalone CA for that, but you have to MANUALLY issue all: SSL (even Direct Access IPHTTPS) and computer certificates as there is no way for auto enrolment feature with standalone CA.
  2. If you want to use 2 Issuing CAs – one for computer/workstation certificates and the second one for health certificates you should have a common offline Root CA, which would be pointed in the Remote Access Server Setup / Authentication page of the Direct Access configuration wizard. This is how my LAB environment should look like:
    image14
  3. If you don’t have root and have 2 separate CAs, you should reconsider changing your PKI architecture to meet the PKI best practice design (http://kazmierczak.eu/itblog/2012/08/22/the-dos-and-donts-of-pki-microsoft-adcs/) . Or you can take your current issuing CA and consider it as a root – so standard CA will become a subordinate to your issuing CA, and DA should be configured with your issuing CA certificate in the Remote Access Server – which is not recommended, but will do the trick.
  4. When troubleshooting, ALWAYS read carefully Root/Issuing CA names and confirm with certificate thumbnail which certificate you are using for what . Sometimes Root and Issuing CA names are very similar and is very easy to get confused which one is which.

Direct Access + Network Access Protection – part 3 – Single CA work flows explanation

This is a follow-up on previous Andrzej Kaźmierczak’s (KAZM) article DA + NAP part2: LAB configuration and overview , where I have described my LAB settings for explanation of how things are working for Microsoft Direct Access and Network Access Protection integration on Windows Server 2012 R2. You can use below steps as a part of troubleshooting activities for DA with NAP in your environment.

First of all read this great TechNet article by The Cable Guy on NAP and DA integration http://technet.microsoft.com/en-us/magazine/ff758668.aspx

Let’s start! User got DA GPOs from the Domain Controller and now switched to the Internet (External) network. This is how things should be working:

  1. When the user was inside corporate network, he received GPOs telling him to connect to Direct Access server when he is not connected to corporate network. To confirm being outside, client should not be able to resolve https://nls.tst.lab . Now client machine is aware that it is in the External (Internet) network. To confirm that run “netsh dns show state”:
    DANAPart03img01
  2. Client machine tries different transition technologies to setup Direct Access connection.
    I have disable IPv6 on client’s NIC, so no 6to4 is used. Also, in my LAB, client is connected directly to the same network as DA is located, so no NAT means no Teredo. Client will use IPHTTPS transition technology which simply speaking packages the data in an HTTPS tunnel. To achieve that, in GPO client has been configured Direct Access IPHTTPS URL to connect to (https://da.tst.com/iphttps). Its SSL certificate had to be issued by a trusted Root/Issuing CA for the client computer (in my case it had been issued by SRVPKI and CN=TST Root CA which is a trusted Root CA on the client).
  3. Run “ipconfig /all” to see if the IPHTTPS has configured itself with IPv6 address:
    DANAPart03img02
  4. The user should have setup infrastructure tunnel using “TST Workstation Authentication” certificate from the “TST Root CA, C=PL” Issuing CA that had been issued to the workstation with autoenrolment feature and user should be able to access SRVDC (Domain Controller).
  5. In NAP’s GPOs I have setup Health Registration and Trusted Server Group to point to https://srvnps.tst.lab/domainhra/hcsrvext.dll so once NAP client is started, DA client connects to this URL creating management tunnel. With this tunnel, SRVNPS (NPS + HRA) is accessible because it has been added to Management Servers in Direct Access configuration wizard. Management tunnel is created using “TST Workstation Authentication” from the “TST Root CA, C=PL” Issuing CA. At this point I am able to access both SRVDC and SRVNPS servers – if you try on your own, do not use “ping” command, because every server (that is ICMP enabled) will respond– even without corp/intranet tunnel enabled. Use share or a website if server has IIS role installed.
  6. The user is connected to SRVNPS and sends to HRA SoH (Statement of Health). The HRA sends it internally to the NPS health policy server (in my case it is one and the same server). NPS evaluates whether client computer matches the System Health Validators. I have setup policies letting every computer in, so every computer is compliant. NPS sends results to the HRA service. When the client computer is compliant, the HRA on behalf of the user, enrols health certificate using my “TST Root CA, C=PL” Issuing CA and “DA HRA Certificate” health certificate template. The certificate is sent back to the user in the management tunnel. You can confirm this by going to the CA server, open CA console an investigate Issued Certificates container. Also you can verify those on the HRA server in System Event Viewer. Event 22 “The Health Registration Authority has approved the request with the correlation-id-…. The Network Policy Server has indicated that the client should be given full network access” should be there. See figure below:
    DANAPart03img03
  7. Now, on the client computer I run certificate snap-in for the Local Computer store and verify that the client possesses 2 certificates, both issued by “TST Root CA” – THIS IS IMPORTANT!:
    DANAPart03img04

    1. Workstation/Computer certificate that had been issued only once through autoenrolment and stays in the certificate store. This one gives client Infrastructure and Management tunnels.
    2. System Health Authentication which HRA enrolled after confirming that client computer is complaint. This one gives us Corp/intranet tunnel (to other internal resources, such as SRVFS)
  8. From Client machine I initiate connection to one of my internal resources: \\srvfs.tst.lab . Access to such resources is possible because 3rd tunnel – corp/intranet tunnel is setup using health certificate issued through the HRA. There is a very good TechNet article ton how to check tunnels on the client: http://technet.microsoft.com/en-us/library/ee844114(v=ws.10).aspx . To verify tunnels I run “netsh adv mon show mmsa” command and as an output I can see computer certificate and health certificate that is used for UserKerb authentication (connection to \\srvfs.tst.lab) successfully. What is important is that those certificates are confirmed to be Health Certificates, see below figure:
    DANAPart03img05
    Above tunnels can also be confirmed in the Windows Firewall Monitoring / Security Associations / Main Mode:
    DANAPart03img06
  9. From Direct Access Remote Client Status console I finally confirm that the client is connected and using User Kerberos as Authentication Method:
    DANAPart03img07

Great! Everything’s working – what’s the problem then? Well, Microsoft in this MSDN article http://msdn.microsoft.com/en-us/library/cc731916.aspx recommends that “ (…)For optimal performance, a dedicated standalone subordinate CA should be used to issue health certificates.” This article also guides you on how to Configure Standalone CA, wait time, validity period, but there is not a single word on how new CA should fit into Direct Access with NAP integration.

To my environment I added a standalone CA and the very interesting results of what happened next are described in my last article DA + NAP: Potential issue with multiple CAs. Lessons learned

Direct Access + Network Access Protection – part 2 – LAB configuration and overview

This is Andrzej Kaźmierczak’s (KAZM) second part of my DA + NAP articles. You can read about overview in the first part: DA + NAP part 1: Introduction.

To get better overview and learn how to configure Direct Access with NAP follow those TechNet articles (even though some of them apply to Windows Server 2008 R2):

This is how my LAB is configured (the main parts of configuration are described only):

DANAP01

To configure my LAB, first of all I have installed and confirmed that Direct Access is working fine without NAP. After that, I have added SRVNPS server and switched DA to integrate with NAP server.

Network

  • Internal network: 12.12.12.0/24
  • External (Internet) network: 137.0.0.0/24

Servers and Roles

Server OS Role Configuration
SRVDC Windows Server 2012 R2 Domain Controller FFL, DFL: 2008R2Domain: tst.lab
SRVPKI Windows Server 2012 R2 Enterprise Root CA used for issuing certificates for client machines and health certificates.SRVPKI is used for web enrollment and CDP/AIA paths publishing. CN= TST Root CA, C=PL2 NICs (Internal, External)

http://pki.tst.com/CertEnroll/*.crt/crl

TST Workstation Authentication certificate template for DA with EKU:

  • Client Authentication
  • Server Authentication

DA HRA Certificate template for NPS statement of health with EKU:

  • Client Authentication
  • System Health Authentication
SRVNLS Windows Server 2012 R2 Simple HTTPS website acting as NLS. https://nls.tst.lab
SRVFS Windows Server 2012 R2 File share and HTTPS site used for testing DA connection. \\srvfs.tst.lab\https://srvfs.tst.lab
SRVNPS Windows Server 2012 R2 NPS and HRA roles for Direct Access. System Health Validator: Default one, configured to allow any client computer (no firewall, no updates required, etc.)HRA detailed configuration see below
SRVDA Windows Server 2012 R2 Direct Access server https://da.tst.com/IPHTTPS2 NICs (Internal, External)

See detailed configuration below

Client Windows 7 Enterprise Client computer Forced GPOs before switching to external networkClient machine belongs to DA_Clients domain group

Direct Access server has been configured in the following way (if some setting is not mentioned, it has a default value):

  1. Remote Clients
    1. Deployment Scenario
      1. Deploy full Direct Access for client access and remote management – checked
    2. Select Groups
      1. Group: DA_Clients
      2. Enable Direct Access for mobile computers only – disabled (I could not test on client VM if this setting is enabled)
      3. Use force tunneling – enabled (my own requirement, could be disabled)
    3. Network Connectivity Assistant
      1. Allow Direct Access clients to use local name resolution – enabled
  2. Remote Access Setup
    1. Network Topology
      1. Network topology: Edge
      2. DA address: da.tst.com
    2. Network adapters
      1. IPHTTPS is not self-signed (issued by my SRVPKI), CN= da.tst.com
    3. Authentication
      1. As you can see I have chosen to use TST Root CA and enabled the “Enforce corporate compliance for Direct Access clients with NAP” option which simply enables NAP integration with DA.
      2. I didn’t choose “Use an intermediate certificate” because in this particular scenario I am having Root CA which issues certificates (try not to be confused). In any other well – designed PKI environment, one would use Subordinate Certification Authority as Issuing CA, NOT Root CA itself (this was done here only for LAB purposes and is crucial to understand the issue I’m describing in that article). If you have offline Root CA and separate online Issuing CA, you would need to enable “Use an intermediate certificate” option. Remember, if you do, the Browse button will show you only certificates that are stored in the “Intermediate Certification Authorities” Windows certificate store, not in the “Trusted Root Certification Authorities” store. I also have enabled Windows 7 computers, because this is OS of my client machine:
        DANAP02
  3. Infrastructure Servers
    1. Network Location Server
      1. The network location server is deployed on a remote web server: https://nls.tst.lab
    2. DNS
      1. Default suffixes
      2. Use local name resolution if the name does not exist in DNS or DNS servers are unreachable when the client computer is on a private network (recommended) – enabled
    3. DNS Suffix Search List
      1. Default settings
    4. Management
      1. Management servers: srvnps.tst.lab (it has to be available in management tunnel for the client to issue a health certificate for the user that will let you access corp/intranet tunnel).

Health Registration Authority configuration:

  • Added TST Root CA,
  • Enabled to use DA HRA Certificate template (duplicated and configured manually on SRVPKI):DANAP03

The setup is done (above are described only major parts of it). You can now go to the next article: DA + NAP part 3: Single CA work flows explanation

Direct Access + Network Access Protection – part 1 – Introduction

Hi, Andrzej Kaźmierczak (KAZM) here. Recently I’ve been doing some deep dive troubleshooting of two amazing technologies working together: Microsoft Direct Access and Network Access Protection. There is one thing I want to share about design of Certification Authorities for such implementation and a little bit of how to troubleshoot Direct Access client connection.

A few important words on those two technologies:

A really, really good overview on Direct Access can be find in Tim Warner’s YouTube CBT Nuggets https://www.youtube.com/watch?v=saYk4d3h6sY

Let me share what’s this series of articles is all about. It is divided into 4 sections:

  1. DA + NAP part 1: Introduction
    This introduction.
  2. DA + NAP part 2: LAB configuration and overview
    I do a quick overview of my Direct Access and NAP settings and general configuration on the LAB setup which is a core for further certificate issue investigation.
  3. DA + NAP part 3: Single CA work flows explanation
    In this section I am guiding through the step by step process happening under the hood of user getting access to internal resources using Direct Access with NAP policies. This scenario is working fine, as long as you use single CA.
  4. DA + NAP part 4: Potential issue with multiple CAs. Lessons learned.
    The last section describes what was the problem when having different CAs and what is the right design for such scenarios.

Enjoy!

P.S.

TL;DR version: What happened was that client didn’t show any error at all, had all required certificates (computer and health) issued but couldn’t setup the corp/intranet tunnel to internal resources with Direct Access client. There was no indication of any kind of errors neither on PKI, NPS/HRA, DA nor client machine side. At the end of the day it turned out it’s always about certificates. You can’t have 2 separated CAs: one for issuing machine certificates (enterprise CA with auto enrollment) and a separate CA for Health certificates (standalone CA) UNLESS THOSE DON’T HAVE COMMON ROOT CA. If they both are subordinate CAs to the same Root CA – that’s fine, but if they are separate machines and have nothing in common it is impossible to set DA with NAP to utilize those two.

Security Issue – Yammer Account Details Unauthorized Change

Hi, Andrzej (KAZM) here.

During testing Yammer with DSync I have found a security issue letting anyone to change anyone’s other Yammer Account Details in an unauthorized way, knowing only user’s e-mail. In few words: you could change anyone’s details of Yammer account, including Name and GivenName, in an unauthorized way.

NOTE: Issue has already been fixed/patched and below I am demonstrating Proof of Concept of the way someone could exploit this security gap.

Products that were affected: Yammer Enterprise DSync.

Problem description

The scenario begins when I create a user in Active Directory with Name=New_Name, GivenName=New_GN and Description=My_new_description, Work phone=123456 and (IMPORTANT) with E-mail attribute of an email of the real user (that already has and uses a Yammer account). This email can be in any domain (eg. @predica.pl, @microsoft.com). Let’s say I use my Predica’s email: akazmierczak [at] predica.pl.

During Dsync synchronization, details such as Name, GivenName, Description, Work number for that real user (my account) are OVERWRITTEN in Yammer to reflect details provided in account create in Active Directory. Must mention here that I AM NOT an administrator of predica.pl Yammer Network and I do not need to know user’s password.

After synchronization is complete, user akazmierczak [at] predica.pl receives welcome email with message to join adatum.com.pl Yammer Network, but his Yammer account details are already changed to match Active Directory users details. So instead of “Andrzej Kaźmierczak” account one can see “New_Name New_GN” on all my Yammer networks! Moreover, details of my account will include things configured in Active Directory (My_new_description and with Work Phone as “123456”).

It also means that users account and all his history of posts, comments, likes, etc. will suddenly be seen on all users’ Yammer networks as “New_Name New_GN”.

Environment details

Office365

  • Yammer Enterprise is enabled in Office365 tenant
  • Domains
    • yammerlab.onmicrosoft.com
    • Adatum.com.pl (domain added and verified)
  • Accounts
    • Yammer_service@adatum.com.pl is a global admin in O365 and also a Verified admin in Yammer. This account is also used by DSync

Domain Controller VM

  • OS: Windows Server 2012 R2
  • FFL, DDL: Windows 2008 R2

YammerSync VM

  • OS: Windows Server 2008 R2
  • Dsync Configuration
    • version: Yammer.DirSync_v3-0-8
    • Yammer Settings
      • Logged in as yammer_service@adatum.com.pl account in adatum.com.pl domain
    • Directory Settings
      • Only 1 Directory Connection to DC
      • Using dedicated yammerservice service account created in Active Directory
    • globalsettings.config.json File Settings
      • Queries Section left unchanged with attribute (“Filter”: “mail=*”, )
      • DirectoryAttributeMap Section left unchanged with default mapping settings
      • SyncSettings Section left unchanged with attributes (EnableAdds, EnableUpdates, EnableSuspends) set to “true”
      • AttributePreferences Section changed, so that all attributes (Prefer*) are set to “true”
      • Other settings left default/unchanged

All servers are patched up until 01.03.2014

Video with PoC

The issue has been reported to Microsoft:

  • 02.03.2014 Ticket #114030211227295 (Microsoft USA support)
  • 02.03.2014 Microsoft performed a call with me with long discussion explaining the problem and steps to reproduce. Advised to send some screenshots, video or links, so Microsoft can further investigation on the issue
  • 03.03.2014 The same video as above was uploaded to Microsoft DTM and informed Microsoft Support
  • 23.04.2014 Microsoft informed me that issue was fixed
  • 24.04.2014 Tried to reproduce bug but it is fixed now:

YammerDirSync

Directory Sync and Password Sync Cookbook – part 7 – Important FAQ

Hi, Andrzej (KAZM) again 😉 … with 7th part of Directory Sync and Password Sync – YES, that is the final! 😀

  1. Directory Sync and Password Sync Cookbook – part 1 – Overview and SSO Decisions
  2. Directory Sync and Password Sync Cookbook – part 2 – Preparation
  3. Directory Sync and Password Sync Cookbook – part 3 – UPN Sync Scenarios
  4. Directory Sync and Password Sync Cookbook – part 4 – Installation
  5. Directory Sync and Password Sync Cookbook – part 5 – Configuration and Operations
  6. Directory Sync and Password Sync Cookbook – part 6 – Troubleshooting
  7. Directory Sync and Password Sync Cookbook – part 7 – Important FAQ
  • In this article you use commands like “Set-MsolUserPrincipalName -UserPrincipalName oldUPN PrinciaplName newUPN” but it is not working for me. What is wrong?
    • To be able to run this and similar commands you need to connect to Windows Azure Active Directory through PowerShell:
      • Run PowerShell
      • Execute Import-Module MSOnline ,
      • $AdminCredentials = Get-Credential,
      • Type in your O365 Admininistrator credentials,
      • Run Connect-MsolService –Credential $cred,
      • And now you can run required command.
  • How can I add Alternative UPN Suffixes to my AD?
  • Is there any way I can install DirSync using my own SQL servers (I have high availability for databases, less SQL limitations and other cool features)?
  • Which users will be synchronized with DirSync?
    • DirSync does not synchronize accounts with User must change password at next logon option enabled,
    • DirSync will not sync passwords for users that are federated entities (have their UPN as public domain which is added and verified in O365 and converted to federated). Users can only be either SSO-enabled or Password Sync,
    • DirSync will sync all users from domain (unless OU/attribitues filtering is configured).
  • What is MSOL_AD_SYNC account?
    • This account has read and synchronization permissions to the Active Directory and is used for noticing password changes in your domain.
    • You should not change the password of that MSOL_AD_SYNC service account.
    • Important! If you force password changes (for example with a GPO) and MSOL_AD_SYNC account gets its password changed, you must run the Directory Sync Configuration Wizard again.
  • I have a different Password Complexity Policies in AD than in O365. Which one will be used?
    • Active Directory Password Complexity policy will override O365 password complexity policy.
  • After implementing DirSync what happens to current users that had been already created directly in the cloud?
    • Users created and managed in the cloud remain with cloud (not synchronized) password and are under subjected to cloud password complexity policy and will not be synchronized.
  • What is the default time of synchronization?
    • DirSync synchronizes users every 3 hours, Password Sync synchronizes password hashes every 3 minutes.
  • After 90 days users stopped synchronizing. What happened?
    • Your Office 365 Global Administrator account password, you used for configuring DirSync tool, has expired. Please refer to Preparation and then Troubleshooting part of this article on how to fix this.
  • Start-OnlineCoexistenceSync command doesn’t return anything in the Powershell session. Is that normal, is my synchronization working?
    • Yes, this is normal. If you see no errors, then probably everything is fine and miisclient starts running Management Agents.
  • What happens if the user is blocked or deleted in AD?
    • When the user is blocked or deleted in AD, after DirSync sync he/she is also blocked or deleted in O365.
  • Users with expired passwords in AD may be able to still login to O365 with old (expired) password. Why is this happening?
    • After account is synced to O365, its password is set to “never expire” and is synchronized only when the user changes password in AD. So if password expires in AD, but user doesn’t change it, it is still valid in O365.
  • Can I change passwords manually for users in Office 365? How?
    • If the user/administrator changes his/hers password in the cloud it will NOT get override after next Password Sync sync (3 minutes). Password will get changed only after you run manual full password sync (Set-FullPasswordSync command and FIM Synchronization Service restart) or after user changes password.
    • To change password in Office 365 manually run PowerShell command Set-MsolUserPassword -userPrincipalName user@yourdomain.onmicrosoft.com –ForceChangePassword $false -NewPassword “NewSecurePasswordHere”.
  • Is there any changelog or version realeas history for DirSync?
  • Is there any information on what attributes are synced by DirSync?

I hope you have enjoyed my cookbook :)

Best regards,

Andrzej (KAZM)

Directory Sync and Password Sync Cookbook – part 6 – Troubleshooting

Hi, Andrzej (KAZM) again 😉 … with 6th part of Directory Sync and Password Sync.

  1. Directory Sync and Password Sync Cookbook – part 1 – Overview and SSO Decisions
  2. Directory Sync and Password Sync Cookbook – part 2 – Preparation
  3. Directory Sync and Password Sync Cookbook – part 3 – UPN Sync Scenarios
  4. Directory Sync and Password Sync Cookbook – part 4 – Installation
  5. Directory Sync and Password Sync Cookbook – part 5 – Configuration and Operations
  6. Directory Sync and Password Sync Cookbook – part 6 – Troubleshooting
  7. Directory Sync and Password Sync Cookbook – part 7 – Important FAQ
  • General advices
  • IDfIX
    • Wen you run the IdFix, “Format” is displayed in the Error column for many objects. Solution: This issue occurs if the email address of the object is not a valid, publicly routed email address. If you are not planning to change AD suffixes, you can ignore it.
  • DirSync/Password Sync
    • During installation
      • Exception has been thrown by the target of an invocation”. Solution: add indicated in Event Viewer MSOL_AD_SYNC domain account to the local Administrators group of DirSync server and retry.
    • During synchronization
      • Missing-partition-for-run-step” when used filtering OUs for DirSync. Solution: if you have many child domains in your forest and you don’t want to synchronize from some of them so you just uncheck those domains, you will get this error. At least one OU in each domain must be checked for sync, so to avoid this error just create empty OU in each domain and then in filtering options select this OU only (no users will be synced),
      • Stopped-extension-dll-exception” during Windows Azure Active Directory Connector, Delta Import Delta Sync step in miisclient.exe. Solution: You have to change password of Office365 account that was used to configure DirSync (it has expired). After changing that password in Office365, set this account to have never expiring password (please refer to Preparation part of my article), Run Directory Sync Configuration Wizard on the desktop of DirSync server and provide new credentials of Administrator account and then restart FIM Sync Service. Also with this error you can get following entries in Event Viewer:
        • Event ID 0. The user name or password is incorrect. Verify your user name, and then type your password again GetAuthState() failed with -214718668 state. HResult:0. C(0x80048821)
        • Event ID 109. Failure while importing entries from Windows Azure Active Directory. Exception: Microsoft.oOnline.Coexistence.ProvisionException: The user name or password is incorrect. Verify your user name, and then type your password again.
        • Event ID 6803. The management agent “Windows Azure Active Directory Connector” failed on run profile “Delta Import Delta Sync” because the server encountered errors.

Directory Sync and Password Sync Cookbook – part 5 – Configuration and Operations

Hi, Andrzej (KAZM) again 😉 … with 5th part of Directory Sync and Password Sync.

  1. Directory Sync and Password Sync Cookbook – part 1 – Overview and SSO Decisions
  2. Directory Sync and Password Sync Cookbook – part 2 – Preparation
  3. Directory Sync and Password Sync Cookbook – part 3 – UPN Sync Scenarios
  4. Directory Sync and Password Sync Cookbook – part 4 – Installation
  5. Directory Sync and Password Sync Cookbook – part 5 – Configuration and Operations
  6. Directory Sync and Password Sync Cookbook – part 6 – Troubleshooting
  7. Directory Sync and Password Sync Cookbook – part 7 – Important FAQ

This part of DirSync and Password Sync articles describes most common operations you may be doing for DirSync and Password Sync implementation.

  1. Change default 3 hours DirSync scheduled run
    1. Navigate to C:\Program Files\Windows Azure Active Directory Sync\ ,
    2. Edit Microsoft.Online.DirSync.Scheduler.exe.config file,
    3. Change “3:0:0” in the key <add key=”SyncTimeInterval” value=”3:0:0″ /> in hh:mm:ss convention for scheduling next sync.
  2. Change UPN in O365
    1. When UPN is not publicly resolved, users with UPN @yourcompany.onmicrosoft.com suffix will be created in Office 365,
    2. Important! O365 Administrators can change @yourcompany.onmicrosoft.com UPNs in O365, but only to the newUPNs of the domains that are already added and verified in O365. Use PowerShell command Set-MsolUserPrincipalName -UserPrincipalName oldUPN PrinciaplName newUPN ,
    3. Users will use newUPN to sign in to the domain,
    4. Future DirSync synchronizations will not override manually set newUPN. However, if you have local UPN in AD and change UPN in O365 to newUPN and then you set AD UPN from local to public and then from public to local, the newUPN in O365 will get set to @yourcompany.onmicrosoft.com (because in AD it will be local and DirSync will detect changes after manual modification of newUPN).
  3. Manually run DirSync
    1. Run PowerShell console as Administrator,
    2. Change folder to C:\Program Files\Windows Azure Active Directory Sync\,
    3. Run .\DirSyncConfigShell.psc1 ,
    4. In new window, that is opened, execute Start-OnlineCoexistenceSync command,
    5. Verify synchronization is started
      1. Run C:\Program Files\Windows Azure Active Directory Sync\SYNCBUS\Synchronization Service\UIShell\miisclient.exe and view Operations tab
      2. Run Event Viewer and look for Event ID 0 with following details
        1. MA: Active Directory Connector Profile: Delta Import Delta Sync Result: success,
        2. MA: Windows Azure Active Directory Connector Profile: Delta Import Delta Sync Result: success,
        3. MA: Windows Azure Active Directory Connector Profile: Export Result: success.
      3. Run MOP and confirm that users have been synced.
  4. Manually run Password Sync
    1. Run PowerShell console as Administrator,
    2. Change folder to C:\Program Files\Windows Azure Active Directory Sync\,
    3. Run .\DirSyncConfigShell.psc1 ,
    4. Execute Set-FullPassword Sync command,
    5. Run services.msc and restart the FIM Synchronization Service on your DirSync server,
    6. In Event viewer you should see
      1. Event ID 656 (Password Sync Requests),
      2. Event ID 657 (Password Sync Results).
  5. Deactivate DirSync
    1. You can use Office 365 Portal (MOP) to deactivate DirSync,
    2. You can use Powershell command Set-MsolDirSyncEnabled –EnableDirSync $false.
  6. 6. Deactivate Password Sync
    1. To disable password sync just re-run the configuration wizard and uncheck the option Enable Password Sync.
  1. Directory Sync and Password Sync Cookbook – part 1 – Overview and SSO Decisions
  2. Directory Sync and Password Sync Cookbook – part 2 – Preparation
  3. Directory Sync and Password Sync Cookbook – part 3 – UPN Sync Scenarios
  4. Directory Sync and Password Sync Cookbook – part 4 – Installation
  5. Directory Sync and Password Sync Cookbook – part 5 – Configuration and Operations
  6. Directory Sync and Password Sync Cookbook – part 6 – Troubleshooting
  7. Directory Sync and Password Sync Cookbook – part 7 – Important FAQ

Directory Sync and Password Sync Cookbook – part 4 – Installation

Hi, Andrzej (KAZM) again 😉 … with 4th part of Directory Sync and Password Sync.

  1. Directory Sync and Password Sync Cookbook – part 1 – Overview and SSO Decisions
  2. Directory Sync and Password Sync Cookbook – part 2 – Preparation
  3. Directory Sync and Password Sync Cookbook – part 3 – UPN Sync Scenarios
  4. Directory Sync and Password Sync Cookbook – part 4 – Installation
  5. Directory Sync and Password Sync Cookbook – part 5 – Configuration and Operations
  6. Directory Sync and Password Sync Cookbook – part 6 – Troubleshooting
  7. Directory Sync and Password Sync Cookbook – part 7 – Important FAQ
  1. Download the latest version of DirSync
    1. From O365 portal
      1. Login to O365 as Administrator,
      2. Go to Users and groups,
      3. Click Setup next to the Active Directory Synchronization,
      4. You should see DirSync download button.
    2. Directly from here.
  2. Run installation
    1. Run installation file as AD Enterprise Admin (make sure to click run as administrator),
    2. During installation you will be asked to provide credentials
      1. Windows Azure Active Directory Administrator Credentials – which means Global Administrator in Office 365. Here you should enter credentials of the Office 365 Synchronization Service account which you created in Preparation part of my article,
      2. Windows Active Directory Enterprise Administrator Credentials – which means exactly what is says.
    3. Installation can take up to 15 minutes because Microsoft SQL Express 2012 SP1 will be installed locally on the server as a default database engine,
    4. Important! If you want to use your own SQL server, please refer to Important FAQ part of my article,
    5. If you encounter any problems, please see Troubleshooting part of my article.
  3. After DirSync is installed log on and log off from DirSync server so that new security token will be granted for your admin account.
  4. Run configuration wizard
    1. Make sure you select the Enable Password Synchronization option,
    2. Do not select Enable Hybrid Deployment on the Hybrid Deployment page, unless you want to sync some changes back from O365 to your Active Directory,
    3. Important! Do not select “Synchronize directories now” on the Finished page. We need to create some OU filtering, unless you want to synchronize all OUs in your forest,
    4. Some of common installation issues and errors are described in Troubleshooting part of my article.
  5. Configure users filtering based on
    1. OU filtering – described in Microsoft TechNet “Configure filtering for directory synchronization“. In short:
      1. Run C:\Program Files\Windows Azure Active Directory Sync\SYNCBUS\Synchronization Service\UIShell\miisclient.exe ,
      2. Click Management Agents,
      3. Double click Active Directory Connector,
      4. Click Configure Directory Partitions and on the right pane click Containers,
      5. Log in using Enterprise admin credentials (Enterprise, not Domain admin because this user can view the entire forest and perform the filtering within any domain within the forest),
      6. Select OUs you want to synchronize, click OK.
      7. If you have multi child domain forest, please refer to Troubleshooting part of my article,
      8. Important! You need to do Full Import and Full Sync, so right click on the Active Directory Connector, select Run and choose Full Import Full Sync, and then click OK.
    2. UPN domain suffixes
      1. If you want to set a filter based on UPN domain suffixes, please follow “DirSync filtering and UPN domain suffixes” article by Loryan Strant on how to achieve this.
  6. Run DirSync manually. Please refer to Configuration and Operations part of my article on how to do that.
  7. After configuration Password Sync performs automatic Full Sync of all users (actually, those who are in scope of DirSync filter).When users are synced, assign required licenses in O365.

Directory Sync and Password Sync Cookbook – part 3 – UPN Sync Scenarios

Hi, Andrzej (KAZM) again 😉 … with 3rd part of Directory Sync and Password Sync.

  1. Directory Sync and Password Sync Cookbook – part 1 – Overview and SSO Decisions
  2. Directory Sync and Password Sync Cookbook – part 2 – Preparation
  3. Directory Sync and Password Sync Cookbook – part 3 – UPN Sync Scenarios
  4. Directory Sync and Password Sync Cookbook – part 4 – Installation
  5. Directory Sync and Password Sync Cookbook – part 5 – Configuration and Operations
  6. Directory Sync and Password Sync Cookbook – part 6 – Troubleshooting
  7. Directory Sync and Password Sync Cookbook – part 7 – Important FAQ

Since users and passwords are synced to O365, users can easily login to O365 portal using their AD credentials. But do they?

Here is an outcome of the test I conducted with different UPN and E-mail attributes in Active Directory. In Office 365 I have fabrikam.com.pl domain added and verified.

Table below shows what would be O365 UPN (login for O365 user) depending on AD UPN and E-mail attributes:

No. AD UPN AD EMAIL O365 UPN
1 Andrzej
@local.domain
None Andrzej
@yourcompany.onmicrosoft.com
2 Andrzej
@local.domain
Andrzej.Kazmierczak
@local.domain
Andrzej.Kazmierczak
@yourcompany.onmicrosoft.com
3 Andrzej
@local.domain
Username
@gmail.com
Username
@yourcompany.onmicrosoft.com
4 Andrzej
@local.domain
Andrzej.Kazmierczak
@fabrikam.com.pl
Andrzej.Kazmierczak
@yourcompany.onmicrosoft.com
5 Andrzej
@fabrikam.com.pl
None Andrzej
@fabrikam.com.pl
6 Andrzej
@fabrikam.com.pl
Andrzej.Kazmierczak
@local.domain
Andrzej
@fabrikam.com.pl
7 Andrzej
@fabrikam.com.pl
Andrzej.Kazmierczak
@fabrikam.com.pl
Andrzej
@fabrikam.com.pl
8 Andrzej
@fabrikam.com.pl
Username
@gmail.com
Andrzej
@fabrikam.com.pl

Hmm, interesting. So what happens if we don’t have public UPN suffix (f.e.@local.domain) in AD and we have 2 users with different UPNs but the same email prefix name? See table below:

No. AD UPN AD EMAIL O365 UPN
1 Andrzej
@local.domain
Username
@gmail.com
Username
@yourcompany.onmicrosoft.com
2 Andrzej2
@local.domain
Username
@outlook.com
Not synced Error / Email from unhealthy Sync
3 Andrzej3
@local.domain
Username
@yahoo.com
Not synced Error / Email from unhealthy Sync

What will happen is that first user will get synchronized, but all the other users with same email prefix (Username in example above) name will not be synced and error will be recorded in Event Viewer as well Office 365 Global Administrators will receive emails with unhealthy sync information.

Based on above, ask yourself wouldn’t it be better for your company to change AD UPN suffixes to public ones?