Azure VMware Solution – Streamlined Management

Azure VMware Solution – Streamlined Management post thumbnail image

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 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.

But what does leveraging DSC for AVS VMs really mean for us? Let’s break it down:

First, Visibility & Control. This means we have a dashboard that offers real-time data and the ability to enforce the desired configurations.

Second, Operational Efficiency. By automating routine tasks, we minimize the risk of human error. It is about doing more with less, saving time for what matters most – innovation and growth.

Lastly, Scalability. This means our infrastructure can expand in tandem with our business needs, without the growing pains as we saw in the past.

In conclusion, the Azure Automation State Configuration is not just a tool; it’s a catalyst for streamlined management.

Demo

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.

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.

To Generate DSC metaconfigurations using a DSC configuration

Open VSCode as an administrator on a machine in your local environment.

Copy the following script locally. This script contains a PowerShell DSC configuration for creating metaconfigurations, and a command to kick off the metaconfiguration creation.

# The DSC configuration that will generate metaconfigurations
[DscLocalConfigurationManager()]
Configuration DscMetaConfigs
{
     param
     (
         [Parameter(Mandatory=$True)]
         [String]$RegistrationUrl,

         [Parameter(Mandatory=$True)]
         [String]$RegistrationKey,

         [Parameter(Mandatory=$True)]
         [String[]]$ComputerName,

         [Int]$RefreshFrequencyMins = 30,

         [Int]$ConfigurationModeFrequencyMins = 15,

         [String]$ConfigurationMode = 'ApplyAndMonitor',

         [String]$NodeConfigurationName,

         [Boolean]$RebootNodeIfNeeded= $False,

         [String]$ActionAfterReboot = 'ContinueConfiguration',

         [Boolean]$AllowModuleOverwrite = $False,

         [Boolean]$ReportOnly
     )

     if(!$NodeConfigurationName -or $NodeConfigurationName -eq '')
     {
         $ConfigurationNames = $null
     }
     else
     {
         $ConfigurationNames = @($NodeConfigurationName)
     }

     if($ReportOnly)
     {
         $RefreshMode = 'PUSH'
     }
     else
     {
         $RefreshMode = 'PULL'
     }

     Node $ComputerName
     {
         Settings
         {
             RefreshFrequencyMins           = $RefreshFrequencyMins
             RefreshMode                    = $RefreshMode
             ConfigurationMode              = $ConfigurationMode
             AllowModuleOverwrite           = $AllowModuleOverwrite
             RebootNodeIfNeeded             = $RebootNodeIfNeeded
             ActionAfterReboot              = $ActionAfterReboot
             ConfigurationModeFrequencyMins = $ConfigurationModeFrequencyMins
         }

         if(!$ReportOnly)
         {
         ConfigurationRepositoryWeb AzureAutomationStateConfiguration
             {
                 ServerUrl          = $RegistrationUrl
                 RegistrationKey    = $RegistrationKey
                 ConfigurationNames = $ConfigurationNames
             }

             ResourceRepositoryWeb AzureAutomationStateConfiguration
             {
                 ServerUrl       = $RegistrationUrl
                 RegistrationKey = $RegistrationKey
             }
         }

         ReportServerWeb AzureAutomationStateConfiguration
         {
             ServerUrl       = $RegistrationUrl
             RegistrationKey = $RegistrationKey
         }
     }
}

# Create the metaconfigurations
# NOTE: DSC Node Configuration names are case sensitive in the portal.
# TODO: edit the below as needed for your use case
$Params = @{
     RegistrationUrl = 'https://XXX.agentsvc.eus2.azure-automation.net/accounts/XXX';
     RegistrationKey = 'XXX-XXX-XXX';
     ComputerName = @('aziwavstst01', 'wind2016dc-avs');
     NodeConfigurationName = 'SimpleConfig.webserver';
     RefreshFrequencyMins = 30;
     ConfigurationModeFrequencyMins = 15;
     RebootNodeIfNeeded = $False;
     AllowModuleOverwrite = $False;
     ConfigurationMode = 'ApplyAndMonitor';
     ActionAfterReboot = 'ContinueConfiguration';
     ReportOnly = $False;  # Set to $True to have machines only report to AA DSC but not pull from it
}

# Use PowerShell splatting to pass parameters to the DSC configuration being invoked
# For more info about splatting, run: Get-Help -Name about_Splatting
DscMetaConfigs @Params 
  • You need to Fill in the registration key and URL for your Automation account, as well as the names of the machines to enable.
  • 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.
  • 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).
  • Login to the machines to enable and copy the metaconfigurations folder to the machines that you are enabling
  • Use the following cmdlet to apply the PowerShell DSC metaconfigurations to the machines to enable.

Using the Azure portal, verify that the machines appear as State Configuration nodes registered in your Azure Automation account.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Azure SFTPAzure SFTP

First of all, what is SFTP? Secure File Transfer Protocol (SFTP) is nothing else than a protocol that uses secure shell encryption for transferring data safely. SFTP is a protocol