From 664f819773d4432b6be9083db47b1923e8c68542 Mon Sep 17 00:00:00 2001 From: John Marcovecchio <39525506+johnmarco@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:23:36 -0500 Subject: [PATCH 1/2] Refreshed with edits --- .../servers/manage-vm-extensions-cli.md | 32 ++++--------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/articles/azure-arc/servers/manage-vm-extensions-cli.md b/articles/azure-arc/servers/manage-vm-extensions-cli.md index 57a37b34f..26dd82a56 100644 --- a/articles/azure-arc/servers/manage-vm-extensions-cli.md +++ b/articles/azure-arc/servers/manage-vm-extensions-cli.md @@ -1,25 +1,25 @@ --- title: Enable VM extension using Azure CLI description: This article describes how to deploy virtual machine extensions to Azure Arc-enabled servers running in hybrid cloud environments using the Azure CLI. -ms.date: 03/30/2022 +ms.date: 12/06/2024 ms.topic: how-to ms.custom: devx-track-azurecli --- # Enable Azure VM extensions using the Azure CLI -This article shows you how to deploy, upgrade, update, and uninstall VM extensions, supported by Azure Arc-enabled servers, to a Linux or Windows hybrid machine using the Azure CLI. +This article explains how to deploy, upgrade, update, and uninstall VM extensions supported by Azure Arc-enabled servers to a Linux or Windows hybrid machine using the Azure CLI. > [!NOTE] -> Azure Arc-enabled servers does not support deploying and managing VM extensions to Azure virtual machines. For Azure VMs, see the following [VM extension overview](/azure/virtual-machines/extensions/overview) article. +> Azure Arc-enabled servers doesn't support deploying and managing VM extensions to Azure virtual machines. For Azure VMs, see the following [VM extension overview](/azure/virtual-machines/extensions/overview) article. [!INCLUDE [Azure CLI Prepare your environment](~/reusable-content/azure-cli/azure-cli-prepare-your-environment.md)] ## Install the Azure CLI extension -The ConnectedMachine commands aren't shipped as part of the Azure CLI. Before using the Azure CLI to connect to Azure and manage VM extensions on your hybrid server managed by Azure Arc-enabled servers, you need to load the ConnectedMachine extension. These management operations can be performed from your workstation, you don't need to run them on the Azure Arc-enabled server. +The ConnectedMachine commands aren't shipped as part of the Azure CLI. Before using the Azure CLI to connect to Azure and manage VM extensions on your hybrid server managed by Azure Arc-enabled servers, you need to load the ConnectedMachine extension. These management operations can be performed from your workstation; you don't need to run them on the Azure Arc-enabled server. -Run the following command to get it: +Run the following command to install the Azure CLI ConnectedMachine extension: ```azurecli az extension add --name connectedmachine @@ -29,12 +29,6 @@ az extension add --name connectedmachine To enable a VM extension on your Azure Arc-enabled server, use [az connectedmachine extension create](/cli/azure/connectedmachine/extension#az-connectedmachine-extension-create) with the `--machine-name`, `--extension-name`, `--location`, `--type`, `settings`, and `--publisher` parameters. -The following example enables the Log Analytics VM extension on an Azure Arc-enabled server: - -```azurecli -az connectedmachine extension create --machine-name "myMachineName" --name "OmsAgentForLinux or MicrosoftMonitoringAgent" --location "regionName" --settings '{\"workspaceId\":\"myWorkspaceId\"}' --protected-settings '{\"workspaceKey\":\"myWorkspaceKey\"}' --resource-group "myResourceGroup" --type-handler-version "1.13" --type "OmsAgentForLinux or MicrosoftMonitoringAgent" --publisher "Microsoft.EnterpriseCloud.Monitoring" -``` - The following example enables the Custom Script Extension on an Azure Arc-enabled server: ```azurecli @@ -61,7 +55,7 @@ az connectedmachine extension create --resource-group "resourceGroupName" --mach ## List extensions installed -To get a list of the VM extensions on your Azure Arc-enabled server, use [az connectedmachine extension list](/cli/azure/connectedmachine/extension#az-connectedmachine-extension-list) with the `--machine-name` and `--resource-group` parameters. +To get a list of VM extensions on your Azure Arc-enabled server, use [az connectedmachine extension list](/cli/azure/connectedmachine/extension#az-connectedmachine-extension-list) with the `--machine-name` and `--resource-group` parameters. Example: @@ -86,7 +80,7 @@ The following example shows the partial JSON output from the `az connectedmachin ## Update extension configuration -Some VM extensions require configuration settings in order to install them on the Arc-enabled server, like the Custom Script Extension and the Log Analytics agent VM extension. To upgrade the configuration of an extension, use [az connectedmachine extension update](/cli/azure/connectedmachine/extension#az-connectedmachine-extension-update). +Some VM extensions require configuration settings in order to install them on an Arc-enabled server (like the Custom Script Extension). To upgrade the configuration of an extension, use [az connectedmachine extension update](/cli/azure/connectedmachine/extension#az-connectedmachine-extension-update). The following example shows how to configure the Custom Script Extension: @@ -100,24 +94,12 @@ When a new version of a supported VM extension is released, you can upgrade it t For the `--extension-targets` parameter, you need to specify the extension and the latest version available. To determine the latest version available for an extension, visit the **Extensions** page for the selected Arc-enabled server in the Azure portal or run [az vm extension image list](/cli/azure/vm/extension/image#az-vm-extension-image-list). You may specify multiple extensions in a single upgrade request by providing a comma-separated list of extensions, defined by their publisher and type (separated by a period) and the target version for each extension. -To upgrade the Log Analytics agent extension for Windows that has a newer version available, run the following command: - -```azurecli -az connectedmachine upgrade-extension --machine-name "myMachineName" --resource-group "myResourceGroup" --extension-targets '{"Microsoft.EnterpriseCloud.Monitoring.MicrosoftMonitoringAgent":{"targetVersion":"1.0.18053.0"}}' -``` - You can review the version of installed VM extensions at any time by running the command [az connectedmachine extension list](/cli/azure/connectedmachine/extension#az-connectedmachine-extension-list). The `typeHandlerVersion` property value represents the version of the extension. ## Remove extensions To remove an installed VM extension on your Azure Arc-enabled server, use [az connectedmachine extension delete](/cli/azure/connectedmachine/extension#az-connectedmachine-extension-delete) with the `--extension-name`, `--machine-name`, and `--resource-group` parameters. -For example, to remove the Log Analytics VM extension for Linux, run the following command: - -```azurecli -az connectedmachine extension delete --machine-name "myMachineName" --name "OmsAgentForLinux" --resource-group "myResourceGroup" -``` - ## Next steps - You can deploy, manage, and remove VM extensions using the [Azure PowerShell](manage-vm-extensions-powershell.md), from the [Azure portal](manage-vm-extensions-portal.md), or [Azure Resource Manager templates](manage-vm-extensions-template.md). From 2f4682a4a946b3e42ccede50ececd50213f65e9f Mon Sep 17 00:00:00 2001 From: John Marcovecchio <39525506+johnmarco@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:33:53 -0500 Subject: [PATCH 2/2] Refresh edits --- .../manage-vm-extensions-powershell.md | 28 ++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/articles/azure-arc/servers/manage-vm-extensions-powershell.md b/articles/azure-arc/servers/manage-vm-extensions-powershell.md index 123f9af9c..f48d978e1 100644 --- a/articles/azure-arc/servers/manage-vm-extensions-powershell.md +++ b/articles/azure-arc/servers/manage-vm-extensions-powershell.md @@ -1,14 +1,14 @@ --- title: Enable VM extension using Azure PowerShell description: This article describes how to deploy virtual machine extensions to Azure Arc-enabled servers running in hybrid cloud environments using Azure PowerShell. -ms.date: 03/30/2022 +ms.date: 12/06/2024 ms.topic: how-to ms.custom: devx-track-azurepowershell --- # Enable Azure VM extensions using Azure PowerShell -This article shows you how to deploy, update, and uninstall Azure VM extensions, supported by Azure Arc-enabled servers, to a Linux or Windows hybrid machine using Azure PowerShell. +This article explains how to deploy, update, and uninstall Azure VM extensions, supported by Azure Arc-enabled servers, to a Linux or Windows hybrid machine using Azure PowerShell. > [!NOTE] > Azure Arc-enabled servers does not support deploying and managing VM extensions to Azure virtual machines. For Azure VMs, see the following [VM extension overview](/azure/virtual-machines/extensions/overview) article. @@ -17,7 +17,7 @@ This article shows you how to deploy, update, and uninstall Azure VM extensions, - A computer with Azure PowerShell. For instructions, see [Install and configure Azure PowerShell](/powershell/azure/). -Before using Azure PowerShell to manage VM extensions on your hybrid server managed by Azure Arc-enabled servers, you need to install the `Az.ConnectedMachine` module. These management operations can be performed from your workstation, you don't need to run them on the Azure Arc-enabled server. +Before using Azure PowerShell to manage VM extensions on your hybrid server managed by Azure Arc-enabled servers, you need to install the `Az.ConnectedMachine` module. These management operations can be performed from your workstation; you don't need to run them on the Azure Arc-enabled server. Run the following command on your Azure Arc-enabled server: @@ -31,16 +31,6 @@ When the installation completes, the following message is returned: To enable a VM extension on your Azure Arc-enabled server, use [New-AzConnectedMachineExtension](/powershell/module/az.connectedmachine/new-azconnectedmachineextension) with the `-Name`, `-ResourceGroupName`, `-MachineName`, `-Location`, `-Publisher`, -`ExtensionType`, and `-Settings` parameters. -The following example enables the Log Analytics VM extension on a Azure Arc-enabled Linux server: - -```powershell -$Setting = @{ "workspaceId" = "workspaceId" } -$protectedSetting = @{ "workspaceKey" = "workspaceKey" } -New-AzConnectedMachineExtension -Name OMSLinuxAgent -ResourceGroupName "myResourceGroup" -MachineName "myMachineName" -Location "regionName" -Publisher "Microsoft.EnterpriseCloud.Monitoring" -Settings $Setting -ProtectedSetting $protectedSetting -ExtensionType "OmsAgentForLinux" -``` - -To enable the Log Analytics VM extension on an Azure Arc-enabled Windows server, change the value for the `-ExtensionType` parameter to `"MicrosoftMonitoringAgent"` in the previous example. - The following example enables the Custom Script Extension on an Azure Arc-enabled server: ```powershell @@ -135,24 +125,12 @@ When a new version of a supported VM extension is released, you can upgrade it t For the `-ExtensionTarget` parameter, you need to specify the extension and the latest version available. To determine the latest version available for an extension, visit the **Extensions** page for the selected Arc-enabled server in the Azure portal or run [Get-AzVMExtensionImage](/powershell/module/az.compute/get-azvmextensionimage). You may specify multiple extensions in a single upgrade request by providing a comma-separated list of extensions, defined by their publisher and type (separated by a period) and the target version for each extension. -To upgrade the Log Analytics agent extension for Windows that has a newer version available, run the following command: - -```powershell -Update-AzConnectedExtension -MachineName "myMachineName" -ResourceGroupName "myResourceGroup" -ExtensionTarget '{\"Microsoft.EnterpriseCloud.Monitoring.MicrosoftMonitoringAgent\":{\"targetVersion\":\"1.0.18053.0\"}}' -``` - You can review the version of installed VM extensions at any time by running the command [Get-AzConnectedMachineExtension](/powershell/module/az.connectedmachine/get-azconnectedmachineextension). The `TypeHandlerVersion` property value represents the version of the extension. ## Remove extensions To remove an installed VM extension on your Azure Arc-enabled server, use [Remove-AzConnectedMachineExtension](/powershell/module/az.connectedmachine/remove-azconnectedmachineextension) with the `-Name`, `-MachineName` and `-ResourceGroupName` parameters. -For example, to remove the Log Analytics VM extension for Linux, run the following command: - -```powershell -Remove-AzConnectedMachineExtension -MachineName myMachineName -ResourceGroupName myResourceGroup -Name OmsAgentforLinux -``` - ## Next steps - You can deploy, manage, and remove VM extensions using the [Azure CLI](manage-vm-extensions-cli.md), from the [Azure portal](manage-vm-extensions-portal.md), or [Azure Resource Manager templates](manage-vm-extensions-template.md).