How to onboard on-premise Server to Azure Arc
Managing diverse infrastructure across on-premises data centers, edge locations, and multiple cloud providers can be complex.
This is where Azure Arc comes in. Microsoft Azure Arc extends the power of Azure management and security to any infrastructure, whether it’s running on-premises, in AWS, Google Cloud, or at the edge.
With Azure Arc, businesses can centrally manage, secure, and govern servers, Kubernetes clusters, databases, and even AI workloads – bringing a unified cloud experience to any environment.
Azure Arc-enabled Servers is free of charge for connecting and managing Windows and Linux servers through Azure, including basic inventory and resource organization.
Costs arise when enabling additional Azure services, such as Azure Update Manager, Microsoft Defender for Servers, Azure Monitor, or Azure Log Analytics, depending on the service and its licensing model.
In this post I want to show step by step how you can onboard and connect your on-premise Windows Server machines (bare metal or virtual machines) to Azure Arc.
Azure Arc-enabled servers lets you manage Windows and Linux physical servers and virtual machines hosted outside of Azure, on your corporate network, or other cloud provider. For the purposes of Azure Arc, these machines hosted outside of Azure are considered hybrid machines. The management of hybrid machines in Azure Arc is designed to be consistent with how you manage native Azure virtual machines, using standard Azure constructs such as Azure Policy and applying tags.
When a hybrid machine is connected to Azure, it becomes a connected machine and is treated as a resource in Azure. Each connected machine has a Resource ID enabling the machine to be included in a resource group.
To connect hybrid machines to Azure, you install the Azure Connected Machine agent on each machine.
Source: https://learn.microsoft.com/en-us/azure/azure-arc/servers/overview
For environments requiring private connectivity, see my related article below.
We also need to onboard our on-premise machines to Azure Arc in case we want to protect them by using Microsoft Defender for Cloud resp. Microsoft Defender for Servers. More about how to onboard them to Microsoft Defender for Servers you will find in my following article.
- Onboarding Windows on-premise Server to Azure Arc
- Onboarding Linux on-premise Server to Azure Arc
- Onboarding Windows On-Premises Servers to Azure Arc Using a Deployment Script with Interactive Authentication
- Onboarding Windows Server to Azure Arc Using a Service Principal
- Onboarding Linux Servers to Azure Arc Using a Service Principal
- Determine if a Machine is connected to Azure Arc
- Offboarding Windows and Linux Servers from Azure Arc
- Links
Onboarding Windows on-premise Server to Azure Arc
We can onboard Windows Server 2022 and later directly to Azure Arc by using a graphical wizard installed as a feature by default.
The Azure Arc Setup wizard is launched from a system tray icon at the bottom of the Windows Server machine when the Azure Arc Setup feature is enabled. This feature is enabled by default. Alternatively, you can launch the wizard from a pop-up window in the Server Manager or from the Windows Server Start menu.
Source: https://learn.microsoft.com/en-us/azure/azure-arc/servers/onboard-windows-server
For Windows Server 2022, Azure Arc Setup is an optional component that can be removed using the Remove Roles and Features Wizard. For Windows Server 2025 and later, Azure Arc Setup is a Features On Demand. Essentially, this means that the procedures for removal and enablement differ between OS versions.
Source: https://learn.microsoft.com/en-us/azure/azure-arc/servers/onboard-windows-server

Launch the Azure Arc Setup wizard from the system tray icon as show below.

The wizard automatically checks for the prerequisites necessary to install the Azure Connected Machine agent on your Windows Server machine. Once this process completes and the agent is installed, select Configure.


Sign-in to Azure by selecting the applicable Azure cloud, usually you will need to select Azure Global, and then selecting Sign in to Azure. You’ll be asked to provide your sign-in credentials.

Besides the selecting our Azure tenant, subscription, resource group and region for our Azure Arc- enabled server we also need to select how the server will connect to Azure.
In my case where I have so for in my lab environment neither a site-to-site VPN nor a Azure ExressRoute, I can just choose below between a public endpoint or a proxy server which finally both will connect my server through the public internet.

Below for example I wanted to connect an on-premise server which is configured to use a proxy to access the internet. Therefore I need to select the proxy server also on the Azure Arc Setup wizard.
In the following Microsoft article you will find all URLs under Azure Arc-enabled servers that must be available in order to install and use the Connected Machine agent.
Azure Arc network requirements
https://learn.microsoft.com/en-us/azure/azure-arc/network-requirements-consolidated?tabs=azure-cloud#urls

To check if network connectivity for the Azure Connected Machine agent is blocked you can also use the azcmagent CLI tool.
> azcmagent.exe check --location "westeurope"

