{"id":1811,"date":"2014-02-13T13:27:00","date_gmt":"2014-02-13T13:27:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2014\/02\/13\/configuring-a-sql-high-availability-group-with-dsc\/"},"modified":"2024-02-22T12:50:24","modified_gmt":"2024-02-22T20:50:24","slug":"configuring-a-sql-high-availability-group-with-dsc","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/configuring-a-sql-high-availability-group-with-dsc\/","title":{"rendered":"Configuring a SQL High Availability Group with DSC"},"content":{"rendered":"<div class=\"WordSection1\">\n<p class=\"MsoNormal\">Let&#8217;s use DSC to configure something complicated!\u00a0 In past blogs, we\u2019ve shown you how to use Windows PowerShell Desired State Configuration (<strong>DSC<\/strong>) to configure relatively simple systems.\u00a0 However, the technologies you deal with on a day to day basis can sometimes become complicated.\u00a0 Don\u2019t worry, DSC can still help simplify configuration.\u00a0 Let\u2019s use <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms190202.aspx\">SQL\u00a0AlwaysOn\u00a0Availability Group (<strong>AG<\/strong>)<\/a> as a example. SQL AG is a new SQL feature that enables replication on top of Windows Server Failover Clustering. While the feature is cool, configuring the environment is quite complex. It involves many steps across multiple machines. Some steps in one machine might depend on progress or status of others.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">In this blog post, we will <strong>demonstrate<\/strong> <strong>using DSC to configure a SQL AG<\/strong>. When using the provided example, one PowerShell command will deploy a SQL AG on Virtual Machines (VMs).<\/p>\n<h2>Environment<\/h2>\n<p class=\"MsoNormal\">Using the DSC configuration scripts described in this blog you can fully deploy and configure the following environment:<\/p>\n<p class=\"MsoNormal\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/2248.fixed.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/2248.fixed.jpg\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<h2>Configuration Overview<\/h2>\n<p class=\"MsoNormal\">To deploy the environment described above in a virtual environment using DSC a configuration is generated for each guest server described above and the VM host machine. All of these configurations are coordinated by a single PowerShell script (Deploy-Demo.ps1). A description of what each of the configuration scripts does is below. A zip (Dsc-SqlDemo.zip) containing all of the configuration files is attached to this blog (see the bottom of the blog) and should be downloaded before you read on so that you can follow along while looking at the associated scripts.<\/p>\n<p class=\"MsoNormal\">\n<h2>Configuring the Host and VMs<\/h2>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">First, Deploy-Demo.ps1 runs <strong>Dsc-SqlDemo\\ConfigSqlDemo.ps1. <\/strong>\u00a0This configures the host machine by doing the following:<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that a VM Switch for an internal network is present (in the demo, subnet of 192.168.100.*)<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that a local user called vmuser is present, so that VMs can access data in host<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that a net share (c:\\SqlDemo\\Sql12Sp1) is present.<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that three VMs are created in the correct state by:<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .75in; text-indent: -.25in;\"><span style=\"font-family: 'Courier New';\">o<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0 <\/span><\/span>Ensuring that a DSC Configuration, DSC Resources, and other files are copied to the VHD image.<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .75in; text-indent: -.25in;\"><span style=\"font-family: 'Courier New';\">o<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0 <\/span><\/span>Ensuring that the VMs are started from the VHDs.<\/p>\n<p class=\"MsoListParagraph\">\n<p class=\"MsoNormal\">Once the host machine is configured, we have three VMs running.\u00a0 Each of these VMs has a configuration that has been bootstrapped into it.\u00a0 Because of the way we bootstrap the VMs, they will configure themselves after startup, using the .mof we have injected into them.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">Stay tuned for a blog post about the bootstrapping procedure.<\/p>\n<p class=\"MsoNormal\">\n<h2>Configuring the Primary Domain Controller &#8211; pdc<\/h2>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">The .mof file injected into the Primary Domain Controller (pdc) VM was generated from the configuration in <strong>Dsc-SqlDemo\\Scenarios\\nodes.ps1 <\/strong>from the node statement <span style=\"font-family: Wingdings;\">\u00e8<\/span> Node $AllNodes.Where{$_.Role -eq &#8220;<strong>PrimaryDomainController<\/strong>&#8221; }.NodeName<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure the VM has a static IPAddress<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure necessary WindowsFeatures are present<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that a Domain Forest is created<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Sets\u00a0 up a network share folder that will be used in the SQL replication process<\/p>\n<p class=\"MsoNormal\">\n<h2>Setting up the first SQL Server- Sql01<\/h2>\n<p class=\"MsoListParagraph\">\n<p class=\"MsoNormal\">The .mof file injected into the first SQL Server (Sql01) VM was generated from the configuration in<strong> Dsc-SqlDemo\\Scenarios\\nodes.ps1 <\/strong>from the node statement <span style=\"font-family: Wingdings;\">\u00e8<\/span> Node $AllNodes.Where{$_.Role -eq &#8220;<strong>PrimarySqlClusterNode<\/strong>&#8221; }.NodeName<\/p>\n<p class=\"MsoNormal\"><strong>\u00a0<\/strong><\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensures that the machines IPAddress is correctly set<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensures that necessary WindowsFeatures are present<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\"><strong>3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/strong><strong>WaitFor Primary Domain Controller to have created the AD Domain <\/strong><\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that the machine is joined to the Domain<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">5.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that .Net 3.5 and SQL Server 2012 SP1 are installed<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">6.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensures that Firewalls are configured such that Sqlbrowser.exe and SqlServr.exe are accessible in the private network.<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">7.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that a Windows Cluster is created and that Sql01 is added to the cluster<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">8.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that the SQL Server for High Availability (HA) service is enabled<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">9.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that there is an Endpoint for the HA<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in; text-indent: -.25in;\">10.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0 <\/span>Ensure that the SQL HA group for databases is created (in the demo, TestDB)<\/p>\n<p class=\"MsoListParagraph\">\n<p class=\"MsoListParagraph\">\n<h2>Setting up the second SQL Server &#8211; Sql02<\/h2>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">The .mof file injected into the second SQL Server (Sql02) VM was generated from the configuration in<strong> Dsc-SqlDemo\\Scenarios\\nodes.ps1 <\/strong>from the node statement <span style=\"font-family: Wingdings;\">\u00e8<\/span> Node $AllNodes.Where{$_.Role -eq &#8220;<strong>ReplicaSqlClusterNode<\/strong>&#8221; }.NodeName<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensures that the machines IPAddress is correctly set<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensures that necessary WindowsFeatures are present<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\"><strong>3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/strong><strong>WaitFor Primary Domain Controller to have created the AD Domain <\/strong><\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that the machine is joined to the Domain<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">5.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that .Net 3.5 and SQL Server 2012 SP1 are installed<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">6.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensures that Firewalls are configured such that Sqlbrowser.exe and SqlServr.exe are accessible in the private network.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\"><strong>7.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/strong><strong>WaitFor the first SQL node to have created the windows cluster <\/strong><\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">8.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that Sql02 is added to the cluster<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">9.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Ensure that the SQL Server for High Availability (HA) service is enabled<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">10.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0 <\/span>Ensure that there is an Endpoint for the HA<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\"><strong>11.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0 <\/span><\/strong><strong>WaitFor the first SQL node to have created the HA group<\/strong><\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">12.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0 <\/span>Ensure that sql02 is joined to the HA group.<\/p>\n<p class=\"MsoNormal\">\n<h2>Deploy the environment<\/h2>\n<p class=\"MsoNormal\">Now that you have an understanding of the environment and what the DSC scripts do, let\u2019s go ahead and deploy the environment using the scripts. Note there is quite a bit of preparation to complete before the scripts can be executed so please be patient.<\/p>\n<h2>Requirements<\/h2>\n<h3>Hardware<\/h3>\n<p class=\"MsoNormal\" style=\"margin-left: .25in;\">\n<p class=\"MsoNormal\">To simulate a SQL AG, we need a decent machine that is capable of running Windows Server 2012 R2 and Hyper-V (64-bit) with at least 16GB of RAM and around 100GB of free disk space. Because this is a demo, we also recommend that you not store important items on the machine, in case it is cleaned up.<\/p>\n<p class=\"MsoNormal\">\n<h3>Software<\/h3>\n<p class=\"MsoNormal\" style=\"margin-left: .25in;\">\n<p class=\"MsoNormal\">The following software are needed to perform the steps in the demo.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>An evaluation version of Windows Server 2012 R2 Datacenter (both ISO and VHD). A download can be found <a href=\"http:\/\/technet.microsoft.com\/en-US\/evalcenter\/dn205286.aspx?CR_CC=200142594\">here<\/a>.\u00a0 Note: We need both the VHD and the ISO because SQL Server requires .Net 3.5, which is not available in the VHD. Fortunately, in the expanded ISO image, there is a folder named Sources\\sxs, that includes all .Net 3.5 files.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>An evaluation version of SQL Server 2012 SP1 (ISO).\u00a0 A download can be found <a href=\"http:\/\/www.microsoft.com\/betaexperience\/pd\/SQL2012EvalCTA\/enus\/default.aspx\">here<\/a>.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>The following DSC resources:<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 1.0in; text-indent: -.25in;\">a.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>User (Ships in Windows Server 2012)<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 1.0in; text-indent: -.25in;\">b.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Windows Feature (Ships in Windows Server 2012)<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 1.0in; text-indent: -.25in;\">c.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>xComputerManagement (Download <a href=\"http:\/\/gallery.technet.microsoft.com\/xComputerManagement-Module-3ad911cc\">here<\/a>)<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 1.0in; text-indent: -.25in;\">d.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>xNetworking (Download <a href=\"http:\/\/gallery.technet.microsoft.com\/xNetworking-Module-818b3583\">here<\/a>)<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 1.0in; text-indent: -.25in;\">e.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>xHyper-V (Download <a href=\"http:\/\/gallery.technet.microsoft.com\/xHyperV-Module-PowerShell-a646ad1a\">here<\/a>)<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 1.0in; text-indent: -.25in;\">f.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>xActiveDirectory (Download <a href=\"http:\/\/gallery.technet.microsoft.com\/xActiveDirectory-f2d573f3\">here<\/a>)<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 1.0in; text-indent: -.25in;\">g.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>xFailOverCluster (Download <a href=\"http:\/\/gallery.technet.microsoft.com\/xFailOverCluster-b5530c34\">here<\/a>)<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 1.0in; text-indent: -.25in;\">h.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>xSqlps (Download <a href=\"http:\/\/gallery.technet.microsoft.com\/xSqlps-PowerShell-Module-aed9426c\">here<\/a>)<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 1.0in; text-indent: -.25in;\">i.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>xSmbShare (Download <a href=\"http:\/\/gallery.technet.microsoft.com\/xSmbShare-PowerShell-cafb8ba6\">here<\/a>)<\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<h3>Certificate<\/h3>\n<p style=\"margin: 0in; margin-bottom: .0001pt;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Setting up domain controllers or SQL servers requires a few credentials. \u00a0To keep these credentials secure, DSC encrypts them before placing them into the plain text of the .mof files.\u00a0 For details on this process, check out this <\/span><a href=\"http:\/\/blogs.msdn.com\/b\/powershell\/archive\/2014\/01\/31\/want-to-secure-credentials-in-windows-powershell-desired-state-configuration.aspx\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif';\">blog<\/span><\/a><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">. To secure credentials, DSC uses a certificate\u2019s public key to encrypt the credentials and the private key to decrypt the credentials on the target machine that is being configured. To ensure that this demo works correctly, we need to ensure that the host and the target machines have the appropriate certificates. <\/span><\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">To do this, we first create a self-signed certificate on the host machine, then copy it with <strong>private key<\/strong> to the target machines.\u00a0 We then install the certificate to the target\u2019s local machine certificate store. Since private key should be kept secret, <strong>it is important to clean them up as soon as possible <\/strong>(instructions can be found below).\u00a0 \u00a0Again, with this, please ensure you do NOT run the demo in production or on machines that require security by default.\u00a0 <\/span><\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Steps to setup certificate on the host machine:<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: Symbol; color: black;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Get MakeCert.exe if you don\u2019t have. (It is shipped with Windows SDK, a download can be found <\/span><a href=\"http:\/\/msdn.microsoft.com\/en-us\/windows\/desktop\/bg162891.aspx\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif';\">here<\/span><\/a><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">). <\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: Symbol; color: black;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Create a certificate with <strong>CN=DSCDemo<\/strong>. To do this, open a PowerShell console with Administrator elevation, cd to place that can see MakeCert.exe, and run the following command (notice, for security reasons, I make the cert expire as soon as possible, please adjust the <span style=\"background: yellow;\">highlighted date<\/span> as needed).<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: green; background: white;\">makecert -r -pe -n &#8220;CN=DSCDemo&#8221; -sky exchange -ss my -sr localMachine<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: green;\"> <span style=\"background: yellow;\">\u2013e 02\/15\/2014<\/span><\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .25in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .25in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">The command line above will create a self-signed certificate on localhost certificate store (cert:\\localMachine\\My, with Subject = \u201c<strong>CN=DSCDemo<\/strong>\u201d). \u00a0Remember the subject, we will need it very soon. In my example, the UI in the certificate store looks like the following in (<strong>Certificates(Local Computer)\\Personal\\Certificates<\/strong>)<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .25in;\">\n<p style=\"margin: 0in 0in .0001pt .25in;\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/0636.first.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/0636.first.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p style=\"margin: 0in 0in .0001pt .25in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: Symbol; color: black;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Create a folder to hold the keys for the demo. In my example, I created C:\\keys<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: Symbol; color: black;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><strong><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Public key.<\/span><\/strong><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\"> Export the public key of the certificate. \u00a0You can do this manually, or do it with the following PS script. In my example, I saved the public key as: <strong>C:\\keys\\Dscdemo.cer<\/strong>\u201d<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-left: 0.5in; padding-left: 90px;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$certSubject<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> = <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: maroon; background: white;\">&#8220;CN=DSCDemo&#8221;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-left: 0.5in; padding-left: 90px;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$keysFolder<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> = Join-Path <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$env<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\">:SystemDrive -ChildPath <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: maroon; background: white;\">&#8220;Keys&#8221;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-left: 0.5in; padding-left: 90px;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$cert<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> = dir Cert:\\LocalMachine\\My | ? { <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$_<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\">.Subject -eq <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$certSubject<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> }<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-left: 0.5in; padding-left: 90px;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: blue; background: white;\">if<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> (! (Test-Path <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$keysFolder<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> ))<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-left: 0.5in; padding-left: 90px;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\">{<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-left: 0.5in; padding-left: 90px;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\">\u00a0\u00a0\u00a0 md <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$keysFolder<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> | Out-Null<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-left: 0.5in; padding-left: 90px;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\">}<\/span><\/p>\n<p style=\"margin: 0in 0in 0.0001pt 0.5in; padding-left: 90px;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$certPath<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> = Export-Certificate -Cert <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$cert<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> -FilePath (Join-Path <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$keysFolder<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> -ChildPath <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: maroon; background: white;\">&#8220;Dscdemo.cer&#8221;<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\">)<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: Symbol; color: black;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><strong><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Private key<\/span><\/strong><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\"> and <strong>protection-Password<\/strong>. For security reason, export the private key certificate as the following:<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt 1.25in;\"><span style=\"font-size: 11.0pt; font-family: 'Courier New'; color: black;\">o<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">In Personal\\Certificates, find the certificate Issued to \u201c<\/span><strong><span style=\"color: black;\">DSCDemo<\/span><\/strong><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u201d as shown above. Right click and select the \u201cExport\u2026\u201d option.<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt 1.25in;\"><span style=\"font-size: 11.0pt; font-family: 'Courier New'; color: black;\">o<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Take the option of \u201cexport private key\u201d<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt 1.25in;\"><span style=\"font-size: 11.0pt; font-family: 'Courier New'; color: black;\">o<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">UI will ask you for a<\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">password for the protection.<\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0Enter and remember your password<\/span><span style=\"color: black;\">, <\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">you<\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">need it very soon. For this demo<\/span><span style=\"color: black;\">, <\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">we used <\/span><strong><span style=\"color: black;\">P@ssword<\/span><\/strong><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt 1.25in;\"><span style=\"font-size: 11.0pt; font-family: 'Courier New'; color: black;\">o<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Export the certificate to the appropriate folder.\u00a0 In my example, it is <strong>C:\\keys\\Dscdemo.pfx<\/strong><\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: Symbol; color: black;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><strong><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Certificate Thumbprint<\/span><\/strong><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">. Run the following PS script to get certificate\u2019s thumbprint, we need it very soon.<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\">dir Cert:\\LocalMachine\\My | ? { <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: orangered; background: white;\">$_<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\">.Subject -eq <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: maroon; background: white;\">&#8220;CN=DSCDemo&#8221;<\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black; background: white;\"> }<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 9.5pt; font-family: Consolas; color: black;\">\u00a0<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif';\">In my example, it is E513EEFCB763E6954C52BA66A1A81231BF3F551E<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .25in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Update the deployment scripts:<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">With above steps, we need update deployment scripts to point to the correct certificate values. <\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\">\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt 1.0in;\"><span style=\"font-size: 11.0pt; font-family: Symbol; color: black;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"color: black;\">Public key location<\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">: <\/span><span style=\"color: black;\">in my example, it is C:\\keys\\Dscdemo.cert<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt 1.0in;\"><span style=\"font-size: 11.0pt; font-family: Symbol; color: black;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"color: black;\">Thrumbprint<\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">: <\/span><span style=\"color: black;\">in my example, it is <\/span><span style=\"font-size: 9.5pt; font-family: Consolas; color: black;\">E513EEFCB763E6954C52BA66A1A81231BF3F551E<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt 1.0in;\"><span style=\"font-size: 11.0pt; font-family: Symbol; color: black;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"color: black;\">Private key location<\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">: <\/span><span style=\"color: black;\">in my example, it is C:\\keys\\Dscdemo.pfx<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt 1.0in;\"><span style=\"font-size: 11.0pt; font-family: Symbol; color: black;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Private key protection password: in my example, it is P@ssword<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\">\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Update the following places in the deployment scripts:<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\">\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">2.1 <strong>ConfigSqlDemoData.psd1<\/strong> <\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\">\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">At line 56, modify the file to point to your private key location.<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Lucida Console';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><span style=\"font-size: 10.0pt; font-family: 'Lucida Console';\">SourcePath <span style=\"color: darkgray;\">=<\/span> <span style=\"color: darkred;\">&#8220;<\/span><span style=\"color: orangered;\">C:<\/span><span style=\"color: darkred;\">\\Keys\\Dscdemo.pfx&#8221;<\/span>;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Lucida Console';\">\u00a0<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\">\n<p style=\"margin: 0in 0in .0001pt .5in;\">\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">At line 145-146, modify the file to point to your certificate file and Thumbprint:<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 12.0pt; font-family: 'Lucida Console';\">\u00a0<\/span><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 @{<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 NodeName<span style=\"color: darkgray;\">=<\/span> <span style=\"color: darkred;\">&#8220;*&#8221;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>\u00a0\u00a0\u00a0\u00a0\u00a0CertificateFile <span style=\"color: darkgray;\">=<\/span> <span style=\"color: darkred;\">&#8220;C:\\keys\\Dscdemo.cer&#8221;<\/span><\/strong><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><strong><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Thumbprint <span style=\"color: darkgray;\">=<\/span> <span style=\"color: darkred;\">&#8220;E513EEFCB763E6954C52BA66A1A81231BF3F551E&#8221;<\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><strong><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\">\u00a0<\/span><\/strong><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt; text-indent: .5in;\"><strong><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">2.2 deployment\\installcert.ps1<\/span><\/strong><\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt; text-indent: .5in;\">\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console'; color: navy;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -Password<\/span><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\"> $(<span style=\"color: blue;\">ConvertTo-SecureString<\/span> <span style=\"color: navy;\">-String<\/span> <span style=\"color: darkred;\">&#8220;<span style=\"background: yellow;\">P@ssword<\/span>&#8221; <\/span><\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">This corresponds private key protection password. Change it to the value you just entered.<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Install the certificate to the VMs.\u00a0 Now that we\u2019ve done steps 1 and 2, the deployment script will do the following <em>automatically<\/em>:<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .25in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Encrypt credentials for the environment that is going to set up. <\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Copy the private key and the script (installcert.ps1) that holds the private key protection password to each VM\u2019s VHD file (into the VHD\u2019s c:\\deployment folder). Once the VM is started, it will install the certificate with the private key. <\/span><\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .5in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Clean up the certificate.<\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0 <\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">After you are done with the demo, please remove certificate and keys as soon as possible with the following steps:<\/span><\/p>\n<p style=\"margin: 0in 0in .0001pt .25in;\">\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Delete the certificate files. In my case, I delete all files under C:\\keys<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">Remove the self-signed certificate we just created. In my case, I used the UI to go to <strong>Certificates(Local Computer)\\Personal\\Certificates, <\/strong>and deleted certificate issued to <strong>DSCDemo<\/strong><\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif';\">Remove the password in the deployment\\installcert.ps1 file.<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif';\">Delete the xml files under deployment (pdc.xml, sql01.xml, sql02.xml) because they have passwords for VMs bootstrap. <\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">5.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif';\">In each VM, delete the files under C:\\deployment<\/span><\/p>\n<p style=\"text-indent: -.25in; margin: 0in 0in .0001pt .75in;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">6.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif';\">Shred the recycle bin of the host machine. <\/span><\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt;\"><span style=\"font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: black;\">\u00a0<\/span><\/p>\n<p class=\"MsoListParagraph\">\n<h2>Prepare the host<\/h2>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">Before we can run the demo, we need to make sure that we have all of the necessary files in the appropriate places.<\/p>\n<p class=\"MsoListParagraph\"><strong><span style=\"font-size: 14.0pt;\">\u00a0<\/span><\/strong><\/p>\n<h3>Copying Files<\/h3>\n<p class=\"MsoListParagraph\" style=\"margin-left: .25in;\"><span style=\"font-size: 12.0pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>\u00a0Confirm that the host machine is running Windows Server 2012 R2. If that is not the case, you can expand the ISO downloaded above to DVD, and install Windows Server 2012 R2 from there. The host is also required to have <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/cc732470(v=ws.10).aspx\">Hyper-V<\/a>. Please see the Hyper-V Start Guide in the reference section for more details on Hyper-V.\u00a0 It is recommend to upgrade the OS with latest patches by running Windows Update.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Create a folder named SqlDemo. In my case, I created the folder here: <strong>C:\\SqlDemo<\/strong><\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Copy the Windows Server 2012 R2 VHD file to C:\\SqlDemo. For me, this looks like<span style=\"font-size: 12.0pt; font-family: 'Lucida Console';\">: \u201c<\/span><strong><span style=\"color: darkred;\">c:\\SqlDemo\\9600.16415.amd64fre.winblue_refresh.130928-2229_server_serverdatacentereval_en-us.vhd\u201d <\/span><\/strong><\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Copy the Windows Server ISO to C:\\SqlDemo. To make things simple, you can rename the file to a short name. In my case, this looks like: C:\\SqlDemo\\WS12R2.ISO<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">5.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Similarly, copy the SQL ISO \u00a0to C:\\SqlDemo. Again, rename the file to a short name like this: C:\\SqlDemo\\SqlSP1.iso<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">6.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Unzip Dsc-SqlDemo.zip. In my case, it is like C:\\Dsc-SqlDemo, the entire folder like the following:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2014\/02\/4834.missing.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-20325\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2014\/02\/4834.missing.png\" alt=\"Image 4834 missing\" width=\"271\" height=\"303\" srcset=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2014\/02\/4834.missing.png 271w, https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2014\/02\/4834.missing-268x300.png 268w\" sizes=\"(max-width: 271px) 100vw, 271px\" \/><\/a><\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">7.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>download xActiveDirectory, xComputerManagement, xFailOverCluster, xHyper-V, xNetworking, xSmbShare, xSqlPs modules if not. Copy them to root of unzipped folder. It looks like the following in the end:<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\" style=\"text-align: center;\" align=\"center\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/4621.third.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/4621.third.png\" alt=\"\" width=\"290\" height=\"497\" border=\"0\" \/><\/a><\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: .75in;\">\n<h3>Extracting Content<\/h3>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">Now that we\u2019ve copied the ISOs into the necessary locations, we need to extract some of their content.\u00a0 Specifically, we need to get the sxs files (which include .Net 3.5), and the SQL content.\u00a0 <strong>While<\/strong> there are many ways to do this, the simplist way <strong>in this situation is to run the \u201cGetFilesFromImage.ps1\u201d<\/strong> script in DSC-SqlDemo folder.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Open a Windows PowerShell console (with<strong> Administrator privileges<\/strong>), and cd to the Dsc-SqlDemo folder.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Run the following script to <strong>get sxs files including .Net 3.5<\/strong><\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">.\\GetFilesFromImage.ps1 -ImagePath c:\\SqlDemo\\WS12R2.ISO -SrcPath \u201csources\\sxs\u201d -DstPath <strong>c:\\SqlDemo\\Srv12R2\\sxs<\/strong><\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\"><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/63\/74\/3704.fourth.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/63\/74\/3704.fourth.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p class=\"MsoCaption\">Figure 1: Note: -SrcPath has no driver letter because we don\u2019t know which driver letter the ISO image will mount to until runtime.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Similarly, get the <strong>entire Sql ISO content<\/strong> by running the following script:<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">.\\GetFilesFromImage.ps1 -ImagePath c:\\SqlDemo\\Sql12SP1.ISO -SrcPath \u201c*\u201d \u2013DstPath <strong>c:\\SqlDemo\\Sql12SP1<\/strong><\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/8231.fifth.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/8231.fifth.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">Remember folder c:\\SqlDemo\\Srv12R2\\sxs and c:\\SqlDemo\\Sql12SP1, we need them later on.<\/p>\n<h2><\/h2>\n<h3>Checking the Configuration Data File<\/h3>\n<p class=\"MsoNormal\"><strong>\u00a0<\/strong><\/p>\n<p class=\"MsoNormal\">It\u2019s important to ensure the configuration data file (c:\\dsc-SqlDemo\\<strong>ConfigSqlDemoData.psd1<\/strong>) has the correct information. If you used the same paths as above for <strong>SqlDemo<\/strong>, and are okay with using the default credentials, the demo should work without any change. However, if <strong>SqlDemo<\/strong> and underneath files is in different path, driver, or name, their locations need to be updated in the data file.<\/p>\n<p class=\"MsoNormal\">\n<h4>Checking Credentials<\/h4>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\"><strong>By default, \u201cP@ssword\u201d is the password for every credential<\/strong>. You can change to your own if you would like, but please remember them. And don\u2019t forget to do clean up after the demo.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">Also, notice, those three VMs are created in private network of the host. In another word, they are only visible to each other and the host. To make vm access software\u2019s on the host, we create a local user: vmuser, which could read access to SqlDemo folder (in my case: c:\\SqlDemo).<\/p>\n<p class=\"MsoNormal\">\n<h4>Checking Paths<\/h4>\n<p class=\"MsoListParagraph\">\n<p class=\"MsoNormal\">Confirm that the following paths in the <strong>ConfigSqlDemoData.psd1<\/strong> file are correct:<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console'; color: darkgreen;\"># Windows Server 2012 R2 vhd <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\">VhdSrcPath <span style=\"color: darkgray;\">=<\/span> <span style=\"color: darkred;\">&#8220;c:\\SqlDemo\\9600.16415.amd64fre.winblue_refresh.130928-2229_server_serverdatacentereval_en-us.vhd&#8221;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\"># .Net 3.5 source files\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\">@{ Source <span style=\"color: darkgray;\">=<\/span> <span style=\"color: darkred;\">&#8220;C:\\SqlDemo\\Svr12R2\\sxs&#8221;<\/span>;\u00a0\u00a0\u00a0 Destination <span style=\"color: darkgray;\">=<\/span> <span style=\"color: darkred;\">&#8220;sxs&#8221;<\/span> } <\/span><\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console'; color: darkgreen;\"># Sql software folder on Host<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white;\"><span style=\"font-size: 9.0pt; font-family: 'Lucida Console';\">SqlSrcHostPath <span style=\"color: darkgray;\">=<\/span> <span style=\"color: darkred;\">&#8220;C:\\SqlDemo\\Sql12SP1&#8221;<\/span>\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\">\n<h2>Running the demo<\/h2>\n<p class=\"MsoListParagraph\">\n<p class=\"MsoNormal\">Once everything is ready, running the demo is as simple as this:<\/p>\n<p class=\"MsoNormal\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/0474.sixth.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/0474.sixth.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p class=\"MsoListParagraph\">\n<p class=\"MsoListParagraph\" style=\"margin-left: 0in;\">The script will ask you to enter password for private domain administrator, sql administrator, user to access host file share, and user on the host for the file share access. The last two should have the same password. In my example, I entered &#8220;P@ssword&#8221; four times for the sake of simply.<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0in;\">\n<p class=\"MsoListParagraph\" style=\"margin-left: 0in;\">After about 30-60 minutes, the SQL AG will be set up across three VMs running on the host machine:<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0in;\">\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>SqlDemo-pdc \u2013 the primary domain controller, which ensures the private domain for two SQL cluster nodes.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>SqlDemo-Sql01 \u2013 the primary node in SQL\u00a0AlwaysOn Availability Group<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>SqlDemo-Sql02 \u2013 the secondary node in SQL\u00a0AlwaysOn Availability Group<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0in;\">\n<p class=\"MsoListParagraph\" style=\"margin-left: 0in;\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/3660.seventh.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/3660.seventh.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p class=\"MsoNormal\">\n<h3><span class=\"Heading2Char\"><span style=\"font-size: 13.0pt;\">Verification (How do you know it worked)<\/span><\/span><\/h3>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">It&#8217;s worth noting that when the configuration returns success on the host machine, that only indicates that the VMs have been created, NOT that SQL\u00a0AG deployment on VMs is completed.\u00a0 The deployment takes about 30-60 minutes, so be patient with the installation script.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">To check for complete status:<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\"><span style=\"font-family: Symbol;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span>Monitor the size of the vhds being created on the host machine under Vm\\. pdc vhd should be about 2.4 GB, sql vhds should be about 8GB.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">To debug a failure:<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\"><span style=\"font-family: Symbol;\">\u00b7<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span>Check the ETW events on each VM under Applications and Services Logs\\Microsoft\\Windows\\Desired State Configuration\/Operational<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">To confirm success:<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Login to one of SQLs nodes<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Start \u201cMicrosoft SQL Server Management Studio\u201d<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Connect to one of SQL instances (like sql01, or 192.168.100.11 in IP)<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Under \u201cAlwaysOn High Availability\u201d, you should see something like the following snapshot:<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/7041.eigth.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/30\/2018\/10\/7041.eigth.png\" alt=\"\" width=\"400\" height=\"510\" border=\"0\" \/><\/a><\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">5.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Expand the Databases folder<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">6.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Open TestDB<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">7.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Populate some data<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -.25in;\">8.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Check that it is replicated on the second node shortly thereafter.<\/p>\n<h2>Key Takeaways<\/h2>\n<p class=\"MsoNormal\">This example is far more complex than most others that have been shown or created.\u00a0 As such, it demonstrates many characteristics of configurations that may be lost in the simpler scenarios.\u00a0 Here are a few things we think are worth noting.<\/p>\n<p class=\"MsoNormal\">\n<ol>\n<li><span style=\"font: 7.0pt 'Times New Roman';\">\u00a0<\/span>Each configuration uses a <em>Configuration Data File<\/em> to separate the structural configuration data from the environmental configuration.\u00a0 This allows the example to easily scale up.<\/li>\n<li>The <em>\u201cWaitFor\u201d pattern<\/em> is used many times to coordinate across machines.\u00a0 This pattern is used in scenarios where a machine needs to wait for another machines to do something.\u00a0 For example, Sql02 needed to wait for the Primary Domain Controller to create the domain before ensuring that it was joined to the domain.<\/li>\n<li>The configurations that ran in pdc, sql01, and sql02 were bootstrapped into the VHDs as .mof files.\u00a0 This technique improves scalability and performance when configuring VMs at startup.\u00a0 Stay tuned for a blog post on this later.<\/li>\n<\/ol>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">That\u2019s it!\u00a0 Let us know what you think in the comments.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">Enjoy the fun!<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">Chen Shang, Mark Gray, John Slack, Narine Mossikyan<\/p>\n<p class=\"MsoNormal\">Windows DSC Team<\/p>\n<\/div>\n<p><a href=\"https:\/\/web.archive.org\/web\/20190110105921\/https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/10\/49\/70\/70\/Dsc-SqlDemo.zip\">Dsc-SqlDemo.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s use DSC to configure something complicated!\u00a0 In past blogs, we\u2019ve shown you how to use Windows PowerShell Desired State Configuration (DSC) to configure relatively simple systems.\u00a0 However, the technologies you deal with on a day to day basis can sometimes become complicated.\u00a0 Don\u2019t worry, DSC can still help simplify configuration.\u00a0 Let\u2019s use SQL\u00a0AlwaysOn\u00a0Availability Group [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[142,150,251,345,348],"class_list":["post-1811","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-desired-state-configuration","tag-dsc","tag-powershell-4-0","tag-windows-powershell-4-0","tag-windows-powershell-desired-state-configuration"],"acf":[],"blog_post_summary":"<p>Let&#8217;s use DSC to configure something complicated!\u00a0 In past blogs, we\u2019ve shown you how to use Windows PowerShell Desired State Configuration (DSC) to configure relatively simple systems.\u00a0 However, the technologies you deal with on a day to day basis can sometimes become complicated.\u00a0 Don\u2019t worry, DSC can still help simplify configuration.\u00a0 Let\u2019s use SQL\u00a0AlwaysOn\u00a0Availability Group [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/1811","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=1811"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/1811\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=1811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=1811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=1811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}