Adding Metric Source to Autoscale in AzureCLI for WebApp - azure

I am trying to add an autoscale rule to my app webapp, where I need to scale up 1 instance based on the number of messages from a service bus queue (metric source). I am hoping if someone has insight on how this can be achieved using Azure CLI. The microsoft documentation on autoscale doesn't really cover how I can add metric source as part of the condition.
From the UI:
[Metric Scale option from UI]
I am trying to to achieve something similar to this:
az monitor autoscale rule create --resource-group MyResourceGroup --resource MyPlan
--resource-type 'Microsoft.Web/serverfarms' --autoscale-name MyAutoScale
--condition "MessageCount > 20 avg 5m" `
--scale out 2
Looking at the json file, I am trying to get specify these fields in Azure cli
Any help on this topic would be highly apprciated. Thank you.

while creating the az monitor autoscale rule you have to specify the valid --condition to process your metrics.
Check the supported Metrics to achieve this.
Refer Service bus metrics to process the autoscale.

Related

Is there an Azure CLI command for getting Health Check status from Function App?

I've created a Function App, and everything seems to be running fine. In the Azure Portal, Function App Overview I can see that the Health Check is "100.00% (Healthy 2 / Degraded 0)", and on the Health Check page of the Function App I can see that it's enabled and the endpoint is "api/health".
Is there a way to get the "100% (Healthy 2 / Degraded 0)" through an Azure CLI command. It looks like az functionapp list only gives me the siteConfig.healthCheckPath value and that's not what I need.
You can fetch the values of Health Check Status metric by using the Azure CLI command az monitor metrics list as described here https://learn.microsoft.com/en-us/cli/azure/monitor/metrics?view=azure-cli-latest#az-monitor-metrics-list.
Example:
az monitor metrics list --resource myresource --resource-group myresourcegroup --resource-type "Microsoft.Web/sites" --metric "HealthCheckStatus" --interval 5m
Note that the --interval property is important as health checks do not support the default 1m interval used by az monitor metrics list

Unable to set 2 Properties using az functionapp plan update

We need to set Property through az functionapp plan update
We are using Premium Plan.
The links
https://learn.microsoft.com/en-us/azure/app-service/manage-scale-per-app
https://learn.microsoft.com/en-US/cli/azure/functionapp/plan?view=azure-cli-latest#az_functionapp_plan_update
does not talk about these 2 property accurate names...
per-site-scaling?
per_site_scaling?
perSiteScaling?
per-site-scaling is a feature in app service not for the azure functions app.
Maximum function app instances
In addition to the plan maximum instance count, you can configure a per-app maximum. The app maximum can be configured using the app scale limit.
In-order to increase the Maximum scale out limit of app scale out under a function app use the below command
az resource update --resource-type Microsoft.Web/sites -g <RESOURCE_GROUP> -n <FUNCTION_APP-NAME>/config/web --set properties.functionAppScaleLimit=<SCALE_LIMIT>
Here is the more information about the maximum scale out limit for app scale out in function app

Azure Machine Learning Compute quota?

The Manage and request quotas for Azure resources documentation page states that the default quota depends "on your subscription offer type". The quota doesn't show up in Azure web portal. Is there a way to find out current quota values using SDK, CLI, REST API?
You probably want to try something like this command :
az vm list-usage --location eastus --out table
It would get you the core usage for the region, which is what is important for deployment of resources.
Other choices (az + Powershell) are available here.
Hope this helps!

List all Alert rules in Azure monitor using Azure CLI

I am trying to list all the Alert rules that I have created in Azure Monitor using the Azure CLI so that I can enable/disable them as per need. Is there a way to achieve this programmatically using the Azure CLI?
Try the command below, more details refer to this link.
az monitor alert list --resource-group
Or you can use az monitor metrics alert list to list metric-based alert rules.

Azure Custom Logs general availability date

As per OMS portal Azure Custom logs are in preview mode. I am not able to find any link, providing an expected date of general availability. Can neone help me with that ??
Also I am not able to find any link providing information on how to activate custom logs for a virtual machine scale set ? Other than log analytics? is there is any way to capture custom logs ??
Currently, Custom Logs is in preview, you need enable it on OMS Portal firstly.
More information about this you could check this question.
If you want to collect log from VMSS, you need install oms agent on it. You could use CLI to do this, for Linux:
az vmss extension set --name OmsAgentForLinux --publisher Microsoft.EnterpriseCloud.Monitoring --resource-group <nameOfResourceGroup> --vmss-name <nameOfNodeType> --settings "{'workspaceId':'<OMSworkspaceId>'}" --protected-settings "{'workspaceKey':'<OMSworkspaceKey>'}"
For Windows:
az vmss extension set --name MicrosoftMonitoringAgent --publisher Microsoft.EnterpriseCloud.Monitoring --resource-group <nameOfResourceGroup> --vmss-name <nameOfNodeType> --settings "{'workspaceId':'<OMSworkspaceId>'}" --protected-settings "{'workspaceKey':'<OMSworkspaceKey>'}"
More information about Custom logs in Log Analytics you could check this official document.

Resources