So when using a HTTP proxy, we first need to allow the required endpoints on the proxy.

Azure Arc-enabled server also supports a site-to-site VPN or Azure ExpressRoute as shown in the figure below.
Use Azure Private Link to securely connect servers to Azure Arc
https://learn.microsoft.com/en-us/azure/azure-arc/servers/private-link-security

Once the configuration completes and your machine is onboarded to Azure Arc, select Finish.


When the on-premise server finally is connected to Azure Arc, the icon in the system tray changes like shown below. Further you will see the status of the server in the Azure Arc Management field of the Server Manager on Windows Server 2022 or later.


Onboarding Linux on-premise Server to Azure Arc
In the Azure portal navigate to Navigate to Machines – Azure Arc.

On the Machines – Azure Arc page, select Add/Create at the upper left, and then select Add a machine from the drop-down menu.

On the Add servers with Azure Arc page, select either the Add a single server or Add multiple servers depending on your deployment scenario, and then select Generate script.
Select Add a single server below. Click on Generate script.
About how to add multiple servers you can read my following post https://blog.matrixpost.net/how-to-onboard-on-premise-server-to-azure-arc-by-using-a-site-to-site-ipsec-vpn-and-azure-arc-private-link-scope/#adding_multiple_servers. Here I will show how to onboard them by using Azure Arc Private Link Scope but the process to add multiple servers are finally the same for using a public endpoint like here instead a private endpoint like shown in this post.

Under Operating System we can choose between Windows and Linux. We want to onboard a Linux machine below.

At the bottom of the Basics tab we can configure the connectivity method for the Azure Connected Machine agent.
We will use here a public endpoint to connect to Azure Arc. In case our client machine is connected to the Internet by using a proxy server, we can choose below Proxy Server.
About connecting through a private endpoint by routing the traffic to Azure Arc through a S2S VPN tunnel or express route, you can read my following post.

Finally we can download the OnboardingScript.sh for Linux.

After downloading the OnboardingScript.sh script from Azure Arc, we need to upload this script to our Linux machine we want to connect to Azure Arc.

We can now either just run bash OnboardingScript.sh or first make the script explicitly executable to use ./OnboardingScript.sh.
More about using different methods to execute a shell script in Linux you will find in my following post https://blog.matrixpost.net/linux-executing-shell-scripts-different-ways/.



Looks good besides I forgot to rename the hostname of this virtual machine and now appears in Azure Arc as localhost.

The Azure Arc-enabled servers deployment script generated in the portal downloads the latest version.
The version of the Azure Connected Machine agent you can determine by running the following command on the affected server.
# azcmagent --version

Finally the following three new folders will be created during the installation, so do not delete them by accident.

To remove the agent we can use on SLES the zypper command.
# zypper remove azcmagent

Onboarding Windows On-Premises Servers to Azure Arc Using a Deployment Script with Interactive Authentication
For Windows Server 2019 and before we can use a deployment script generated directly in the Azure portal as shown below.
The script to automate the download and installation, and to establish the connection with Azure Arc, is available from the Azure portal.
On the Azure Arc – Machines page, select Add/Create at the upper left, and then select Add a machine from the drop-down menu.

On the Add servers with Azure Arc page, under the Add a single server tile, select Generate script.
About how to add multiple servers you can read my following post https://blog.matrixpost.net/how-to-onboard-on-premise-server-to-azure-arc-by-using-a-site-to-site-ipsec-vpn-and-azure-arc-private-link-scope/#adding_multiple_servers. Here I will show how to onboard them by using Azure Arc Private Link Scope but the process to add multiple servers are finally the same for using a public endpoint like here instead a private endpoint like shown in this post.

Select a resource group, region and operating system. Further select the connectivity method for your on-premise server and finally click on Download and run script.

Finally we can download the OnboardingScript.ps1 for Windows.

After downloading the OnboardingScript.ps1 PowerShell script from Azure Arc, we need to upload this script to our Windows machine we want to connect to Azure Arc.

After you install the agent and configure it to connect to Azure Arc-enabled servers, go to the Azure portal to verify that the server has successfully connected.

Onboarding Windows Server to Azure Arc Using a Service Principal
Instead of authenticating interactively with a Microsoft Entra ID account, we can use a dedicated service principal to onboard Windows Server machines to Azure Arc. This enables unattended registration and is particularly useful for automated deployments, PowerShell scripts, and large-scale server onboarding.
For onboarding multiple Windows or Linux servers to Azure Arc, we can automate the process using deployment scripts and a dedicated service principal, avoiding interactive authentication for each machine.
For a more detailed example of onboarding multiple servers, including connectivity through a site-to-site IPsec VPN and Azure Arc Private Link Scope, refer to my previous article: Onboarding Multiple Servers to Azure Arc.
First, we create a dedicated Azure Arc onboarding service principal under Azure Arc → Additional setup → Service principals → Create. The same service principal can be used to onboard both Windows Server and Linux machines, enabling automated registration without interactive authentication.

