I need to enable Azure Enhanced Monitoring for a couple hundred SAP VMs.. Does anyone know if there is a way to do this at the RG level or do I have to run the cmdlets for each VM? If the latter, how can I script this in cloud shell to read from an input file? The prob is that would still require a different command for each VM within every RG. Thanks!
Asked
Active
Viewed 110 times
0
-
Either create a policy to check VMs matching with your specifications (name, resource groups, subscription etc) and deploy both the extension if not exists. You can initially test the policy by assigning as Initiative to see what it would do and then apply. Or, azure automation or azure Devops pipeline to deploy these extensions – Sujit Singh Jun 16 '21 at 19:02
1 Answers
0
When we use the command Set-AzVMAEMExtension
to update the configuration of a virtual machine to enable or update the support for monitoring for SAP systems that are installed on the virtual machine, we should provide resource group name and VM name.
So if you want to run the command in azure cloud shell, I suggest storing resource group name and VM name as csv file then storing the file in cloud shell's storage account.
For example
- Create CSV file
- Get cloud shell's storage account
Get-CloudDrive
Upload the csv to the file share.
script
cd <MountPoint you copy from step2>
$vms=import-csv <file path in the file share>
foreach($vm in $vms){
Set-AzVMAEMExtension -ResourceGroupName $vm.ResourceGroup -VMName $vm.VM
}

Jim Xu
- 21,610
- 2
- 19
- 39