Connect an existing Linux server to Azure Arc
This article provides guidance for connecting a Linux server to Azure Arc using a simple shell script.
Prerequisites
Install or update Azure CLI to version 2.7 and above. Use the following command to check your current installed version.
az --version
Create an Azure service principal.
To connect a server to Azure Arc, an Azure service principal assigned with the Contributor role is required. To create it, sign in to your Azure account and run the following command. You can also run this command in Azure Cloud Shell.
az login az account set -s <Your Subscription ID> az ad sp create-for-rbac -n "<Unique SP Name>" --role contributor --scopes "/subscriptions/<Your Subscription ID>"
For example:
az ad sp create-for-rbac -n "http://AzureArcServers" --role contributor --scopes "/subscriptions/00000000-0000-0000-0000-000000000000"
The output should look like this:
{ "appId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "displayName": "http://AzureArcServers", "password": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "tenant": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX" }
Note
We highly recommend that you scope the service principal to a specific Azure subscription and resource group.
Create a new Azure resource group for your servers.
Download the
az_connect_linux
shell script.Change the environment variables according to your environment.
Copy the script to the designated server using your preferred tool of choice (or copy/paste the script to a new file inside the server). The following example shows how to copy the script from macOS to the server using
scp
.
Deployment
Run the script using the . ./az_connect_linux.sh
command.
Note
The extra dot is because the script has an export function and needs to have the vars exported in the same shell session as the rest of the commands.
Upon successful completion, you will have your Linux server, connected as a new Azure Arc resource inside your resource group.
Delete the deployment
To delete the server, select the server and delete it from the Azure portal.
To delete the entire deployment, delete the Azure resource group from the Azure portal.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for