How to connect Azure Arc "azcmagent connect" non-interactively?

Zambre, Akash 0 Reputation points
2025-01-23T08:35:20.52+00:00

The "azcmagent connect" command to connect a machine to Azure expects manual interaction to complete the connection.

Looking at the docs, for non-interactive apps, we can use access-token. Tried that, got the token using "Get-AzAccessToken", but doesn't seem to work.

Any ideas on how to connect non-interactively?

Azure Arc
Azure Arc
A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.
476 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Chiugo Okpala 160 Reputation points MVP
    2025-01-23T08:48:13.3066667+00:00

    Hi Zambre,Akash,

    To connect Azure Arc using azcmagent connect non-interactively, you can use a service principal with a secret. Here's an example command:

    azcmagent connect --subscription-id "YOUR_SUBSCRIPTION_ID" --resource-group "YOUR_RESOURCE_GROUP" --location "YOUR_REGION" --service-principal-id "YOUR_SERVICE_PRINCIPAL_ID" --service-principal-secret "YOUR_SERVICE_PRINCIPAL_SECRET" --tenant-id "YOUR_TENANT_ID"

    
    Replace the placeholders with your actual subscription ID, resource group, location, service principal ID, service principal secret, and tenant ID[_{{{CITATION{{{_1{azcmagent connect CLI reference - Azure Arc | Microsoft Learn](https://learn.microsoft.com/en-us/azure/azure-arc/servers/azcmagent-connect).
    
    For more on this see microsoft documentation  [https://learn.microsoft.com/en-us/azure/azure-arc/servers/azcmagent-connect](https://learn.microsoft.com/en-us/azure/azure-arc/servers/azcmagent-connect)
    
    

  2. Chiugo Okpala 160 Reputation points MVP
    2025-02-13T10:05:11.4033333+00:00

    @Zambre,Akash,

    Since my tip helped you in solving your question, do click "Accept the answer" which might be beneficial to other community members reading this thread. And,if you have any further query do let me know.

    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.