{"id":1060,"date":"2023-10-31T15:31:54","date_gmt":"2023-10-31T15:31:54","guid":{"rendered":"https:\/\/bogdanburuiana.com\/?p=1060"},"modified":"2023-11-23T15:32:19","modified_gmt":"2023-11-23T15:32:19","slug":"azure-vmware-solution-streamlined-management","status":"publish","type":"post","link":"https:\/\/bogdanburuiana.com\/index.php\/2023\/10\/31\/azure-vmware-solution-streamlined-management\/","title":{"rendered":"Azure VMware Solution &#8211; Streamlined Management"},"content":{"rendered":"\n<p><strong>Azure Automation State Configuration (DSC)<\/strong><br><span style=\"font-size:14.0pt;font-family:Arial;mso-ascii-font-family:Arial;\nmso-fareast-font-family:+mn-ea;mso-bidi-font-family:+mn-cs;mso-ascii-theme-font:\nminor-latin;mso-fareast-theme-font:minor-fareast;mso-bidi-theme-font:minor-bidi;\ncolor:#2E404D;mso-color-index:3;mso-font-kerning:12.0pt;language:en-GB;\nmso-style-textfill-type:solid;mso-style-textfill-fill-themecolor:text2;\nmso-style-textfill-fill-color:#2E404D;mso-style-textfill-fill-alpha:100.0%\">The Azure VMware Solution (AVS) seamlessly bridges the gap between on-premises VMware environments and the Azure cloud, offering businesses the flexibility to migrate, extend, and manage their VMware workloads on Azure. Complementing this, the Azure Automation State Configuration (DSC) is an Azure-native configuration management tool, enabling precise and automated configuration of servers. Together, AVS and DSC provide a robust framework that not only streamlines workload management on Azure but also ensures they run optimally, securely, and in line with the desired configurations.<\/span><\/p>\n\n\n\n<p>But what does leveraging DSC for AVS VMs really mean for us? Let\u2019s break it down:<\/p>\n\n\n\n<p>First, <strong>Visibility &amp; Control<\/strong>. This means we have a dashboard that offers real-time data and the ability to enforce the desired configurations.<\/p>\n\n\n\n<p>Second, <strong>Operational Efficiency<\/strong>. By automating routine tasks, we minimize the risk of human error. It is about doing more with less, saving time for what matters most \u2013 innovation and growth.<\/p>\n\n\n\n<p>Lastly, <strong>Scalability.<\/strong> This means our infrastructure can expand in tandem with our business needs, without the growing pains as we saw in the past.<\/p>\n\n\n\n<p>In conclusion, the Azure Automation State Configuration is not just a tool; it&#8217;s a catalyst for streamlined management.<\/p>\n\n\n\n<p><strong>Demo<\/strong><\/p>\n\n\n\n<p><em>This demo is about enabling Windows servers running in AVS Environment to Azure Automation State Configuration. The servers in AVS Environment must have outbound access to Azure.<\/em><\/p>\n\n\n\n<p>There is a pre-requisite to begin with, making sure that the latest version of WMF 5 is installed on the machines to enable for State Configuration. Open PowerShell and use the following command to check the version of WMF.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"477\" height=\"106\" src=\"https:\/\/bogdanburuiana.com\/wp-content\/uploads\/2023\/11\/image-13.png\" alt=\"\" class=\"wp-image-1062\" srcset=\"\/wp-content\/uploads\/2023\/11\/image-13.png 477w, \/wp-content\/uploads\/2023\/11\/image-13-300x67.png 300w\" sizes=\"(max-width: 477px) 100vw, 477px\" \/><\/figure>\n\n\n\n<p>To Generate DSC metaconfigurations using a DSC configuration<\/p>\n\n\n\n<p>Open VSCode as an administrator on a machine in your local environment.<\/p>\n\n\n\n<p>Copy the following script locally. This script contains a PowerShell DSC configuration for creating metaconfigurations, and a command to kick off the metaconfiguration creation.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># The DSC configuration that will generate metaconfigurations\n&#91;DscLocalConfigurationManager()]\nConfiguration DscMetaConfigs\n{\n     param\n     (\n         &#91;Parameter(Mandatory=$True)]\n         &#91;String]$RegistrationUrl,\n\n         &#91;Parameter(Mandatory=$True)]\n         &#91;String]$RegistrationKey,\n\n         &#91;Parameter(Mandatory=$True)]\n         &#91;String&#91;]]$ComputerName,\n\n         &#91;Int]$RefreshFrequencyMins = 30,\n\n         &#91;Int]$ConfigurationModeFrequencyMins = 15,\n\n         &#91;String]$ConfigurationMode = 'ApplyAndMonitor',\n\n         &#91;String]$NodeConfigurationName,\n\n         &#91;Boolean]$RebootNodeIfNeeded= $False,\n\n         &#91;String]$ActionAfterReboot = 'ContinueConfiguration',\n\n         &#91;Boolean]$AllowModuleOverwrite = $False,\n\n         &#91;Boolean]$ReportOnly\n     )\n\n     if(!$NodeConfigurationName -or $NodeConfigurationName -eq '')\n     {\n         $ConfigurationNames = $null\n     }\n     else\n     {\n         $ConfigurationNames = @($NodeConfigurationName)\n     }\n\n     if($ReportOnly)\n     {\n         $RefreshMode = 'PUSH'\n     }\n     else\n     {\n         $RefreshMode = 'PULL'\n     }\n\n     Node $ComputerName\n     {\n         Settings\n         {\n             RefreshFrequencyMins           = $RefreshFrequencyMins\n             RefreshMode                    = $RefreshMode\n             ConfigurationMode              = $ConfigurationMode\n             AllowModuleOverwrite           = $AllowModuleOverwrite\n             RebootNodeIfNeeded             = $RebootNodeIfNeeded\n             ActionAfterReboot              = $ActionAfterReboot\n             ConfigurationModeFrequencyMins = $ConfigurationModeFrequencyMins\n         }\n\n         if(!$ReportOnly)\n         {\n         ConfigurationRepositoryWeb AzureAutomationStateConfiguration\n             {\n                 ServerUrl          = $RegistrationUrl\n                 RegistrationKey    = $RegistrationKey\n                 ConfigurationNames = $ConfigurationNames\n             }\n\n             ResourceRepositoryWeb AzureAutomationStateConfiguration\n             {\n                 ServerUrl       = $RegistrationUrl\n                 RegistrationKey = $RegistrationKey\n             }\n         }\n\n         ReportServerWeb AzureAutomationStateConfiguration\n         {\n             ServerUrl       = $RegistrationUrl\n             RegistrationKey = $RegistrationKey\n         }\n     }\n}\n\n# Create the metaconfigurations\n# NOTE: DSC Node Configuration names are case sensitive in the portal.\n# TODO: edit the below as needed for your use case\n$Params = @{\n     RegistrationUrl = 'https:\/\/XXX.agentsvc.eus2.azure-automation.net\/accounts\/XXX';\n     RegistrationKey = 'XXX-XXX-XXX';\n     ComputerName = @('aziwavstst01', 'wind2016dc-avs');\n     NodeConfigurationName = 'SimpleConfig.webserver';\n     RefreshFrequencyMins = 30;\n     ConfigurationModeFrequencyMins = 15;\n     RebootNodeIfNeeded = $False;\n     AllowModuleOverwrite = $False;\n     ConfigurationMode = 'ApplyAndMonitor';\n     ActionAfterReboot = 'ContinueConfiguration';\n     ReportOnly = $False;  # Set to $True to have machines only report to AA DSC but not pull from it\n}\n\n# Use PowerShell splatting to pass parameters to the DSC configuration being invoked\n# For more info about splatting, run: Get-Help -Name about_Splatting\nDscMetaConfigs @Params \n<\/code><\/pre>\n\n\n\n<ul>\n<li>You need to Fill in the registration key and URL for your Automation account, as well as the names of the machines to enable.<\/li>\n\n\n\n<li>To Find the registration key and registration URL for your Automation account in Azure Portal as shown below. The Keys and URL are masked for security.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"559\" height=\"257\" src=\"https:\/\/bogdanburuiana.com\/wp-content\/uploads\/2023\/11\/image-14.png\" alt=\"\" class=\"wp-image-1063\" srcset=\"\/wp-content\/uploads\/2023\/11\/image-14.png 559w, \/wp-content\/uploads\/2023\/11\/image-14-300x138.png 300w\" sizes=\"(max-width: 559px) 100vw, 559px\" \/><\/figure>\n\n\n\n<ul>\n<li>Run the script. You should now have a working directory folder called DscMetaConfigs, containing the PowerShell DSC metaconfigurations for the machines to enable (as an administrator).<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"216\" src=\"https:\/\/bogdanburuiana.com\/wp-content\/uploads\/2023\/11\/image-15.png\" alt=\"\" class=\"wp-image-1064\" srcset=\"\/wp-content\/uploads\/2023\/11\/image-15.png 624w, \/wp-content\/uploads\/2023\/11\/image-15-300x104.png 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<ul>\n<li>Login to the machines to enable and copy the metaconfigurations folder to the machines that you are enabling<\/li>\n<\/ul>\n\n\n\n<ul>\n<li>Use the following cmdlet to apply the PowerShell DSC metaconfigurations to the machines to enable.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"98\" src=\"https:\/\/bogdanburuiana.com\/wp-content\/uploads\/2023\/11\/image-16.png\" alt=\"\" class=\"wp-image-1065\" srcset=\"\/wp-content\/uploads\/2023\/11\/image-16.png 624w, \/wp-content\/uploads\/2023\/11\/image-16-300x47.png 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Using the Azure portal, verify that the machines appear as State Configuration nodes registered in your Azure Automation account.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"293\" src=\"https:\/\/bogdanburuiana.com\/wp-content\/uploads\/2023\/11\/image-17.png\" alt=\"\" class=\"wp-image-1066\" srcset=\"\/wp-content\/uploads\/2023\/11\/image-17.png 909w, \/wp-content\/uploads\/2023\/11\/image-17-300x97.png 300w, \/wp-content\/uploads\/2023\/11\/image-17-768x248.png 768w\" sizes=\"(max-width: 909px) 100vw, 909px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Azure Automation State Configuration (DSC)The Azure VMware Solution (AVS) seamlessly bridges the gap between on-premises VMware environments and the Azure cloud, offering businesses the flexibility to migrate, extend, and manage their VMware workloads on Azure. Complementing this, the Azure Automation State Configuration (DSC) is an Azure-native configuration management tool, enabling precise and automated configuration of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1061,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,4],"tags":[],"_links":{"self":[{"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/posts\/1060"}],"collection":[{"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/comments?post=1060"}],"version-history":[{"count":1,"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/posts\/1060\/revisions"}],"predecessor-version":[{"id":1067,"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/posts\/1060\/revisions\/1067"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/media\/1061"}],"wp:attachment":[{"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/media?parent=1060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/categories?post=1060"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bogdanburuiana.com\/index.php\/wp-json\/wp\/v2\/tags?post=1060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}