How to create association between an Azure Arc-enabled server and a data collection rule using Power Shell script

CDN Tech 1 Reputation point
2022-08-24T07:33:32.737+00:00

Hi Teams,
I am working to automate the Log analytics workspace process using powershell script. In this process I successfully created the workspace, resource group, onboard windows machine using Azure Arc and also able to create the data collection rules. But I am stuck how to create association between an Azure Arc-enabled server and a data collection rule using Power Shell script.
Please help me how to associate windows Arc enabled machine (hybrid) to data collection rule
234307-param.png234300-template.png

234288-error.png

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,320 questions
Azure Arc
Azure Arc
A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.
437 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Stanislav Zhelyazkov 24,686 Reputation points MVP
    2022-08-24T11:42:52.227+00:00

    Hi,
    I see that you are doing this via ARM template rather via PowerShell. You only use PowerShell to start the ARM Template deployment. In any case to associate data collection rule to Arc server you can use cmdlet New-AzDataCollectionRuleAssociation. If you want to do this via ARM Template here is example.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    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.