<?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>Cephas's tangential learnings</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/cephalin/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/cephalin/feed.xml</link>
    <description>Wikipedia: Tangential learning is the process by which [I] will self-educate if a topic is exposed to [me] in a context that [I] already enjoy.</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:38:35 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Test Lab: Standalone STS with AD FS in Azure VM (for test only)</title>
      <link>https://docs.microsoft.com/archive/blogs/cephalin/test-lab-standalone-sts-with-ad-fs-in-azure-vm-for-test-only</link>
      <pubDate>Sun, 21 Dec 2014 23:15:00 GMT</pubDate>
      <dc:creator><![CDATA[Cephas Lin]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cephalin/2014/12/21/test-lab-standalone-sts-with-ad-fs-in-azure-vm-for-test-only/</guid>
      <description><![CDATA[In this blog post I will show you how I created a test lab for a publicly accessible Secure Token...]]></description>
      <content:encoded><![CDATA[<p>In this blog post I will show you how I created a test lab for a publicly accessible Secure Token Service (STS) server using <a href="https://msdn.microsoft.com/en-us/library/bb897402.aspx">Active Directory Federation Services</a> (AD FS) on an Azure VM. I created the test lab in order to help with the ramp-up process of creating an enterprise Web app in Azure Websites that needs to authenticate users against various forms of federated authentication scenarios, such as an on-premise AD FS service or an Azure Active Directory (AD) tenant that is synced with AD FS on-premise.</p>
<p><span style="color: black; background-color: yellow;">IMPORTANT: As this is a test lab for the Web development scenario, it's not meant to demonstrate the best practices of setting up a public-facing STS server with AD FS. For example, it's already violating the first no-no at </span></p>
<p><a href="https://msdn.microsoft.com/library/azure/jj156090.aspx"><span style="font-family: Times New Roman; font-size: 12pt; background-color: yellow;">Can you deploy Windows Server AD FS on Azure Virtual Machines?</span></a><span style="background-color: yellow;"> since <strong>both the STS and DC are exposed directly to the internet</strong>. Nevertheless, it's exactly what I need as a developer in order to ramp up on the end-to-end authentication of an application (such as Azure Websites) with an STS.</span></p>
<p>Here are the basic things I needed to create this test lab:</p>
<ul>
<li>A trial account for Microsoft Azure.</li>
<li><span style="color: black;">Ownership and administrator account of a domain name (e.g. contoso.com) from a DNS service like <a href="https://www.godaddy.com">www.godaddy.com</a>. I create the AD FS service using a DNS name under it (e.g. adfs.contoso.com) and redirect traffic to the Azure VM's IP address. Also, since I'm also testing directory integration with Azure AD, I need to generate a valid SSL certificate, and any certificate authority (CA) would verify that I own the domain before issuing me a certificate.</span></li>
<li>An SSL certificate for the AD FS service. I've used a trial certificate from <a href="https://www.ssl.com/certificates/free">SSL.com</a> as well as generated test CA and server certificates, and they both work.</li>
</ul>
<p>I created one Azure VM running Windows Server 2012 R2 with the following specs:</p>
<ul>
<li>Open Azure VM's endpoint for port 443</li>
<li>Configure AD DS for the domain I own (I will call it <strong>contoso.com</strong>)</li>
<li>Configure AD FS (I will call it <strong>adfs.contoso.com</strong>)</li>
<li>Open the inbound port 443</li>
</ul>
<p>Now, here are the detailed steps to reproduce this test lab:</p>
<ol>
<li>
<div>First, create the Azure VM. Log into your account in <a href="https://portal.azure.com">https://portal.azure.com</a>. Click <strong>New</strong>, and select <strong>Windows Azure 2012 R2 Datacenter</strong>.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/3463.122214_1712_TestLabStan1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/3463.122214_5F00_1712_5F00_TestLabStan1.png" alt="" /></p>
</li>
<li>
<div>When Azure has finished creating the VM, click <strong>Connect</strong> at the top of the dashboard and download the RDP file.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/7266.122214_1712_TestLabStan2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/7266.122214_5F00_1712_5F00_TestLabStan2.png" alt="" /></p>
</li>
<li>
<div>Open the RDP file to connect to the Azure VM using the hostname\username and password you created. If you get an error connecting to the Azure VM, you may need to wait awhile before the DNS changes for the VM gets propagated.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/8750.122214_1712_TestLabStan3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/8750.122214_5F00_1712_5F00_TestLabStan3.png" alt="" /></p>
<p><span style="background-color: yellow;">Notice in the screenshot above that I connected directly to the IP address of the Azure VM. You may find yourself wanting to do this if the DNS updates for the Azure VM takes longer than normal. The VM's IP address is available immediately so you don't have to wait to keep going.</span></p>
</li>
<li><strong>IMPORTANT:</strong> Open Windows Updates and bring the VM to the latest important and optional updates. The Windows Server 2012 image from October 2014 cannot add the required Windows features without the most recent updates.</li>
<li>
<div>Open the PowerShell window and run the following commands:</div>
<p style="background: white;"><span style="font-family: Lucida Console; font-size: 9pt;"><span style="color: orangered;">$domain</span> <span style="color: darkgray;">=</span> <span style="color: darkred;">"contoso.com" <br /> </span><span style="color: orangered;">$password</span> <span style="color: darkgray;">=</span> <span style="color: darkred;">"&lt;your password here&gt;"</span> <br /> <br /> <span style="color: blue;">Install-WindowsFeature</span> <span style="color: navy;">-Name</span> <span style="color: blueviolet;">AD-Domain-Services<span style="color: darkgray;">,</span> ADFS-Federation<span style="color: darkgray;">,</span> NET-Framework-Core</span> <span style="color: navy;">-IncludeManagementTools</span> <br /> <span style="color: blue;">Install-ADDSForest</span> <span style="color: navy;">-Force</span> <span style="color: navy;">-DomainName</span> <span style="color: orangered;">$domain</span> <span style="color: navy;">-SafeModeAdministratorPassword</span> (<span style="color: blue;">ConvertTo-SecureString</span> <span style="color: orangered;">$password</span> <span style="color: navy;">-AsPlainText</span> <span style="color: navy;">-Force</span>) </span></p>
<p>The script above will install AD Domain Services and AD Federation Services, then promote the VM to a DC server.</p>
</li>
<li>
<div>After the system restarts, log into the VM again using your <strong>domain admin</strong> credentials:</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/1234.122214_1712_TestLabStan4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/1234.122214_5F00_1712_5F00_TestLabStan4.png" alt="" /></p>
</li>
<li>
<div>Create the certificates you will use to configure the AD FS service. You can run the commands below using <a href="https://slproweb.com/products/Win32OpenSSL.html">OpenSSL for Windows</a>. You will create a test CA certificate and a certificate that's signed by that CA certificate.</div>
<ol type="a">
<li>Prepare the configuration file (sancert.cnf) by following the instructions at <a href="https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure-ssl-certificate/">Get a SubjectAltName certificate using OpenSSL</a> (be sure to specify the subjectAltName parameters as shown above).</li>
<li>
<div>When generating the certificate signing request (CSR), use the appropriate SAN configuration per <a href="https://technet.microsoft.com/en-us/library/dn151311.aspx">Certificate requirements</a>. I created a certificate for adfs.contoso.com, so my SAN configuration should be:</div>
<p><strong>subjectAltName=DNS:adfs.contoso.com,DNS: enterpriseregistration.contoso.com</strong></p>
</li>
<li>
<div>Run the following commands in a command prompt <strong>in administrative mode</strong>, and follow the prompts to supply the private keys and password for each respective step. Since these are test certificates, feel free to use the same password for all of them.</div>
<p style="background: white;"><span style="font-family: Lucida Console; font-size: 9pt;"> <span style="color: blue;">openssl</span> <span style="color: blueviolet;">genrsa</span> <span style="color: navy;">-out</span> <span style="color: blueviolet;">C:\rootCA.key</span> <span style="color: purple;">2048</span> <br /> <span style="color: blue;">openssl</span> <span style="color: blueviolet;">req</span> <span style="color: navy;">-x509</span> <span style="color: navy;">-new</span> <span style="color: navy;">-nodes</span> <span style="color: navy;">-key</span> <span style="color: blueviolet;">C:\rootCA.key</span> <span style="color: navy;">-days</span> <span style="color: purple;">1024</span> <span style="color: navy;">-out</span> <span style="color: blueviolet;">C:\rootCA.pem</span> <br /> <span style="color: blue;">openssl</span> <span style="color: blueviolet;">pkcs12</span> <span style="color: navy;">-export</span> <span style="color: navy;">-in</span> <span style="color: blueviolet;">C:\rootCA.pem</span> <span style="color: navy;">-inkey</span> <span style="color: blueviolet;">C:\rootCA.key</span> <span style="color: navy;">-out</span> <span style="color: blueviolet;">C:\rootCA.pfx</span> <br /> <span style="color: blue;">openssl</span> <span style="color: blueviolet;">req</span> <span style="color: navy;">-new</span> <span style="color: navy;">-nodes</span> <span style="color: navy;">-keyout</span> <span style="color: blueviolet;">C:\adfs.key</span> <span style="color: navy;">-out</span> <span style="color: blueviolet;">C:\adfs.csr</span> <span style="color: navy;">-newkey</span> <span style="color: blueviolet;">rsa:2048</span> <span style="color: navy;">-config</span> <span style="color: blueviolet;">C:\sancert.cnf <br /> </span><span style="color: blue;">openssl</span> <span style="color: blueviolet;">x509</span> <span style="color: navy;">-req</span> <span style="color: navy;">-in</span> <span style="color: blueviolet;">C:\adfs.csr</span> <span style="color: navy;">-CA</span> <span style="color: blueviolet;">C:\rootCA.pem</span> <span style="color: navy;">-CAkey</span> <span style="color: blueviolet;">C:\rootCA.key</span> <span style="color: navy;">-CAcreateserial</span> <span style="color: navy;">-out</span> <span style="color: blueviolet;">C:\adfs.crt</span> <span style="color: navy;">-days</span> <span style="color: purple;">500 <br /> </span><span style="color: blue;">openssl</span> <span style="color: blueviolet;">pkcs12</span> <span style="color: navy;">-export</span> <span style="color: navy;">-in</span> <span style="color: blueviolet;">C:\adfs.crt</span> <span style="color: navy;">-inkey</span> <span style="color: blueviolet;">C:\adfs.key</span> <span style="color: navy;">-out</span> <span style="color: blueviolet;">C:\adfs.pfx </span> </span></p>
<p style="background: white;">These commands accomplish the following:</p>
<ol type="i">
<li>
<div style="background: white;">Create a root CA certificate.</div>
</li>
<li>
<div style="background: white;">Create a .pfx file for the root CA certificate. You need to install this certificate as a trusted root certificate on your development machine so you won't get the nasty message later on saying that the AD FS certificate is not trusted when you access AD FS. <strong>Keep in mind this is only for testing purposes.</strong></div>
</li>
<li>
<div style="background: white;">Create the AD FS certificate that is signed by the root CA certificate above.</div>
</li>
<li>
<div style="background: white;">Create a .pfx file for the AD FS certificate. You will use this certificate to configure the AD FS service on the Azure VM.</div>
</li>
</ol></li>
<li>Copy rootCA.pfx to your development machine, then double-click the file to import the certificate as a trusted root certificate authority.</li>
</ol></li>
<li>Copy the .pfx file for AD FS that you created above into the Azure VM's RDP session (using Control-C and Control-V).</li>
<li>
<div>In a PowerShell window in administrative mode, run the following snippet. You will be prompted to supply service account credentials. For the test lab, I just use the domain admin's credentials.</div>
<p style="background: white;"><span style="font-family: Lucida Console; font-size: 9pt;"><span style="color: darkgreen;"># Change these variables to fit your environment</span> <br /> <span style="color: orangered;">$cn</span> <span style="color: darkgray;">=</span> <span style="color: darkred;">"adfs.contoso.com" <br /> </span><span style="color: orangered;">$pfx_path</span> <span style="color: darkgray;">=</span> <span style="color: darkred;">"<a href="file:///c:/adfs.pfx">c:\adfs.pfx</a>"</span> <br /> <span style="color: orangered;">$pfx_password</span> <span style="color: darkgray;">=</span> <span style="color: darkred;">"&lt;your PFX export password here&gt;"</span> <br /> <br /> <span style="color: darkgreen;"># import pfx certificate and private key into cert:\LocalMachine\MY</span> <br /> <span style="color: blue;">certutil</span> <span style="color: navy;">-f</span> <span style="color: navy;">-importpfx</span> <span style="color: navy;">-p</span> <span style="color: orangered;">$pfx_password</span> <span style="color: orangered;">$pfx_path</span> <br /> <br /> <span style="color: darkgreen;"># Configure AD FS service</span> <br /> <span style="color: orangered;">$serviceAccountCredential</span> <span style="color: darkgray;">=</span> <span style="color: blue;">Get-Credential</span> <span style="color: navy;">-Message</span> <span style="color: darkred;">"Enter the credential for the Federation Service Account."</span> <br /> <span style="color: blue;">Install-AdfsFarm</span> ` <br /> <span style="color: navy;">-CertificateThumbprint:</span>(<span style="color: blue;">Get-ChildItem</span> <span style="color: blueviolet;">cert:\LocalMachine\MY</span> <span style="color: darkgray;">|</span> <span style="color: blue;">Where-Object</span> {<span style="color: orangered;">$_<span style="color: darkgray;">.</span>Subject <span style="color: darkgray;">-match</span> <span style="color: darkred;">"CN=<span style="color: orangered;">$cn<span style="color: darkred;">*"</span>})<span style="color: darkgray;">.</span>Thumbprint `</span> <br /> </span></span><span style="color: navy;">-FederationServiceDisplayName:<span style="color: darkred;">"ADFS Test Lab in Azure VM"</span> `</span> <br /> <span style="color: navy;">-FederationServiceName:<span style="color: orangered;"> $cn</span> </span>` <br /> <span style="color: navy;">-OverwriteConfiguration:<span style="color: orangered;">$true</span> `</span> <br /> </span><span style="color: navy; font-family: Lucida Console; font-size: 9pt;">-ServiceAccountCredential:<span style="color: orangered;">$serviceAccountCredential <br /> <br /> </span></span><span style="font-family: Lucida Console; font-size: 9pt;"> <span style="color: darkgreen;"># Configure firewall rule for port 433</span> <br /> <span style="color: blue;">netsh</span> <span style="color: blueviolet;">advfirewall</span> <span style="color: blueviolet;">firewall</span> <span style="color: blueviolet;">add</span> <span style="color: blueviolet;">rule</span> <span style="color: blueviolet;">name='AD FS (HTTPS)'</span> <span style="color: blueviolet;">localport=443</span> <span style="color: blueviolet;">dir=in</span> <span style="color: blueviolet;">action=allow</span> <span style="color: blueviolet;">protocol=TCP <br /> <br /> </span><span style="color: darkgreen;"># Add required A record (e.g. "adfs") and CName record ("enterpriseregistration")</span> <span style="color: blue;"><br /> Import-Module</span> <span style="color: blueviolet;">DnsServer</span> <span style="color: orangered;"><br /> $ip</span> <span style="color: darkgray;">=</span> (<span style="color: blue;">Get-WmiObject</span> <span style="color: navy;">-Class</span> <span style="color: blueviolet;">Win32_NetworkAdapterConfiguration</span> <span style="color: navy;">-Filter</span> <span style="color: darkred;">"DHCPEnabled=true"</span> <span style="color: navy;">&ndash;ComputerName<span style="color: blueviolet;">.</span>)<span style="color: darkgray;">.</span>IPAddress<span style="color: darkgray;">[<span style="color: purple;">1<span style="color: darkgray;">] <br /> </span></span></span></span><span style="color: orangered;">$domain</span> <span style="color: darkgray;">=</span> <span style="color: orangered;">$cn<span style="color: darkgray;">.</span>Substring($cn<span style="color: darkgray;">.</span>IndexOf(<span style="color: darkred;">"."</span>)<span style="color: darkgray;">+<span style="color: purple;">1</span>) <br /> </span></span><span style="color: blue;">Add-DnsServerResourceRecordA</span> <span style="color: navy;">-Name</span> <span style="color: orangered;">$cn<span style="color: darkgray;">.</span>Split(<span style="color: darkred;">"."</span>)<span style="color: darkgray;">[<span style="color: purple;">0<span style="color: darkgray;">] <span style="color: navy;">-ZoneName</span> <span style="color: orangered;">$domain</span> <span style="color: navy;">-IPv4Address</span> <span style="color: orangered;">$ip</span> <br /> </span></span></span></span><span style="color: blue;">Add-DnsServerResourceRecordCName</span> <span style="color: navy;">-Name</span> <span style="color: darkred;">"enterpriseregistration"</span> <span style="color: navy;">-HostNameAlias</span> <span style="color: orangered;">$cn</span> <span style="color: navy;">-ZoneName</span> <span style="color: orangered;">$domain</span> </span></p>
</li>
<li>
<div>Create an endpoint on the Azure VM that corresponds to port 443. Back in the <a href="https://portal.azure.com">https://portal.azure.com</a>, scroll down to the bottom of the dashboard for your Azure VM and click the <strong>Endpoints</strong> box.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/5037.122214_1712_TestLabStan5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/5037.122214_5F00_1712_5F00_TestLabStan5.png" alt="" /></p>
</li>
<li>Click <strong>Add</strong> to add an endpoint, with <strong>443</strong> as both the <strong>Public Port</strong> and the <strong>Private Port</strong>.</li>
<li>
<div>Now everything is configured, but you still need to direct traffic to the Azure VM's IP address. Note the IP address in the screenshot above is <strong>23.102.153.156</strong>. Log into your domain's management account and add an A record that points <strong>adfs.contoso.com</strong> to this address. In my GoDaddy account for my domain (contoso.com), it looks like this:</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/1731.122214_1712_TestLabStan6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/1731.122214_5F00_1712_5F00_TestLabStan6.png" alt="" /></p>
</li>
<li>
<div>Finally, you can test whether your AD FS service is publicly available. On your development machine (where you installed the test CA certificate), open Internet Explorer and navigate to <a href="https://adfs.contoso.com/FederationMetadata/2007-06/FederationMetadata.xml">https://<span style="color: blue; text-decoration: underline;"><strong>adfs.contoso.com</strong>/FederationMetadata/2007-06/FederationMetadata.xml</span></a>. Here's what you should see:</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/2335.122214_1712_TestLabStan7.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/2335.122214_5F00_1712_5F00_TestLabStan7.png" alt="" /></p>
</li>
</ol>
<p>And you're done! To manage the AD FS service, such as add a relying party app, log into the Azure VM again, go to <strong>Server Manager</strong>, click <strong>Tools</strong>, and select <strong>AD FS Management</strong> as shown below.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/4382.122214_1712_TestLabStan8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/4382.122214_5F00_1712_5F00_TestLabStan8.png" alt="" /></p>
<h2>Bonus Lab: Integrate AD FS with Azure AD for single sign-on</h2>
<p>For those interested, the next thing I did was to extend the test lab to include directory synchronization to Azure AD. There's a comprehensive content set on the best-practice guidance for <a href="https://www.asp.net/identity/overview/getting-started/developing-aspnet-apps-with-windows-azure-active-directory">Directory Sync with Single Sign-On Scenario</a>, but here I just wanted to create the minimal working solution for the end-to-end user experience from line-of-business (LOB) applications.</p>
<ul>
<li>
<div>Log into <a href="https://manage.windowsazure.com/">https://manage.windowsazure.com/</a> with your Azure subscription and go to the <strong>Active Directory</strong> tab. Click the <strong>Default Directory</strong> that's created for you by default.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/4807.122214_1712_TestLabStan9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/4807.122214_5F00_1712_5F00_TestLabStan9.png" alt="" /></p>
</li>
<li>
<div>Click the <strong>Users</strong> link at the top, and then click <strong>ADD USER </strong>at the bottom.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/6557.122214_1712_TestLabStan10.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/6557.122214_5F00_1712_5F00_TestLabStan10.png" alt="" /></p>
</li>
<li>
<div>Create a new user in this directory with the role <strong>Global Administrator</strong>.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/2350.122214_1712_TestLabStan11.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/2350.122214_5F00_1712_5F00_TestLabStan11.png" alt="" /></p>
</li>
<li>
<div>Save the automatically generated password. You will need to change it before you can use it to configure directory sync. Note full user name that you created.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/4010.122214_1712_TestLabStan12.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/4010.122214_5F00_1712_5F00_TestLabStan12.png" alt="" /></p>
</li>
<li>
<div>Log out of <a href="https://manage.windowsazure.com/">https://manage.windowsazure.com/</a> and log back in with the user name you created and the temporary password, then change the password. You are now ready to configure directory sync.</div>
<p><span style="background-color: yellow;">Surprise, surprise. Just a few days before I published, <a href="https://blogs.technet.com/b/ad/archive/2014/12/15/azure-ad-connect-one-simple-fast-lightweight-tool-to-connect-active-directory-and-azure-active-directory.aspx">Azure AD Connect went on public preview</a>, which will do almost all the steps below in one tool (albeit with a disclaimer for lab environments only). Azure changes so fast, it's hard to keep up with the latest and greatest.</span></p>
</li>
<li>Back in the RDP session for your ADFS VM, install <a href="https://go.microsoft.com/fwlink/?LinkID=286152">Microsoft Online Services Sign-In Assistant for IT Professionals RTW</a> and then install <a href="https://go.microsoft.com/fwlink/p/?linkid=236297">Azure Active Directory Module for Windows PowerShell (64-bit version)</a>.</li>
<li>
<div>From the Start screen, <strong>launch Windows Azure Active Directory Module for Windows PowerShell</strong>, then run the following commands to create a new Azure AD domain with a trust relationship with your ADFS service:</div>
<p style="background: white;">&nbsp;</p>
<p style="background: white;"><span style="color: orangered; font-family: Lucida Console; font-size: 9pt;">$cred<span style="color: darkgray;">=<span style="color: blue;">Get-Credential</span> </span></span></p>
<p style="background: white;"><span style="font-family: Lucida Console; font-size: 9pt;"><span style="color: blue;">Connect-MsolService</span> <span style="color: navy;">&ndash;Credential</span> <span style="color: orangered;">$cred</span> </span></p>
<p style="background: white;"><span style="font-family: Lucida Console; font-size: 9pt;"><span style="color: blue;">New-MsolFederatedDomain</span> <span style="color: navy;">&ndash;DomainName</span> <span style="color: darkgray;">&lt;<span style="color: blueviolet;">e.g.</span> <span style="color: blueviolet;">contoso.com&gt;</span> </span></span></p>
<p style="background: white;">&nbsp;</p>
<p>You will be prompted to enter the global administrator's credentials that you just created (&lt;username&gt;@&lt;youraccount&gt;.onmicrosoft.com). Once the commands are completed, you will be asked to verify the domain.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/3660.122214_1712_TestLabStan13.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/3660.122214_5F00_1712_5F00_TestLabStan13.png" alt="" /></p>
</li>
<li>
<div>You then need to add a TXT record at your domain registrar. So in my GoDaddy.com account, I created the following entry:</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/3683.122214_1712_TestLabStan14.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/3683.122214_5F00_1712_5F00_TestLabStan14.png" alt="" /></p>
</li>
<li>Back in the RDP session for your ADFS VM, in the same <strong>Windows Azure Active Directory Module for Windows PowerShell</strong> session, press the <strong>UP</strong> key rerun the last command to create the new federated domain in Azure AD. The command should now succeed.</li>
<li>
<div>Go back to the default directory view in <a href="https://manage.windowsazure.com/">https://manage.windowsazure.com/</a>, refresh your browser and click <strong>Directory Integration</strong> at the top. You should now see that there's a domain verified for directory sync. Set <strong>Directory Sync</strong> to <strong>Activated</strong> and click <strong>Save</strong>.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/1122.122214_1712_TestLabStan15.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/1122.122214_5F00_1712_5F00_TestLabStan15.png" alt="" /></p>
</li>
<li>Back in the RDP session for your ADFS VM, install <a href="https://www.microsoft.com/en-us/download/details.aspx?id=44225">AAD Sync</a>.</li>
<li>
<div>After AAD Sync is installed and launched, step through the GUI to enter the following:</div>
<ul>
<li>The Azure AD global administrator's credentials (e.g. &lt;username&gt;@&lt;youraccount&gt;.onmicrosoft.com)</li>
<li>The AD DS credentials for your domain administrator (e.g. CONTOSO\adminuser)</li>
<li>In <strong>Optional Features</strong>, select <strong>Password synchronization</strong></li>
</ul>
</li>
<li>
<div>Go back to the default directory view in <a href="https://manage.windowsazure.com/">https://manage.windowsazure.com/</a> and refresh your browser. You should now see a domain configured for single sign-on:</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/5430.122214_1712_TestLabStan16.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/5430.122214_5F00_1712_5F00_TestLabStan16.png" alt="" /></p>
</li>
<li>
<div>Now, add a dummy user to the AD domain to test if it is synced to Azure AD.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/0243.122214_1712_TestLabStan17.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/0243.122214_5F00_1712_5F00_TestLabStan17.png" alt="" /></p>
</li>
<li>
<div>Launch <strong>Task Scheduler</strong> and run the <strong>Azure AD Sync Scheduler</strong> task.</div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/68/04/metablogapi/1565.122214_1712_TestLabStan18.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-68-04-metablogapi/1565.122214_5F00_1712_5F00_TestLabStan18.png" alt="" /></p>
</li>
<li>Go back to the default directory view in <a href="https://manage.windowsazure.com/">https://manage.windowsazure.com/</a> and refresh your browser. Click the <strong>Users</strong> link at the top. You should now see the AD user synced to your Azure AD default directory.</li>
</ul>
<h2>Additional Resources</h2>
<ul>
<li><a href="https://technet.microsoft.com/en-us/library/dn441213.aspx">Directory Sync with Single Sign-On Scenario</a></li>
<li><a href="https://technet.microsoft.com/en-us/library/jj205462.aspx">Checklist: Use AD FS to implement and manage single sign-on</a></li>
<li><a href="https://technet.microsoft.com/en-us/library/dn151324.aspx">Plan your AD FS deployment</a></li>
<li><a href="file:///C:\controlpanel\blogs\posteditor.aspx\msdn.microsoft.com\en-us\library\vstudio\bfsktky3.aspx">Makecert.exe (Certificate Creation Tool)</a></li>
<li><a href="https://technet.microsoft.com/en-us/library/hh974719.aspx">AD DS Deployment Cmdlets in Windows PowerShell</a></li>
<li><a href="https://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/">Creating Your Own SSL Certificate Authority (and Dumping Self Signed Certs)</a></li>
</ul>]]></content:encoded>
    </item>
  </channel>
</rss>