Azure Arc provides three predefined roles: Azure Connected Machine Onboarding for registering Windows and Linux servers, Kubernetes Cluster, Azure Arc Onboarding for connecting Kubernetes clusters, and Azure Connected Machine Resource Administrator for managing Arc-enabled machine resources.
For our automated server onboarding, we select Azure Connected Machine Onboarding, following the principle of least privilege.

After creating the service principal, Azure Arc automatically generates a client ID and client secret for authenticating Windows and Linux servers during onboarding.
Download and securely store these credentials before closing the dialog, as the client secret cannot be retrieved again afterward.

Azure Arc provides the newly generated credentials in a downloadable servicePrincipal.txt file, containing the PowerShell variables $servicePrincipalId and $servicePrincipalClientSecret.
We can use these credentials for unattended Windows Server onboarding and the corresponding values for Linux onboarding.

After creation, the dedicated service principal appears in the Azure Arc portal, displaying its client ID, assigned resource group scope, Azure RBAC role, and client secret status.
We can now use these credentials to automate onboarding for both Windows Server and Linux machines without interactive Microsoft Entra ID authentication.

Behind the scenes, Azure Arc creates a regular Microsoft Entra ID application registration and its corresponding service principal. The Azure Arc portal simply provides a simplified creation process with the appropriate Azure RBAC role assignment. The application can also be found under Microsoft Entra ID → App registrations.
For more details about the differences, see my article Azure AD App Registrations vs. Enterprise Applications.

The corresponding service principal is also listed under Microsoft Entra ID → Enterprise applications, where it represents the application’s identity within our tenant.
This confirms that Azure Arc uses the standard Microsoft Entra ID application and service principal model, with a simplified creation and permission assignment process.

To onboard our first server using the newly created service principal, navigate to Azure Arc → Infrastructure → Machines → Onboard/Create → Onboard existing machines.
This opens the onboarding wizard, where we can generate the deployment script for Windows Server or Linux using service principal authentication.

The onboarding configuration remains the same as previously shown for interactive authentication using Authenticate machines manually.
This time, however, we select Authenticate machines automatically and choose our newly created service principal,
sp-azure-arc-onboarding, to enable unattended onboarding without requiring an interactive Microsoft Entra ID login.

After selecting Authenticate machines automatically and our service principal sp-azure-arc-onboarding, click Download and run script to generate the onboarding script.
Unlike interactive authentication, this approach uses the service principal credentials to register machines with Azure Arc without requiring a user login.

On the Download and run script page, we select Basic script as our deployment method. Azure Arc generates a PowerShell onboarding script with the selected service principal’s client ID already populated, but we must manually insert the client secret into $servicePrincipalClientSecret before execution.
The script also includes the subscription ID, resource group, tenant ID, Azure region, and
AUTH_TYPEset toprincipal, enabling unattended authentication.Azure Arc supports several deployment methods, including Basic script, Configuration Manager, Group Policy, and Ansible. For my lab, I will select Basic script to onboard the server directly using PowerShell and our dedicated service principal.

After executing the generated PowerShell script with administrative privileges, the Azure Connected Machine Agent is installed and the server is successfully registered with Azure Arc using our service principal, without requiring an interactive Azure login.
The server Matrix-VM01 is now connected to Azure and can be managed through the Azure Portal.

Similarly, on Windows Server, we can verify the Azure Arc connection using azcmagent.exe show | Select-String "Agent Status" in PowerShell.
The reported status Connected confirms that the Windows server is successfully connected to Azure Arc.
azcmagent.exe show | Select-String "Agent Status"

Back in the Azure Portal → Azure Arc → Machines, we can verify that Matrix-VM01 has been successfully onboarded and its Azure Connected Machine Agent reports the status Connected.
The server is running Windows Server 2022 Standard with Azure Connected Machine Agent version 1.70.03595.3521, registered in the AzureArc resource group under our MCPP Subscription.

Onboarding Linux Servers to Azure Arc Using a Service Principal
The same approach can be used to onboard Linux servers to Azure Arc without requiring an interactive Azure login. By using a dedicated service principal with the appropriate permissions, we can automate registration through shell scripts and integrate Azure Arc onboarding into existing Linux provisioning workflows.
Next, we onboard a Linux server using the same service principal. Navigate to Azure Arc → Machines → Onboard/Create → Onboard existing machines, select Linux as the operating system, and keep the same subscription, resource group, and Azure region used for our Windows Server onboarding.

