Is there a way to enable VM insights in azure using azure python sdk ? Need to enable this so that the InsightMetrics/PerfMetrics are available in Log Analytics.
Thanks.
Is there a way to enable VM insights in azure using azure python sdk ? Need to enable this so that the InsightMetrics/PerfMetrics are available in Log Analytics.
Thanks.
We can enable VM insights using Azure Python SDK.
Create a workspace using https://learn.microsoft.com/en-us/python/api/azure-mgmt-loganalytics/azure.mgmt.loganalytics.operations.workspacesoperations?view=azure-python#azure-mgmt-loganalytics-operations-workspacesoperations-begin-create-or-update
Enable OmsAgentForLinux, DependencyAgentLinux entensions on the required VM using https://learn.microsoft.com/en-us/python/api/azure-mgmt-compute/azure.mgmt.compute.v2021_04_01.operations.virtualmachineextensionsoperations?view=azure-python#azure-mgmt-compute-v2021-04-01-operations-virtualmachineextensionsoperations-begin-create-or-update
Install VM insights solution on the Workspace using azure deployments.
https://learn.microsoft.com/en-us/azure/azure-monitor/vm/vminsights-configure-workspace?tabs=CLI#add-vminsights-solution-to-workspace
This has the process for VM insights solution using cli. The same can done using python sdk using deployments. https://learn.microsoft.com/en-us/python/api/azure-mgmt-resource/azure.mgmt.resource.resources.v2019_05_01.operations.deploymentsoperations?view=azure-python#azure-mgmt-resource-resources-v2019-05-01-operations-deploymentsoperations-begin-create-or-update
We need to deploy the VM insights solution to our workspace.