Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

azcmagent connect fails with an AZCM error code: what AZCM0026, AZCM0041, AZCM0042, AZCM0044 and AZCM0067 mean

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When azcmagent connect fails, the console or script output shows an error code of the form AZCM0000, where, in Microsoft's words, "0000" can be any four-digit number. The code tells you which stage failed: the machine's own network, the sign-in, the creation of the Azure resource, or the local agent. Read the code, run azcmagent check, and fix that one cause before you try again.

What the error means

The Microsoft Learn troubleshooting page says "The console or script output displays the AZCM0000 error code, where "0000" can be any four-digit number." It lists a probable cause and a suggested remediation for each code. The codes that matter most when connecting a hosted server are these.

  • AZCM0026: "There's an error in network configuration or some critical services are temporarily unavailable". The remediation is to check "if the required endpoints are reachable (for example, hostnames are resolvable, endpoints aren't blocked)", and, for a Private Link Scope, to provide the resource ID with --private-link-scope.
  • AZCM0041: "The credentials supplied are invalid".
  • AZCM0042: "Creation of the Azure Arc-enabled server resource failed". The page says to read the error message and see "Required permissions".
  • AZCM0044: "A resource with the same name already exists".
  • AZCM0067: "The machine is already connected to Azure".
  • AZCM0018: "The command was executed without administrative privileges".
  • AZCM0061: "The agent service isn't responding or unavailable"; the page says to run elevated and make sure the HIMDS service is running.
  • AZCM0062: "An error occurred while connecting the server". If it happened after the Azure resource was created, the page says to "delete this resource before retrying".
  • AZCM0102: "An error occurred while retrieving the computer hostname"; the fix is to pass a resource name.

The same page also lists errors printed as text, with causes. A message that the subscription "isn't registered to use namespace 'Microsoft.HybridCompute'" means the Azure resource providers are not registered. An error that the client "does not have authorization to perform action 'Microsoft.HybridCompute/machines/read'" means wrong credentials or permissions. A Forbidden from login.windows.net or management.azure.com means a proxy or firewall blocks that endpoint, and the page says to run azcmagent check.

Likely causes

Cause What you see How to confirm
Outbound access to Azure endpoints is blocked AZCM0026, or Forbidden or network is unreachable toward login.windows.net or management.azure.com azcmagent check shows a failed endpoint
Wrong sign-in, or the account lacks rights AZCM0041, AZCM0042, or the 403 text The account is not in the Azure Connected Machine Onboarding role for the resource group
Resource providers not registered The "isn't registered to use namespace" message The providers are not Registered in the subscription
A resource with this name already exists AZCM0044 The resource group already holds a server resource with the hostname
The machine is already connected AZCM0067 azcmagent show reports a connected agent
Not run elevated, or the agent service is down AZCM0018, AZCM0061 The shell is not administrator or root; HIMDS is not running
A private endpoint is in use without the scope AZCM0026 on a network with Private Link No --private-link-scope was given

Prove the cause before changing anything

All of these only read. Run the agent commands elevated, except azcmagent show, which the Microsoft page says needs no administrator privileges.

1. See the agent's state.

azcmagent show

The show page describes its output as "the current state of the Azure Connected Machine agent, including whether or not it's connected to Azure, the Azure resource information, and the status of dependent services". A machine that already shows as connected explains AZCM0067.

2. Check the network path. The check page says azcmagent check runs "a series of network connectivity checks" and outputs a table of results for each required endpoint, including whether a private endpoint, proxy or Arc gateway was used.

azcmagent check --location "australiaeast"

A good result reports every required endpoint reachable. A bad result names the endpoint that failed. The network requirements page says the agent "communicates outbound to Azure Arc over TCP port 443" and lists the service tags and URLs to allow. For Private Link, the check page's --enable-pls-check option tests whether endpoints resolve to private addresses.

3. Read the verbose log of a failed attempt. The troubleshooting page says to add --verbose and gives the log paths: %ProgramData%\AzureConnectedMachineAgent\Log\azcmagent.log on Windows and /var/opt/azcmagent/log/azcmagent.log on Linux.

4. List the agent's current settings. The config page says azcmagent config list lists "all configuration properties and their current values", which shows whether a proxy URL is set.

azcmagent config list

5. Check resource provider registration. The Azure page gives a read-only listing command:

az provider list --query "[].{Provider:namespace, Status:registrationState}" --out table

The prerequisites page requires Microsoft.HybridCompute, Microsoft.GuestConfiguration and Microsoft.HybridConnectivity. Each should show Registered.

6. Check the permissions. The prerequisites page says that to onboard machines "you must have the Azure Connected Machine Onboarding or Contributor role for the resource group". Check the role assignment of the account or service principal used.

Fix

Network: allow the endpoints, or set a proxy

