{"id":4044,"date":"2018-02-21T21:07:14","date_gmt":"2018-02-21T21:07:14","guid":{"rendered":"https:\/\/geekdecoder.com\/?p=4044"},"modified":"2018-02-21T21:07:14","modified_gmt":"2018-02-21T21:07:14","slug":"enabling-federation-aws-using-windows-active-directory-adfs-saml-2-0","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2018\/02\/21\/enabling-federation-aws-using-windows-active-directory-adfs-saml-2-0\/","title":{"rendered":"Enabling Federation to AWS Using Windows Active Directory, ADFS, and SAML 2.0"},"content":{"rendered":"<p>Setting up and Enabling Federation to AWS Using Windows Active Directory, ADFS, and SAML 2.0. This KB assumes that you have a windows server with IIS, Active Directory, Active Directory Federation Services and Certificate Services Installed.<\/p>\n<p>First, perform the following in your domain:<\/p>\n<ol>\n<li>Create two AD Groups named AWS-Production and AWS-Dev. AWS Production will have users that have administrative access and the\u00a0AWS-Dev will have S3 , EC2 and RDS servies in AWS.<\/li>\n<li>Create users that will go into the accounts.<\/li>\n<li>Give the users email address (e.g., dev@myemail.com).<\/li>\n<li>Add users to the AWS-Production and AWS-Dev groups.<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<p>Open Server Manager. Go To AD DS on the left and click. Right click on the server in the middle and go to &#8220;Active Directory Users and Computers&#8221;.<\/p>\n<p>Create our Groups. Right Click the server name and go to &#8220;New&#8221; and click &#8220;Group&#8221;.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-4048\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad5-1024x660.png\" alt=\"\" width=\"648\" height=\"418\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad5-1024x660.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad5-300x193.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad5-768x495.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad5.png 1048w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>Name the new group &#8211; AWS-Dev. Click OK.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4052\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad7.png\" alt=\"\" width=\"426\" height=\"370\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad7.png 426w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad7-300x261.png 300w\" sizes=\"auto, (max-width: 426px) 100vw, 426px\" \/><\/a><\/p>\n<p>Repeat the steps to add the AWS-Production Group.<\/p>\n<p>Create Users for the AWS-Dev Group.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-4045\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad1-1024x465.png\" alt=\"\" width=\"648\" height=\"294\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad1-1024x465.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad1-300x136.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad1-768x348.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad1.png 1175w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Add a new User called Dev. This user will be in our development Group.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4046\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad3.png\" alt=\"\" width=\"427\" height=\"374\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad3.png 427w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad3-300x263.png 300w\" sizes=\"auto, (max-width: 427px) 100vw, 427px\" \/><\/a><\/p>\n<p>Give a password and click finish. Now right click on the user and go to properties. Add an email to the user. This email will be used to login to the ADFS web page. Click OK.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4047\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad4.png\" alt=\"\" width=\"403\" height=\"532\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad4.png 403w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad4-227x300.png 227w\" sizes=\"auto, (max-width: 403px) 100vw, 403px\" \/><\/a><\/p>\n<p>Now click the &#8220;Member Of&#8221; Tab.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4054\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad8.png\" alt=\"\" width=\"401\" height=\"532\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad8.png 401w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad8-226x300.png 226w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/a><\/p>\n<p>Click Add. Type AWS and click check names. The AWS-Dev should be displayed. Click OK. Click OK again.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4055\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad9.png\" alt=\"\" width=\"601\" height=\"536\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad9.png 601w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad9-300x268.png 300w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/a><\/p>\n<p>Repeat the steps to add the user to the AWS-Production Group.<\/p>\n<p>The Group and User are now added to Active Directory.<\/p>\n<p>Now we need to login to the AWS console and create the SAML Provider and the role for the AWS-Dev group we created in AD.<\/p>\n<p>If you\u2019ve never done this, I recommend taking a look at the\u00a0<a href=\"http:\/\/docs.aws.amazon.com\/STS\/latest\/UsingSTS\/STSMgmtConsole-SAML.html#configuring-IAMProvider\">IAM user guide<\/a>. Before you create a SAML provider, you need to download the SAML metadata document for your ADFS federation server. By default, you can download it from following address:<\/p>\n<p>https:\/\/&lt;yourservername&gt;\/FederationMetadata\/2007-06\/FederationMetadata.xml<\/p>\n<p>I named my SAML provider\u00a0<strong>ADFS<\/strong>. When you have the SAML metadata document, you can create the SAML provider in AWS.<\/p>\n<p>When I finished creating the SAML provider, I created one IAM role.<\/p>\n<p>I named the role ADFS-Dev. Do these names look familiar? They should. They are the complement to the AD groups created earlier. During the SAML authentication process in AWS, these IAM roles will be matched by name to the AD group (AWS-Dev) via ADFS claim rules.<\/p>\n<p><strong>Note<\/strong>: Remember that if you\u2019re following along with this description, you need to use exactly the same names that we use. Make sure that you name the IAM role ADFS-Dev.<\/p>\n<p>Find the ARNs for the SAML provider and for the roles that you created and record them. You\u2019ll need the ARNs later when you configure claims in the IdP.<\/p>\n<p>That\u2019s it for the AWS configuration steps.<\/p>\n<h3>Configuring AWS as a Trusted Relying Party<\/h3>\n<p>Go to the server manager on the server and select on the right &#8211; &#8220;Tools&#8221; and click &#8220;AD FS Management&#8221;.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-4059\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad10-1024x227.png\" alt=\"\" width=\"648\" height=\"144\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad10-1024x227.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad10-300x66.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad10-768x170.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad10-1536x340.png 1536w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad10.png 1810w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>Either right click on the AD FS on the left and choose &#8220;Add Relying Party Trust&#8221; or on the Right Side.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-4060\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad11-1024x342.png\" alt=\"\" width=\"648\" height=\"216\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad11-1024x342.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad11-300x100.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad11-768x257.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad11.png 1182w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>Select &#8220;Clams Aware&#8221; and &#8220;Start&#8221;.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad12.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4062\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad12.png\" alt=\"\" width=\"711\" height=\"577\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad12.png 711w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad12-300x243.png 300w\" sizes=\"auto, (max-width: 711px) 100vw, 711px\" \/><\/a><\/p>\n<p>Check on &#8220;Import data about the relying party published online or on a local network&#8221;, put in<\/p>\n<p>https:\/\/signin.aws.amazon.com\/static\/saml-metadata.xml<\/p>\n<p>and then click\u00a0Next. The metadata XML file is a standard SAML metadata document that describes AWS as a relying party.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4064\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad13.png\" alt=\"\" width=\"708\" height=\"575\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad13.png 708w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad13-300x244.png 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/a><\/p>\n<p>Set the display name for the relying party and then click<strong>\u00a0<\/strong>Next.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4065\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad14.png\" alt=\"\" width=\"708\" height=\"572\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad14.png 708w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad14-300x242.png 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/a><\/p>\n<p>Choose your authorization rules. For my scenario, I chose\u00a0Permit all users to access this relying party. When you\u2019re done, click\u00a0Next.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad15.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4066\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad15.png\" alt=\"\" width=\"710\" height=\"575\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad15.png 710w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad15-300x243.png 300w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/><\/a><\/p>\n<p>Review your settings and then click\u00a0<strong>Next<\/strong>.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad16.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4067\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad16.png\" alt=\"\" width=\"704\" height=\"574\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad16.png 704w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad16-300x245.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/a><\/p>\n<p>Make sure &#8220;Configure claims issuance policy for this application&#8221; is check on and click Close.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad17.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4068\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad17.png\" alt=\"\" width=\"705\" height=\"574\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad17.png 705w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad17-300x244.png 300w\" sizes=\"auto, (max-width: 705px) 100vw, 705px\" \/><\/a><\/p>\n<p>Configuring Claim Rules for the AWS Relying Party<\/p>\n<p>In these steps we\u2019re going to add the claim rules so that the elements AWS requires and ADFS doesn\u2019t provide by default (NameId, RoleSessionName, and Roles) are added to the SAML authentication response. If you forgot to check the box to launch the claim rule dialog, right-click on the relying party (in this case Amazon Web Service SignOn) and then click\u00a0Edit Claim Issuance Policy.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad18.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-4069\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad18-1024x423.png\" alt=\"\" width=\"648\" height=\"268\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad18-1024x423.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad18-300x124.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad18-768x317.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad18.png 1180w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>In the\u00a0Edit Claim Issuance Policy for AWS Web Service SignOn dialog box, click\u00a0Add Rule.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad19.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4070\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad19.png\" alt=\"\" width=\"484\" height=\"539\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad19.png 484w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad19-269x300.png 269w\" sizes=\"auto, (max-width: 484px) 100vw, 484px\" \/><\/a><\/p>\n<p>Select\u00a0<strong>Transform an Incoming Claim<\/strong>\u00a0and then click\u00a0<strong>Next<\/strong>.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad20.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4071\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad20.png\" alt=\"\" width=\"708\" height=\"574\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad20.png 708w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad20-300x243.png 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/a><\/p>\n<div>Use the following settings:<\/div>\n<div>a.\u00a0\u00a0\u00a0<strong>Claim rule name<\/strong>: NameId<\/div>\n<div>b. \u00a0\u00a0<strong>Incoming claim type<\/strong>: Windows Account Name<\/div>\n<div>c. \u00a0\u00a0<strong>Outgoing claim type<\/strong>: Name ID<\/div>\n<div>d.\u00a0\u00a0<strong>Outgoing name ID format<\/strong>: Persistent Identifier<\/div>\n<div>e.\u00a0\u00a0<strong>Pass through all claim values:\u00a0<\/strong>checked<\/div>\n<div><\/div>\n<div><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad21.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4072\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad21.png\" alt=\"\" width=\"708\" height=\"577\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad21.png 708w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad21-300x244.png 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/a><\/div>\n<div>Click Finish.<\/div>\n<div><\/div>\n<div>\n<h4>Adding a RoleSessionName<\/h4>\n<div>1. \u00a0 Click\u00a0\u00a0<strong>Add Rule<\/strong><\/div>\n<div>2. \u00a0 In the\u00a0\u00a0<strong>Claim rule template<\/strong>\u00a0list, select\u00a0\u00a0<strong>Send LDAP Attributes as Claims<\/strong>.<\/div>\n<div><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad22.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4073\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad22.png\" alt=\"\" width=\"705\" height=\"573\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad22.png 705w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad22-300x244.png 300w\" sizes=\"auto, (max-width: 705px) 100vw, 705px\" \/><\/a><\/div>\n<div>\n<div>Use the following settings:<\/div>\n<div>a.\u00a0<strong>Claim rule name<\/strong>: RoleSessionName<\/div>\n<div>b.\u00a0<strong>Attribute store<\/strong>: Active Directory<\/div>\n<div>c.\u00a0<strong>LDAP Attribute<\/strong>: E-Mail-Addresses<\/div>\n<div>d.\u00a0<strong>Outgoing Claim Type<\/strong>\u00a0: https:\/\/aws.amazon.com\/SAML\/Attributes\/RoleSessionName<\/div>\n<div><\/div>\n<\/div>\n<div><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad23.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4074\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad23.png\" alt=\"\" width=\"704\" height=\"577\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad23.png 704w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad23-300x246.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/a><\/div>\n<div>\n<p>Click\u00a0Finish<\/p>\n<h4>Adding Role Attributes<\/h4>\n<p>I\u2019ll pause here to provide a little more context because for these steps it might not be as obvious what\u2019s going on. Unlike the two previous claims, here I used custom rules to send role attributes. This is done by retrieving all the authenticated user\u2019s AD groups and then matching the groups that start with to IAM roles of a similar name. I used the names of these groups to create Amazon Resource Names (ARNs) of IAM roles in my AWS account (i.e., those that start with\u00a0AWS-).<\/p>\n<p>Sending role attributes required two custom rules. The first rule retrieves all the authenticated user\u2019s AD group memberships and the second rule performs the transformation to the roles claim. Here\u2019s how I did it.<\/p>\n<div>1. \u00a0Click\u00a0\u00a0<strong>Add Rule<\/strong>.<\/div>\n<div>2. \u00a0In the\u00a0\u00a0<strong>Claim rule template<\/strong>\u00a0list, select\u00a0\u00a0<strong>Send Claims Using a Custom Rule<\/strong>\u00a0and then click\u00a0\u00a0<strong>Next<\/strong>.<\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<div><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad24.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4076\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad24.png\" alt=\"\" width=\"703\" height=\"576\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad24.png 703w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad24-300x246.png 300w\" sizes=\"auto, (max-width: 703px) 100vw, 703px\" \/><\/a><\/div>\n<div>For\u00a0<strong>Claim Rule Name<\/strong>, select\u00a0<strong>Get AD Groups<\/strong>, and then in\u00a0<strong>Custom rule<\/strong>, enter the following:<\/div>\n<div><\/div>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">c:&#x5B;Type == &quot;http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/windowsaccountname&quot;, Issuer == &quot;AD AUTHORITY&quot;] =&amp;gt; add(store = &quot;Active Directory&quot;, types = (&quot;http:\/\/temp\/variable&quot;), query = &quot;;tokenGroups;{0}&quot;, param = c.Value);\n\n<\/pre>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad25.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4078\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad25.png\" alt=\"\" width=\"710\" height=\"576\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad25.png 710w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad25-300x243.png 300w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/><\/a><\/p>\n<p>This custom rule uses a script in the claim rule language that retrieves all the groups the authenticated user is a member of and places them into a temporary claim named\u00a0http:\/\/temp\/variable. (Think of this as a variable you can access later.) I use this in the next rule to transform the groups into IAM role ARNs.<\/p>\n<div>4. \u00a0Click\u00a0\u00a0<strong>OK<\/strong>.<\/div>\n<div>5. \u00a0Click\u00a0\u00a0<strong>Add Rule.<\/strong><\/div>\n<div>6. \u00a0Repeat the preceding steps, but this time, type\u00a0\u00a0<strong>Roles<\/strong>\u00a0for\u00a0\u00a0<strong>Claim rule name<\/strong>\u00a0and use the following script:<\/div>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">c:&#x5B;Type == &quot;http:\/\/temp\/variable&quot;, Value =~ &quot;(?i)^AWS-&quot;] =&amp;gt; issue(Type = &quot;https:\/\/aws.amazon.com\/SAML\/Attributes\/Role&quot;, Value = RegExReplace(c.Value, &quot;AWS-&quot;, &quot;arn:aws:iam::123456789012:saml-provider\/ADFS,arn:aws:iam::123456789012:role\/ADFS-&quot;));\n<\/pre>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad27.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4080\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad27.png\" alt=\"\" width=\"703\" height=\"576\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad27.png 703w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad27-300x246.png 300w\" sizes=\"auto, (max-width: 703px) 100vw, 703px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>This rule uses a custom script to get all the groups from the temporary claim () and then uses the name of the group to create the principal\/role pair, which has this format:<\/p>\n<h4>ARN of SAML provider,ARN of role to assume<\/h4>\n<p>In my example, it comes out this way:<\/p>\n<p>arn:aws:iam:123456789012:saml-provider\/ADFS,arn:aws:iam:123456789012:role\/ADFS-<\/p>\n<p>In the example, I used an account number of 123456789012. Make sure you change this to your own AWS account.<\/p>\n<p>7. \u00a0Click\u00a0<strong>OK.<\/strong><\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad28.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4081\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad28.png\" alt=\"\" width=\"706\" height=\"574\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad28.png 706w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ad28-300x244.png 300w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/a><\/p>\n<p>Testing steps<\/p>\n<p>In your domain, browse to the following address: \u00a0https:\/\/localhost\/adfs\/ls\/IdpInitiatedSignOn.aspx<\/p>\n<p>If you\u2019re using a locally signed certificate from IIS, you might get a certificate warning.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/grumpy.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-thumbnail wp-image-4084\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/grumpy-150x150.jpg\" alt=\"\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/grumpy-150x150.jpg 150w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/grumpy.jpg 224w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<h5>Error. I received and error when I tried the page:<\/h5>\n<p>Exception details:<br \/>\nMicrosoft.IdentityServer.Web.IdPInitiatedSignonPageDisabledException: MSIS7012: An error occurred while processing the request. Contact your administrator for details.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/web.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-4085\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/web-1024x722.png\" alt=\"\" width=\"648\" height=\"457\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/web-1024x722.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/web-300x212.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/web-768x542.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/web-1536x1084.png 1536w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/web.png 1596w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>The event viewer gave me a an error which was not really helping at first.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ev1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-4087\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ev1-1024x726.png\" alt=\"\" width=\"648\" height=\"459\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ev1-1024x726.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ev1-300x213.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ev1-768x544.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ev1-1536x1088.png 1536w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ev1.png 1592w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>But when I looked closely I noticed the line Microsoft.IdentityServer.Web.IdPInitiatedSignonPageDisabledException.<br \/>\nWell it turns out that this feature is by\u00a0default disabled in the ADFS properties on Windows Server 2016.<\/p>\n<p>You can enable the test page by using the following powershell command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">set-AdfsProperties -EnableIdPInitiatedSignonPage $true\n<\/pre>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ps1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4090\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/ps1.png\" alt=\"\" width=\"855\" height=\"629\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ps1.png 855w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ps1-300x221.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/ps1-768x565.png 768w\" sizes=\"auto, (max-width: 855px) 100vw, 855px\" \/><\/a><\/p>\n<p>If we try the https:\/\/localhost\/adfs\/ls\/IdpInitiatedSignon.aspx\u00a0again we now receive a known web page with a Sign In button.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/so.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-4091\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/so-1024x722.png\" alt=\"\" width=\"648\" height=\"457\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/so-1024x722.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/so-300x212.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/so-768x541.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/so-1536x1083.png 1536w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/so.png 1597w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>Select\u00a0<strong>Sign in to one of the following sites<\/strong>, select\u00a0<strong>Amazon Web Service SignOn<\/strong>\u00a0from the list, and then click\u00a0<strong>Sign In<\/strong>.<\/p>\n<p>If prompted, enter in a username and password (remember to use the Dev Account that you setup earlier &#8211; dev@myemail.com). You are redirected to the\u00a0<strong>Amazon Web Services Sign-In<\/strong>\u00a0page.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/Capture567.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-4144\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2018\/02\/Capture567-1024x462.png\" alt=\"\" width=\"1024\" height=\"462\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/Capture567-1024x462.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/Capture567-300x135.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/Capture567-768x347.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2018\/02\/Capture567.png 1199w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Select a role and then click\u00a0<strong>Sign In<\/strong>. (If you are mapped to only a single IAM role, you skip the role selection step and are automatically signed into the AWS Management Console.).<\/p>\n<p>Success!<\/p>\n<p>Note: In windows 2016, the users set up in Active directory may have a different sign in domain depending on how you set it up. Check the email vs the User logon name in the Active Directory Users and Computers.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting up and Enabling Federation to AWS Using Windows Active Directory, ADFS, and SAML 2.0. This KB assumes that you have a windows server with IIS, Active Directory, Active Directory Federation Services and Certificate Services Installed. First, perform the following in your domain: Create two AD Groups named AWS-Production and AWS-Dev. AWS Production will have &#8230; <a title=\"Enabling Federation to AWS Using Windows Active Directory, ADFS, and SAML 2.0\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2018\/02\/21\/enabling-federation-aws-using-windows-active-directory-adfs-saml-2-0\/\" aria-label=\"Read more about Enabling Federation to AWS Using Windows Active Directory, ADFS, and SAML 2.0\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[127],"tags":[],"class_list":["post-4044","post","type-post","status-publish","format-standard","hentry","category-winserv"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/4044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=4044"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/4044\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=4044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=4044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=4044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}