As with our Windows Server onboarding, we select Authenticate machines automatically and choose the existing service principal sp-azure-arc-onboarding.
The same service principal can be used to onboard both Windows and Linux machines without requiring an interactive Azure login.

For Linux onboarding, we again select Basic script, which generates a Bash script to install the Azure Connected Machine Agent and register the server with Azure Arc.
The script already contains our service principal’s client ID and Azure configuration, but we must manually insert the client secret before executing it with root privileges.

After transferring the generated Bash script to my SUSE Linux Enterprise Server 15 SP7 using SFTP, we execute it with root privileges.
The script downloads the Azure Connected Machine Agent installer, configures the required Microsoft package repository, and begins installing the agent before registering the server with Azure Arc.
bash OnboardingScript.sh

The onboarding script successfully installs the Azure Connected Machine Agent, configures the required systemd services, and registers our SUSE Linux Enterprise Server 15 SP7 with Azure Arc.
The message Connected machine to Azure confirms that the Linux server was successfully onboarded using service principal authentication, without requiring an interactive Azure login.

We can also verify the Azure Arc connection directly on the Linux server using azcmagent show.
The Agent Status: Connected confirms that the Azure Connected Machine Agent is running and the server is successfully connected to Azure Arc.
azcmagent show | grep 'Agent Status'

Back in the Azure Portal → Azure Arc → Machines, we can now see both our Windows Server 2022 (Matrix-VM01) and SUSE Linux Enterprise Server 15 SP7 (SLES15-SP7-VM01) successfully registered with Azure Arc.
Both machines report the agent status Connected, confirming that onboarding using our dedicated service principal was successful for both operating systems.

Determine if a Machine is connected to Azure Arc
After onboarding a Windows or Linux server, we can verify its connection to Azure Arc directly from the operating system using the Azure Connected Machine Agent (azcmagent).
The following commands display the current agent status and confirm whether the machine is connected to Azure.
On Windows
Run the following command in the PowerShell console.
When the output is Connected the machine is connected to Azure Arc.
PS> azcmagent.exe show | Select-String "Agent Status" or just the following command to show all details PS> azcmagent.exe show The binary is located under 'C:\Program Files\AzureConnectedMachineAgent\azcmagent.exe'

On Linux
Enter the following command in the shell.
When the output is Connected the machine is connected to Azure Arc.
# azcmagent show | grep 'Agent Status'


On a connected machine.

Offboarding Windows and Linux Servers from Azure Arc
When a server is no longer managed through Azure Arc, it should be properly disconnected rather than simply deleting its resource in the Azure Portal.
The recommended approach is to disconnect the Azure Connected Machine Agent first, which also removes the corresponding Azure Arc resource from Azure.
Disconnect the Azure Connected Machine Agent
Windows Server (PowerShell as Administrator)
When executing azcmagent.exe disconnect, an interactive sign-in is required to authenticate against Azure using the web browser.
After successful authentication, the agent deletes the corresponding Azure Arc machine resource and disconnects the server, confirmed by the messages Successfully deleted resource in Azure and Disconnected machine from Azure.
azcmagent.exe disconnect

Linux
On Linux, we can also disconnect the Azure Connected Machine Agent using sudo azcmagent disconnect --force-local-only. This removes the local Azure Arc registration without requiring interactive authentication.
Important: The
--force-local-onlyoption leaves the corresponding Azure Arc resource in Azure. We must manually delete this orphaned resource from Azure Arc → Machines to complete the offboarding process.
sudo azcmagent disconnect --force-local-only

Since we disconnected our Linux server using azcmagent disconnect --force-local-only, the corresponding Azure Arc resource remains in Azure and must be deleted manually.
Navigate to Azure Arc → Machines, select SLES15-SP7-VM01, and click Delete. Confirm the deletion to remove the orphaned resource from Azure.
Note that deleting the Azure resource does not uninstall the agent or any extensions from the Linux server.

Links
What is Azure Arc-enabled servers?
https://learn.microsoft.com/en-us/azure/azure-arc/servers/overviewConnect hybrid machines to Azure using a deployment script
https://learn.microsoft.com/en-us/azure/azure-arc/servers/onboard-portal#generate-the-installation-script-from-the-azure-portalOverview of Azure Connected Machine agent
https://learn.microsoft.com/en-us/azure/azure-arc/servers/agent-overview
Tags In
Related Posts
Latest posts
Understanding Modern AI – Part 2: Inside the Infrastructure of OpenAI, Anthropic, Google Gemini, and Other Major LLM Providers
Follow me on LinkedIn
