Add Custom Script Extension Azure Arc Server

Extensions for Azure Arc enabled Servers

With the latest update for Azure Arc for Servers, you are now able to deploy and use extensions with your Azure Arc enabled servers. Currently, you have six different Azure Arc extensions you can deploy to your servers.

  • Custom Script Extension for Linux – Azure Arc
  • DSCForLinux extension on a Ubuntu
  • OMS Agent for Linux – Azure Arc
  • Custom Script Extension for Windows – Azure Arc
  • PowerShell Desired State Configuration – Azure Arc
  • Microsoft Monitoring Agent – Azure Arc

These extensions are similar and consistent with the virtual machine extensions for Azure VMs. These are small applications that provide post-deployment configuration and automation tasks on Azure Arc enabled servers. For example, if a server requires software installation, anti-virus protection, or to run a script inside of it, an Azure Arc extension can be used. Extensions can be run with the Azure CLI, PowerShell, and the Azure portal.

Introducing Azure Arc
For customers who want to simplify complex and distributed environments across on-premises, edge and multicloud, Azure Arc enables deployment of Azure services anywhere and extends Azure management to any infrastructure.
Learn more about Azure Arc here.

You can find more information about Virtual machine extension management with Azure Arc for servers on Microsoft Docs.

Extensions

Here is a quick overview of the current extensions you can deploy.

Add Custom Script Extension

Add Custom Script Extension

Custom Script Extension for Linux

Custom Script Extension for Linux – Azure Arc is a tool to execute your machine customization tasks post machine provision. When this extension is added to an Azure Arc machine, it can download customer’s scripts from the Azure storage or public storage, and execute the scripts on the machine. Custom Script Extension for Linux – Azure Arc tasks can also be automated using the Azure PowerShell cmdlets and Azure Cross-Platform Command-Line Interface (Azure CLI).

DSCForLinux extension on a Ubuntu

This template installs the DSCForLinux extension 2.70 or latest.

OMS Agent for Linux/Microsoft Monitoring Agent – Azure Arc

The Log Analytics agent collects monitoring data from the guest operating system and workloads of virtual machines in Azure, other cloud providers, and on-premises and sends that data into a Log Analytics workspace. It is used by Azure Monitor, Azure Security Center, and Azure Sentinel, among other Azure management solutions.

Custom Script Extension for Windows

Custom Script Extension for Windows – Azure Arc is a tool that can be used to launch and execute machine customization tasks post configuration automatically. When this Extension is added to an Azure Arc machine, it can download Powershell scripts and files from Azure storage and launch a Powershell script on the machine, which in turn can download additional software components. Custom Script Extension for Windows – Azure Arc tasks can also be automated using the Azure Powershell cmdlets.

PowerShell Desired State Configuration – Azure Arc

DSC is a management platform in Windows PowerShell that enables deploying and managing configuration data for software services and managing the environment in which these services run. DSC provides a set of Windows PowerShell language extensions, new Windows PowerShell cmdlets, and resources that you can use to declaratively specify how you want your software environment to be configured. It also provides a means to maintain and manage existing configurations. This extension functions the same as the Azure VM extension but designed to work on Azure Arc machines.

How to add an extension on an Azure Arc enabled server

To add an extension on an Azure Arc enabled server using the Azure Portal, you simply click on your server in the Azure Arc for servers list. Under Settings, you select Extensions, and you will find a list of extensions that are already installed and enabled. To add an extension, click on Add and select the extension you want to add.

Add the Microsoft Monitoring Agent to an Azure Arc enabled server

After you have deployed the Azure Arc agent to your servers, you can easily deploy the Microsoft Monitoring Agent (MMA) using extensions. You only need to add the Log Analytics workspace ID and the key.

Create Microsoft Monitoring Agent - Azure Arc

Create Microsoft Monitoring Agent – Azure Arc

Deploy the Custom Script Extension

While deploying the Custom Script Extension, you can simply add the script file and optional arguments/parameters. For Linux, this is a “.sh” shell script and for Windows a “.ps1” Powershell script.

Create Custom Script Extension for Windows - Azure Arc

Create Custom Script Extension for Windows – Azure Arc

Create PowerShell Desired State Configuration (DSC)

With the PowerShell Desired State Configuration (DSC), you can deploy your configuration package to the Azure Arc enabled server.

Create PowerShell Desired State Configuration - Azure Arc

Create PowerShell Desired State Configuration – Azure Arc

Conclusion

The extensions for Azure Arc enabled servers provide new capabilities and features to extend your hybrid cloud environment with Azure Management and Azure Resource Manager to servers running outside of Microsoft Azure. These extensions are also the foundation of other features like Azure Update Management, Change tracking, or Inventory.

You can learn more about how Azure Arc provides you with cloud-native management technologies for your hybrid cloud environment here, and you can find the documentation for Azure Arc enabled servers on Microsoft Docs.

If you have any questions or comments, feel free to leave a comment below.