Kaido Jarvemets - Logo

Getting started with AzureArcConnectedAgentManagement PowerShell Module

Introduction

Last week I posted a blog about how to manage Azure Arc Connected Agent through the Azcmagent.exe utility. Azcmagent.exe allows you to manage the agent settings, view agent connection status, and troubleshoot if something is not working as excepted.

To simplify our day-to-day administration around Azure Arc, I wrote a PowerShell module for the Azcmagent.exe utility. These commands give us a much better user experience.

AzureArcConnectedAgentManagement PowerShell Module is published on the PowerShell Gallery and has 15 commands.

• Clear-AzureArcNodeConfiguration
• Connect-AzureArcNode
• Disconnect-AzureArcNode
• Get-AzureArcNodeAgentConfigurationFileContent
• Get-AzureArcNodeAgentInformation
• Get-AzureArcNodeAgentInstalledExtensions
• Get-AzureArcNodeAgentLocalConfigurationFileContent
• Get-AzureArcNodeConfiguration
• Get-AzureArcNodeServiceStatus
• Install-AzureArcAgent
• Restart-AzureArcNodeService
• Save-AzureArcNodeLogs
• Set-AzureArcNodeConfiguration
• Test-AzureArcNodeConnection
• Test-AzureArcNodeNetworkConnectivity

Just a reminder! It is my first release, so there may be bugs.

Microsoft has its own PowerShell module as well, but mostly for onboarding activities rather than managing the local agent settings etc

How to install AzureArcConnectedAgentManagement Module

  1. Open PowerShell as an administrator and run the following command:
    a. Install-Module -Name AzureArcConnectedAgentManagement
  2. After the installation, print out all the commands using the following command
    a. Get-Command -Module AzureArcConnectedAgentManagement

AzureArcConnectedAgentManagement Module commands

Clear-AzureArcNodeConfiguration

Allows clearing Azure Arc agent configuration by setting name.

Example

				
					Clear-AzureArcNodeConfiguration -ConfigurationName proxy.bypass -OutPutType JSON 

				
			

Connect-AzureArcNode

Connect the local machine to Azure Arc service. You can choose in three different ways:

  • Access Token
  • Service Principal
  • Device Login

Disconnect-AzureArcNode

Allows you to disconnect connected nodes from Azure Arc service.

Get-AzureArcNodeAgentConfigurationFileContent

Reads the Azure Arc Connected Agent configuration file from C:\ProgramData\AzureConnectedMachineAgent\Config\agentconfig.json file

Get-AzureArcNodeAgentInformation

Provides information about Azure Arc Connected Agents. You can specify the output as JSON or RAW.

Example

				
					Get-AzureArcNodeAgentInformation -OutPutType JSON
Get-AzureArcNodeAgentInformation -OutPutType RAW
				
			

Get-AzureArcNodeAgentInstalledExtensions

Reads installed extension from the C:\ProgramData\GuestConfig\extension_logs folder.

Example

				
					Get-AzureArcNodeAgentInstalledExtensions |
    Format-Table -AutoSize -Property ExtensionName, ExtensionState, ExtensionVersion 
				
			

Get-AzureArcNodeAgentLocalConfigurationFileContent

The command reads the C:\ProgramData\AzureConnectedMachineAgent\Config\localconfig.json file.

Example

				
					Get-AzureArcNodeAgentLocalConfigurationFileContent

				
			

Get-AzureArcNodeConfiguration

Allows you to read Azure Arc Connected Agent configured settings.

Example

				
					Get-AzureArcNodeConfiguration -ConfigurationName extensions.allowlist -OutPutType JSON
Get-AzureArcNodeConfiguration -ConfigurationName extensions.allowlist -OutPutType RAW
				
			

Get-AzureArcNodeServiceStatus

Prints out the Azure Hybrid Instance Metadata Service status.

Example

				
					Get-AzureArcNodeServiceStatus

				
			

Install-AzureArcAgent

Downloads and installs Azure Arc Connected Agent.

Restart-AzureArcNodeService

Restarts the Azure Hybrid Instance Metadata Service

Save-AzureArcNodeLogs

Allows you to save Azure Arc Agent logs to your desktop for troubleshooting.

Set-AzureArcNodeConfiguration

Allows configuring different Azure Arc Agent settings, such as proxy etc.

Example

				
					Set-AzureArcNodeConfiguration -ConfigurationName proxy.url -ConfigurationValue "http://myproxy:443" -OutPutType JSON

				
			

Test-AzureArcNodeConnection

Prints out current agent status, if the agent is OK or not.

Test-AzureArcNodeNetworkConnectivity

Allows you to verify if the connection from the local machine is OK and meets all the requirements.

Example

				
					Test-AzureArcNodeNetworkConnectivity -OutPutType JSON -Location "West Europe"

				
			

Summary

As you now see, it will be much easier to manage the local Azure Arc agent using these PowerShell commands. If you have any feedback, please add a comment to this post, email me, or on GitHub.

Leave a Reply

Contact me

If you’re interested in learning about Getting started with AzureArcConnectedAgentManagement PowerShell Module. I can help you understand how this solution can benefit your organization and provide a customized solution tailored to your specific needs.

Table of Contents