{"id":1690,"date":"2011-09-13T06:34:46","date_gmt":"2011-09-13T06:34:46","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=1690"},"modified":"2011-11-21T06:00:19","modified_gmt":"2011-11-21T06:00:19","slug":"minimalist-office-365-with-adfs-sandbox","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/minimalist-office-365-with-adfs-sandbox","title":{"rendered":"Minimalist Office 365 with ADFS sandbox"},"content":{"rendered":"<p>It&#8217;s kind of killing my laptop, but I have managed to get my virtual lab environment working with ADFS to an Office 365 trial. I think I&#8217;ve probably got the bare minimum config going on here, so for reference, here&#8217;s what I had to do.<\/p>\n<p><!--more--><\/p>\n<h3>Ingredients<\/h3>\n<ul>\n<li>A host computer &#8211; in my case my Win7 laptop running Oracle VirtualBox,<\/li>\n<li>An Office 365 trial,<\/li>\n<li>A real live domain name that is resolvable on the internet and which you (or someone who likes you) has admin access to (this will be necessary for the <a href=\"http:\/\/onlinehelp.microsoft.com\/en-us\/office365-enterprises\/gg584188.aspx\">verification process<\/a>),<\/li>\n<li>A SSL certificate for said domain name,<\/li>\n<li>The following VMs:<\/li>\n<ul>\n<li>DC + ADFS: Win2008R2, 1024 MB of RAM (I couldn&#8217;t get ADFS to install with only 512MB), virtual network and internet access<\/li>\n<li>DirSync: Win2008x32, 512 MB of RAM, virtual network and internet access<\/li>\n<li>Workstation: Win7, 512 MB of RAM, virtual network and internet access<\/li>\n<\/ul>\n<\/ul>\n<blockquote><p>Note: there is now a 64 bit version of DirSync so it should be possible to install that\u00c2\u00a0on the DC as well.<\/p><\/blockquote>\n<h3>AD<\/h3>\n<p>The name of my virtual AD domain did not match the external domain I had to use for ADFS. This does not matter &#8211; just add the external domain as a UPN suffix to AD.<\/p>\n<p>You then also need to make sure any account you want to test with has a UPN of <em><a href=\"mailto:accountname@myrealdomain.com\">accountname@myrealdomain.com<\/a><\/em>.<\/p>\n<h3>Certificate<\/h3>\n<p>I was under the impression that I&#8217;d need a public cert so Microsoft would trust my ADFS server, so I got a free one month cert from <a href=\"http:\/\/www.freessl.com\">freessl<\/a>. However I can see now that the cert is only used for internal communication between my ADFS server and my client, so I think now if I&#8217;d generated one in my own CA it would have been fine. The only provisio is the name of the cert must match <em>myrealdomain.com<\/em>.<\/p>\n<h3>ADFS<\/h3>\n<p>The <a href=\"http:\/\/onlinehelp.microsoft.com\/en-us\/office365-enterprises\/ff652539.aspx\">instructions <\/a>walk you through a proper setup with NLB and federation proxies. With a laptop lab I did none of this. I just have the one federation server running on my DC. Pretty much all I did was:<\/p>\n<ol>\n<li>Installed ADFS &#8211; make sure you choose &#8220;first server in a farm&#8221;,<\/li>\n<li>Installed the SSL certificate for <em>myrealdomain.com<\/em> onto the default IIS website,<\/li>\n<li>Ran the ADFS wizard,<\/li>\n<li>Ran the powershell cmdlets to add and federate the domain in Office 365 (<a href=\"http:\/\/onlinehelp.microsoft.com\/en-us\/office365-enterprises\/ff652560.aspx\">documentation<\/a>).<\/li>\n<\/ol>\n<h3>Internet Firewall<\/h3>\n<p>Another thing I was mistaken about was thinking\u00c2\u00a0the Microsoft Federation gateway would need to talk directly to my ADFS server but actually it doesn&#8217;t &#8211; the communication is between the client browser and ADFS. I&#8217;m not allowing external devices to access Office 365 via my lab, so I don&#8217;t need to grant access to my ADFS VM through the network firewall. Which is a relief!<\/p>\n<h3>DNS<\/h3>\n<p>The domain <em>myrealdomain.com<\/em> has a real, live ip address on the internet, however in my virtual network I want it to resolve to the internal ip address of my ADFS server. To do this I:<\/p>\n<ul>\n<li>Created a Primary Zone for <em>myrealdomain.com<\/em> in my domain&#8217;s DNS service,<\/li>\n<li>Created an A record in the zone pointing to the internal ip address of the ADFS server,<\/li>\n<li>Set a forwarder to the external DNS server, and<\/li>\n<li>Made sure all VMs in my virtual network used the virtual DC for DNS, rather than going straight to the external DNS.<\/li>\n<\/ul>\n<h3>DirSync<\/h3>\n<p>As I noted above, when I wrote this article there was only 32 bit DirSync. Now we finally have a 64 bit version. It should run on the DC but I haven&#8217;t tried it.<\/p>\n<p>DirSync is damn easy to install. Just follow the <a href=\"http:\/\/onlinehelp.microsoft.com\/en-us\/office365-enterprises\/ff652545.aspx\">instructions<\/a>.<\/p>\n<h3>Activate an account<\/h3>\n<p>Once you have accounts DirSync&#8217;d up to Office 365, with the correct UPN matching the real domain that you federated, you can now activate one or two of them to use as tests.<\/p>\n<h3>Test<\/h3>\n<p>To test I logged in to my virtual workstation. This has a bridged internet connection in addition to the virtual network connection, and all DNS goes via the virtual DC.<\/p>\n<p>I went to <a href=\"https:\/\/portal.microsoftonline.com\">https:\/\/portal.microsoftonline.com<\/a> and entered the user&#8217;s UPN. When I clicked the Password box it was greyed out and a link appeared telling me to authenticate against <em>myrealdomain.com<\/em>. I clicked this link and, after a few\u00c2\u00a0URL changes flicked across the address bar, I&#8217;m in!<\/p>\n<h3>Troubleshooting<\/h3>\n<p>The main mistake\u00c2\u00a0I made was to install the ADFS server in standalone mode the first time. Login actually worked, but it wasn&#8217;t SSO &#8211; the user had to re-enter their username and password. Checking the Security log on the DC showed NTLM auth being used.<\/p>\n<p>So I re-ran the ADFS wizard (as the link had dissappeared from the Mnagement console I\u00c2\u00a0ran C:\\Program Files\\Active Directory Federation Services 2.0\\FsConfigWizard.exe) and chose server farm. I then re-ran the powershell cmdlet Convert-MsolDomainToFederated.<\/p>\n<p>Everything looked good, but wasn&#8217;t. I kept getting &#8220;Your organization could not sign you in to this service&#8221;. In the event logs I could actually see the user successfully logging in with Kerberos, but at the same time a KDC_ERR_BADOPTION error.<\/p>\n<p>After much troubleshooting and hair-tearing I decided to run the powershell cmdlet Update-MsolFederatedDomain &#8211; and it fixed the problem!<\/p>\n<p>As I&#8217;d had the foresight to run a Get-MsolFederationProperty both before and after the Update cmdlet I could actually compare and see what changed. The problem was the TokenSigningCertificate &#8211; it looks like the Convert cmdlet did not overwrite this so it still had the old thumbprint. After I ran Update the thumbprint changed to the new cert.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s kind of killing my laptop, but I have managed to get my virtual lab environment working with ADFS to an Office 365 trial. I think I&#8217;ve probably got the bare minimum config going on here, so for reference, here&#8217;s what I had to do.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[59,44,56,1],"tags":[],"class_list":["post-1690","post","type-post","status-publish","format-standard","hentry","category-adfs","category-cloud","category-office-365","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-rg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1690","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=1690"}],"version-history":[{"count":19,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1690\/revisions"}],"predecessor-version":[{"id":1697,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1690\/revisions\/1697"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=1690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=1690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=1690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}