Enable VM Insights (in Azure) using Azure Python SDK - azure

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.

Related

how to install azure cli on azure web app

I have been using azure cli installed on windows 7 locally. I want to use it on azure web app as well. But I did not find any relevant article to accomplish it. Could anyone let me know how to install az-cli on azure web app windows instance.
Thanks
If you want to create resources from your code you should use the Azure REST API:
https://learn.microsoft.com/en-us/rest/api/azure/
It also has client libraries, you can read more about it on the link.

Deploying a Java Azure Function to Azure Functions Runtime (On Premises)

So I am using Azure Functions at work and thought I would have a play and install them on my own server. I have successfully installed Azure Functions Runtime 2 (preview).
I have then followed the Java tutorial to create an Azure Function :
https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-first-java-maven
How do I then deploy this function to my own Azure functions server?
In the guide it says about using :
az login
mvn azure-functions:deploy
Unfortunately, mvn azure-functions:deploy is to deploy functions to Azure site as az login is required before deployment, which doesn't support deployment to on-premises Runtime portal.
But the key point is, the on-premises Runtime is obsolete(one year behind the latest bits), new project probably can't work with it even if we find how to publish.
Since v2 becomes GA, it is recommended to leverage custom image for usages out of Azure box.
Update
Missed one point. As AF Team answered in the issue you post, no Java Image for now so the usage of Azure Java Function outside Azure is blocked unless we could figure out creating the image on our own.

How to persist .exe installations on Azure Cloud Service

I am have created an Azure Cloud Service to analyze text in images. It uses this Python library which depends on the installation of Tesseract-OCR here. Specifically, I am using tesseract-ocr-setup-3.02.02.exe (one of the old versions because it has a Windows installer), which can be found here.
My problem is: this installer doesn't have a silent/automatic installation option, but I need it to automatically install itself when the Azure Cloud Service is being deployed. I can't be manually installing it every time I upload the cloud service, and especially after Azure restarts the Cloud Service VM for maintenance. Are there other options for getting Tesseract-OCR installed on the Azure Cloud Service VM so that the installation persists if Azure restarts the Cloud Service?
Your best bet would be to setup a VM, Install the software that you need, and deploy your app to this machine via ftp or something..
You can't customize the host of a "managed cloud service"

AKS: CI/CD pipeline using AKS

I'm trying to figure out the steps to setup CI/CD for an Asp.Net Core web application using AKS with VSTS. Are the steps described in https://learn.microsoft.com/en-us/vsts/build-release/apps/cd/azure/deploy-container-kubernetes valid for what I'm trying to do? Are windows container supported in AKS?
If your application is in ASP.Net Core, then you can host it in Linux as your code is platform independent. I have done this using Docker-file where your container is a self hosted app running on AKS.
VSTS provides a Inbuilt task to deploy to your AKS cluster in your build pipeline.
Windows support on k8s is better with Windows Server version 1709 which needs Kubernetes v1.9 (bleeding edge stable). See https://kubernetes.io/docs/getting-started-guides/windows/
Unfortunately, at this time, AKS preview only supports up to 1.8.2.
Frosty, if you can create a docker image out of your Windows machine, it can be pushed to the container registry and then deployed to Kubernetes cluster. Here are some links for reference:
Building and Pushing Windows container images: https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container/
Install Azure CLI: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
Create Kubernetes cluster in AKS: https://coderise.io/kubernetes-cluster-on-azure-container-service/
Windows containers are in private preview in AKS (reference); you can sign up using this form.. You can run hybrid clusters (Linux+Windows, up to 1803) using acs-engine today.
The VSTS walkthrough you linked is valid; check also this one and this one.
Update: Windows support for AKS is still a work in progress.
Currently Windows container are only in private preview, and you need to enable it using Azure CLI do some steps, please refer this official docs: https://learn.microsoft.com/en-us/azure/aks/windows-container-cli. After you enable it, then you can check the 'Windows Container' option when you create node pool in your azure kubernete service account.

Deploy azure worker role outside of visual studio with diagnostic setting

We are creating the azure worker role deployment package via our ci server and deploy the package to the azure cloud service using Azure Powershell cmdlets script.
however the diagnostic configuration does not get apply to the deployment; it only works when we deploy manually from within visual studio.
is there a way to do that in the powershell script to take into account the diagnostic setting (performance counter..etc) ?
You can use Set-AzureServiceDiagnosticsExtension PowerShell Cmdlet to enable diagnostics. You may find this link useful for this purpose: http://azure.microsoft.com/en-in/documentation/articles/cloud-services-dotnet-diagnostics/ (Please see Step 5: Install Diagnostics on your Worker Role).

Resources