To upgrade the Azure Connected Machine agent across a large number of servers, such as your 1000+ servers with an outdated version, consider the following automated approaches:
- Azure Update Manager: This tool can orchestrate updates for your Azure Arc-enabled servers. You can schedule updates or deploy them on-demand, ensuring that the latest agent version is applied without manual intervention.
- PowerShell Automation: You can create a PowerShell script that utilizes the
Update-AzConnectedMachineExtensioncommand to automate the upgrade process. This script can iterate through a list of your servers and apply the update to each one.- For Windows servers, you can use:
Update-AzConnectedMachineExtension -ResourceGroup <resource-group-name> -MachineName <arc-server-name> -Name AzureMonitorWindowsAgent -EnableAutomaticUpgrade - For Linux servers, the command would be:
Update-AzConnectedMachineExtension -ResourceGroup <resource-group-name> -MachineName <arc-server-name> -Name AzureMonitorLinuxAgent -EnableAutomaticUpgrade
- For Windows servers, you can use:
- Azure CLI: You can also use Azure CLI to automate the upgrade process. Create a script that runs the following commands for each server:
- For Windows:
az vm extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor --vm-name <virtual-machine-name> --resource-group <resource-group-name> --enable-auto-upgrade true - For Linux:
az vm extension set --name AzureMonitorLinuxAgent --publisher Microsoft.Azure.Monitor --vm-name <virtual-machine-name> --resource-group <resource-group-name> --enable-auto-upgrade true
- For Windows:
- Automation Accounts: Set up an Azure Automation account with runbooks to automate the upgrade process. You can schedule these runbooks to run at specific intervals, ensuring that all servers are kept up to date with the latest agent version.
By leveraging these automation tools and scripts, you can efficiently manage the upgrade of the Azure Connected Machine agent across your extensive server fleet without the need for manual updates.