Quickstart: Connect machines to Azure using Azure Arc for servers - Portal

If you don't have an Azure subscription, create a free account before you begin.


Review the supported clients and required network configuration in the Azure Arc for servers Overview.

Generate the agent install script using the Azure portal

  1. Launch https://aka.ms/hybridmachineportal
  2. Click on +Add
  3. Follow the wizard to completion
  4. The last page has a script generated which you can copy (or download).

The script must be run on the target machine you want to connect. It downloads the agent, installs it, and connects the machine as a single operation.

On the Non-Azure servers you want to manage:

  1. Logon to the server (using SSH, RDP or PowerShell Remoting)
  2. Start a shell: bash on Linux, PowerShell as Administrator on Windows
  3. Paste in the script from the portal and execute it on the server to be connected to Azure.
  4. The default authentication for onboarding an individual server is interactive using Azure 'device login'. When you run the script, you will see a message similar to:
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code B3V3NLWRF to authenticate.

Open a browser and enter the code to authenticate. The browser doesn't need to be running on the server you are onboarding, it could be on another computer such as your laptop.

  1. If you would like to authenticate non-interactively, follow the steps in Create a Service Principal and modify the script generated from the portal.


If you are using Internet Explorer on the server for the very first time to logon, it will error out. You can just reopen the browser and do it again.

Execute the script on target nodes

Log in to each Node and execute the script you generated from the portal. After the script completes successfully, go to the Azure portal verify that the server has been successfully connected.

Successful Onboarding

Clean up

To disconnect a machine from Azure Arc for servers, you need to perform two steps.

  1. Select the machine in Portal, click the ellipsis (...) and select Delete.

  2. Uninstall the agent from the machine.

    On Windows, you can use the "Apps & Features" control panel to uninstall the agent.

Apps & Features

If you would like to script the uninstall, you can use the following example which retrieves the PackageId and uninstall the agent using msiexec /X.

look under the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall and find the PackageId. You can then uninstall the agent using msiexec.

The example below demonstrates uninstalling the agent.

Get-ChildItem -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall | `
Get-ItemProperty | `
Where-Object {$_.DisplayName -eq "Azure Connected Machine Agent"} | `
ForEach-Object {MsiExec.exe /Quiet /X "$($_.PsChildName)"}

On Linux, execute the following command to uninstall the agent.

sudo apt purge hybridagent

Next steps