Microsoft's network requirements page lists the endpoints and service tags that must be reachable over outbound TCP 443. Opening them is a change in your own firewall, made under that firewall's own change process. Where the server must go through a proxy, the proxy is set on the agent. The config page shows azcmagent config set proxy.url "http://proxy.contoso.corp:8080".

The save commands below are written for Linux. On Windows, write the output to a file such as C:\Temp\azcmagent-config-before.2026-12-01.txt with azcmagent config list > C:\Temp\azcmagent-config-before.2026-12-01.txt and read it back with Get-Content.

First save the current settings:

azcmagent config list > /root/azcmagent-config-before.2026-12-01.txt

Risk: the next command changes where the agent sends all its traffic. A wrong proxy address stops the agent from reaching Azure, and a machine that is already connected could lose its connection until the proxy is corrected or cleared.

Set the proxy for your site (the host name here is an example):

azcmagent config set proxy.url "http://proxy01.example.com:8080"

Then repeat azcmagent check.

To undo it: first print the saved settings and look for proxy.url:

cat /root/azcmagent-config-before.2026-12-01.txt

If the saved file shows no proxy URL, clear the property. The config page documents azcmagent config clear proxy.url:

azcmagent config clear proxy.url

If the saved file shows a previous proxy URL, set it again with azcmagent config set proxy.url and that saved value instead, then run azcmagent check.

Credentials, permissions and providers

Use an account or service principal with the Azure Connected Machine Onboarding role, as the connect page says, and with the correct tenant. If the resource providers are missing, the prerequisites page gives the Register-AzResourceProvider and az provider register commands for the three required namespaces. Registering is a subscription-level decision for the subscription owner: register the providers only when the owner has agreed. The Azure page says to register a provider "only when you're ready to use it" and says you can't unregister one "when you still have resource types from that resource provider in your subscription", and it gives no unregister command.

A resource with the same name exists, or the machine is already connected

For AZCM0044, the page says to specify a different name for the --resource-name parameter or delete the existing server resource. For AZCM0067, it says to run azcmagent disconnect and try again. Do not follow either to the letter before looking: the disconnect page says: "Deletes the Azure Arc-enabled server resource in the cloud and resets the configuration of the local agent." A machine that azcmagent show already reports as connected to the right resource needs no fix. Pick a new name instead of deleting a resource you did not create.

First save the agent's current state:

azcmagent show > /root/azcmagent-show-before.2026-12-01.txt

Risk: the next command creates a new server resource in the subscription and resource group you name, and attaches this machine's agent to it. It is not a test run.

Connect with an explicit resource name. The connect page documents --resource-name, and shows a sign-in with --use-device-code:

azcmagent connect --subscription-id "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" --resource-group "HybridServers" --location "australiaeast" --use-device-code --resource-name "web01-hosted"

The example uses a subscription ID, because the troubleshooting page says that a failed lookup of a subscription name (AZCM0068) is retried with the GUID.

To undo it: first run azcmagent show and compare it with the saved file:

azcmagent show

Disruptive step: the next command deletes the Azure resource and resets the local agent, and the deletion cannot be undone. Run it only if the saved file showed the machine as not connected and the output above names the resource you just created.

The disconnect page says to sign in with an account that has the Azure Connected Machine Resource Administrator role on the resource, or equivalent permission to delete it. Disconnect:

azcmagent disconnect

Example (illustrative): on web01, a hosted Linux server behind fw01, azcmagent connect stops with AZCM0026. azcmagent show reports an agent that is not connected, and azcmagent check --location "australiaeast" reports a failed endpoint. The site requires a proxy, proxy01.example.com, and none is set in azcmagent config list. The engineer saves the settings, sets proxy.url to http://proxy01.example.com:8080, and repeats azcmagent check. All endpoints pass. The connect command then succeeds, and azcmagent show reports the machine as connected.

Confirm the fix

  1. azcmagent check reports every required endpoint reachable.
  2. azcmagent show reports the machine as connected, with the resource name and group you intended.
  3. The server resource appears in the chosen resource group in the Azure portal.

What to watch afterwards

  • Run azcmagent show after proxy, firewall or DNS changes on the server.
  • Keep a record of which account and role were used to onboard each machine.
  • For Private Link, check name resolution: see "Azure Private Endpoint: name resolution failures from on-premises and across VNets".

Risks and limits

  • These commands have not been run or lab-tested.
  • Microsoft lists many more codes than are discussed here; the troubleshooting page also gives matching process exit codes.
  • Commands that delete a cloud resource, such as azcmagent disconnect, cannot be undone. A new connect creates a new resource, not the old one.
  • The --use-device-code form is one of several sign-in methods on the connect page; service principals and Azure CLI credentials are others.
  • Microsoft names agent versions only where a flag needs one, for example version 1.41 or later for --extensions on azcmagent check.

Sources