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.
How to install AzureArcConnectedAgentManagement Module
- Open PowerShell as an administrator and run the following command:
a. Install-Module -Name AzureArcConnectedAgentManagement - 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 |
Format-Table -AutoSize -Property ExtensionName, ExtensionState, ExtensionVersion
Get-AzureArcNodeAgentLocalConfigurationFileContent
Get-AzureArcNodeConfiguration -ConfigurationName extensions.allowlist -OutPutType JSON
Get-AzureArcNodeConfiguration -ConfigurationName extensions.allowlist -OutPutType RAW
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-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.