How to Put the OMS agent into the Multiple VMs using Powershell and CSV.

%3CLINGO-SUB%20id%3D%22lingo-sub-1082982%22%20slang%3D%22en-US%22%3EHow%20to%20Put%20the%20OMS%20agent%20into%20the%20Multiple%20VMs%20using%20Powershell%20and%20CSV.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1082982%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20the%20multiple%20VMs%20in%20my%20space.%20i%20want%20to%20insert%20the%20OMS%20agent%20into%20all%20the%20VMs.%3C%2FP%3E%3CP%3EHow%20to%20perform%20this%20using%20powerShell%3F%20any%20script%2C%20i%20can%20put%20my%20VM%20name%20and%20resource%20group%20into%20a%20csv%20file%20and%20run%20the%20script%20and%20Agents%20has%20been%20updated%20in%20all%20VMs.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1082982%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowershell%20and%20Rest%20API%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EQuery%20Language%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Contributor

I have the multiple VMs in my space. i want to insert the OMS agent into all the VMs.

How to perform this using powerShell? any script, i can put my VM name and resource group into a csv file and run the script and Agents has been updated in all VMs.

1 Reply
Highlighted

@Prashant Sharma, you have several options to onboard your VMs to Log Analytics. If the VMs are running in Azure, you can onboard them via Azure Portal, Azure Policy (the recommended way, as with the "Deploy Log Analytics agent" policies, every new VM will be automatically onboarded), via ARM templates, or via command line (Powershell/CLI).

 

Answering your specific question, the Powershell approach would be: