{"id":2385,"date":"2013-12-20T00:01:00","date_gmt":"2013-12-20T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2013\/12\/20\/security-series-using-powershell-to-enable-byodpart-2\/"},"modified":"2022-06-16T10:11:08","modified_gmt":"2022-06-16T17:11:08","slug":"security-series-using-powershell-to-enable-byodpart-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/security-series-using-powershell-to-enable-byodpart-2\/","title":{"rendered":"Security Series: Using PowerShell to Enable BYOD\u2013Part 2"},"content":{"rendered":"<p><strong>Summary<\/strong>: Guest blogger and security expert, Yuri Diogenes, continues his series about enabling BYOD.<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. Today\u2019s guest blogger is <a href=\"\/b\/heyscriptingguy\/archive\/tags\/yuri+diogenes\/\" target=\"_blank\" rel=\"noopener\">Yuri Diogenes<\/a>, who continues his security series about enabling BYOD. Yuri is a senior knowledge engineer, and he is a coauthor of the book <a href=\"http:\/\/www.amazon.com\/Windows-Server-2012-Security-Beyond\/dp\/1597499803\/ref=sr_1_1?ie=UTF8&#038;qid=1386105398&#038;sr=8-1&#038;keywords=Windows+Server+2012+Security+from+End+to+Edge+and+Beyond\" target=\"_blank\" rel=\"noopener\">Windows Server\u00a02012 Security from End to Edge and Beyond<\/a>. You can follow him on Twitter at <a href=\"http:\/\/www.twitter.com\/yuridiogenes\" target=\"_blank\" rel=\"noopener\">@YuriDiogenes<\/a>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3323.hsg-12-6-13-6.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3323.hsg-12-6-13-6.jpg\" alt=\"Image of book cover\" title=\"Image of book cover\" \/><\/a><\/p>\n<p>In the first part of this series, <a href=\"https:\/\/devblogs.microsoft.com\/scripting\/security-series-using-powershell-to-enable-byodpart-1\/\" target=\"_blank\" rel=\"noopener\">Security Series: Using PowerShell to Enable BYOD\u2013Part 1<\/a>, I explained how to enable device registration to allow IT to have awareness of the user\u2019s device and have the capability of performing second factor authentication. If you recall, Contoso IT wanted to enable device registration only for devices that are connected through the corporate network (on-premises). Now that they fully understand the footprint of their user\u2019s devices, they are moving to their second phase\u2014they want to enable this capability for users coming from the Internet.<\/p>\n<p>This post will continue the Contoso IT story to embrace the &#8220;bring your own device&#8221; (BYOD) model. If you want to know more about BYOD, read the <strong>General Considerations Regarding BYOD<\/strong> section in the <a href=\"http:\/\/social.technet.microsoft.com\/wiki\/contents\/articles\/20554.bring-your-own-device-byod-survival-guide-for-microsoft-technologies.aspx\" target=\"_blank\" rel=\"noopener\">Bring Your Own Device (BYOD) Survival Guide for Microsoft Technologies<\/a>.<\/p>\n<h2><strong>Scenario 2: Enable access to resources for users coming from the Internet<\/strong><\/h2>\n<p>Small, medium, and large corporations nowadays rely a lot on the power of the Internet. Most of the time users will be connected to the web and during that same time they will also demand access to corporate resources. Companies should include on their BYOD strategy the capability to enable users to access corporate resources using their own devices from any location.\u00a0<\/p>\n<p>By using a new capability in Windows Server\u00a02012\u00a0R2 called <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/dn280944.aspx\" target=\"_blank\" rel=\"noopener\">Web Application Proxy<\/a>, you can publish apps and internal resources to users who are coming from the Internet. The recommended infrastructure for this scenario is shown in the following image:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/5707.1.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/5707.1.PNG\" alt=\"Image of set up\" title=\"Image of set up\" \/><\/a><\/p>\n<p>Notice that Web Application Proxy should be behind an edge firewall, and although the image shows Active Directory Federation Services (AD\u00a0FS), Web Application Proxy can also use NTLM or basic authentication.<\/p>\n<h3><strong>Scenario definition<\/strong><\/h3>\n<p>Contoso IT is moving to the second phase of their deployment, and now they need to allow users who are coming from outside of their internal network to register their devices and access resources. Another requirement is to customize the sign-in page to provide more detailed explanation for users who are trying to perform device registration from devices that are not Windows based.<\/p>\n<p>The steps to enable Web Application Proxy by using Windows PowerShell are quite simple; however, there are some prerequisites that must be in place before enabling this capability. Follow the instructions in <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/dn383644.aspx\" target=\"_blank\" rel=\"noopener\">Configure the Infrastructure for Web Application Proxy<\/a> to review the requirements that must be in place before you deploy this role.<\/p>\n<p>When the core infrastructure it is in place, you should also obtain a certificate with a private key to install on the server that will host this role. The certificate should include a subject that covers the name of AD\u00a0FS. For <strong>Workplace Join<\/strong>, the certificate must also contain the following subject alternative names (SANs): <federation service name>.<domain> and enterpriseregistration.<domain>.<\/p>\n<p style=\"padding-left:30px\">\n  <strong>Note<\/strong>\u00a0\u00a0The Web Application Proxy deployment requires certificates for the published web app and for the AD\u00a0FS proxy if your deployment provides AD\u00a0FS proxy functionality.\n<\/p>\n<p>Now you can install Web Application Proxy by using the following Windows PowerShell command:<\/p>\n<p style=\"padding-left:30px\">\n  Install-WindowsFeature Web-Application-Proxy -IncludeManagementTools\n<\/p>\n<p>After you install the role, you can configure Web Application Proxy. However, first you should open the certificate and find the thumbprint of the certificate. You will need this information during the installation process using Windows PowerShell. The following image shows an example of where this information resides:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/8400.2.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/8400.2.PNG\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p style=\"padding-left:30px\">\n  <strong>Note<\/strong>\u00a0\u00a0You can also use the <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/hh849800.aspx\" target=\"_blank\" rel=\"noopener\">Get-ChildItem<\/a> cmdlet to obtain the thumbprint.\n<\/p>\n<p>After you record this number, type the following Windows PowerShell command to configure Web Application Proxy:<\/p>\n<p>&lt;<\/p>\n<p>p style=&#8221;padding-left:30px&#8221;>\n  Install-WebApplicationProxy \u2013CertificateThumprint <TypetheCertificateThumbprintHere> -FederationServiceName &lt;TypeTheServerFQDNHere)\n<\/p>\n<\/p>\n<p>The following image shows an example of this operation:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/0028.3.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/0028.3.PNG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p style=\"padding-left:30px\">\n  <strong>Note<\/strong>\u00a0 After you type the command, a dialog box will open and ask to you type your credentials.\n<\/p>\n<p>The installation and configuration process of Web Application Proxy is complete at this point. Now you need to publish a means for device registration. For that, use the following Windows PowerShell command:<\/p>\n<p style=\"padding-left:30px\">\n  Add-WebApplicationProxyApplication -BackendServerURL <TypeTheURLHere> -ExternalCertificateThumbprint <TypeTheThumbprintHere> -ExternalURL <TypeTheExternalURLHere> -Name <TypeTheNameHere> ADFS -ADFSRelyingPartyName <TypeTheRelyingPartyHere>\n<\/p>\n<p>Following is an example of this operation:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/4503.4.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/4503.4.PNG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>At this point, if you open the Remote Access Management Console, you should see the following publication of the Web Application Proxy configuration:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/2500.5.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/2500.5.PNG\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>The second requirement for Contoso is to customize the sign-in page, and for that you can read <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/dn280950.aspx\" target=\"_blank\" rel=\"noopener\">Customizing the AD\u00a0FS Sign-in Pages<\/a>. The customization is all done via Windows PowerShell, and this topic provides a great explanation of all the components of the page and how to change them.<\/p>\n<h3><strong>Validating<\/strong><\/h3>\n<p>At this point, you should be able to perform device registration from devices that are coming from the Internet so that they can connect to internal resources. Remember that the device registration experience will vary according to the platform. For Windows\u00a08.1, this process is natively available in the UI as shown in the following image:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/0841.6.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/0841.6.PNG\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>For other platforms, the process happens via the web after the publication is completed. This process uses Web Application Proxy, with AD\u00a0FS as the authentication method. The following image shows the first page that users will see when they try to sign in:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/8831.7.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/8831.7.PNG\" alt=\"Image of screen\" title=\"Image of screen\" \/><\/a><\/p>\n<p>Notice that this page has been fully customized, and the iPad user will have to authenticate. However, the policy is that he needs to be registered to access company resources, so he will see the following screen, which explains that he is authenticated, but he is not authorized to access resources until he registers:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/1452.8.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/1452.8.PNG\" alt=\"Image of screen\" title=\"Image of screen\" \/><\/a><\/p>\n<h3><strong>Additional resources<\/strong><\/h3>\n<p>You can set up your own environment to test this functionality by following the instructions in <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/dn280943.aspx\" target=\"_blank\" rel=\"noopener\">Walkthrough Guide: Connect to Applications and Services from Anywhere with Web Application Proxy<\/a>.<\/p>\n<p>See you next time!<\/p>\n<p>~Yuri<\/p>\n<p>Thank you, Yuri. We are looking forward to your final post!<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\" rel=\"noopener\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\" rel=\"noopener\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\" rel=\"noopener\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\" rel=\"noopener\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><strong>Ed Wilson, Microsoft Scripting Guy<\/strong><\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Guest blogger and security expert, Yuri Diogenes, continues his series about enabling BYOD. Microsoft Scripting Guy, Ed Wilson, is here. Today\u2019s guest blogger is Yuri Diogenes, who continues his security series about enabling BYOD. Yuri is a senior knowledge engineer, and he is a coauthor of the book Windows Server\u00a02012 Security from End to [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[56,3,63,45,420],"class_list":["post-2385","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-guest-blogger","tag-scripting-guy","tag-security","tag-windows-powershell","tag-yuri-diogenes"],"acf":[],"blog_post_summary":"<p>Summary: Guest blogger and security expert, Yuri Diogenes, continues his series about enabling BYOD. Microsoft Scripting Guy, Ed Wilson, is here. Today\u2019s guest blogger is Yuri Diogenes, who continues his security series about enabling BYOD. Yuri is a senior knowledge engineer, and he is a coauthor of the book Windows Server\u00a02012 Security from End to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/2385","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=2385"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/2385\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=2385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=2385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=2385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}