Cannot set functionAppScaleLimit setting in Azure CLI for Azure Function - azure

I'm attempting to set the functionAppScaleLimit to 1 according to the documentation here:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#limit-scale-out
Using the az resource update --resource-type Microsoft.Web/sites -g <resource_group> -n <function_app_name>/config/web --set properties.functionAppScaleLimit=<scale_limit> command appears like it's working, but if I look at the Azure Function app settings using az resource show --ids <subscription_id> the functionAppScaleLimit is set to null. After I do the update command, the output shows properties.functionAppScaleLimit is set to 1. However, when I check with az resource show the functionAppScaleLimit setting appears to be in properties.siteConfig.functionAppScaleLimit.
Why do the settings look different after the update and when I check with az resource show? If I try to update instead using --set properties.siteConfig.functionAppScaleLimit=1 I get an error. I'll be doing some testing to see if the setting is actually working, but this seems a little strange.

It seems the format of az resource show is different, sorry I didn't find the reason, but we can sure that we can do this command to limit scale out:
az resource update --resource-type Microsoft.Web/sites -g <resource_group> -n <function_app_name>/config/web --set properties.functionAppScaleLimit=<scale_limit>
for ensuring it works or not, better use portal or the command I post instead --ids option.
az resource show --resource-type Microsoft.Web/sites -g <ResourceGroup> -n <FunctionName>/config/web

Related

Resize vmss in azure using azure cli

I want to update size of vmss from Standard_F16s_v2 to Standard_F32s_v2 I usually do it from Ui
but for some requirement I have to do it from a script so I tried to follow the documentation
https://learn.microsoft.com/en-us/cli/azure/vmss?view=azure-cli-latest
and tried to run this command
az vmss update --name MyScaleSet --resource-group MyResourceGroup --vm-sku Standard_F32s_v2
but it is not working shows error UnrecognizedArgumentError: unrecognized arguments: --vm-sku Standard_F32s_v2
The issue was with a previous version of az CLI which was resolved by upgrading it to version 2.30.0.
Test Scenario :

Az CLI to configure Azure Function App TLS/SSL "HTTPS Only" Setting

I am trying to use Az Cli to configure an Azure Function TLS/SSL Binding to switch the "HTTPS Only" setting from Off to On, as depicted below.
All attempts appear to have failed so far, using either of the below commands.
az webapp config set -g test-poc -n r-egm-test-fc --http20-enabled true
az functionapp config set -g test-poc -n r-egm-test-fc --http20-enabled true
Any ideas on:
Which command I should be using?
What is the correct syntax required to achieve my desired goal?
After some bit of digging around, I manage to find and successfully test the following as the right command:
az functionapp update -n 'r-egm-test-fc' -g 'test-poc' --set httpsOnly=true
Works like a charm !!

What is the right way to get Azure Cognitive service account endpoint from Azure-CLI

I was using the following command
$cogVisionEndpoint = (az cognitiveservices account show -n $accountName -g $resourceGroupName --query endpoint --output tsv)
but I found out that this stopped working when I ran this on another machine with a slightly newer version of Azure-CLI.
The JSON returned by the az cognitiveservices account show command is not consistent and looks like it has changed from version to a version.
How can I reliably get this not having to worry about the version of Azure CLI on the machine that I'm running on?
Or is there a completely different way to get the endpoint value?
With the newest version you will find endpoint in properties and since you rely on CLI version installed on the given machine you can simply modify your code to something like this:
$cogVisionEndpoint = (az cognitiveservices account show -n $accountName -g $resourceGroupName --query endpoint --output tsv)
if( !$cogVisionEndpoint ) {
$cogVisionEndpoint = (az cognitiveservices account show -n $accountName -g $resourceGroupName --query "properties.endpoint" --output tsv)
}

How to check if an azure resource is already in use using azure CLI?

Let's assume that an azure resource, ex "storage account" is being updated!
at the same time if I run a command like
az storage account update --default-action Allow --name MyStorageAccount --resource-group MyResourceGroup
It will throw an error
The request failed due to conflict with a concurrent request or something similar
So before running such command, how can I check if the resource is being used like being updated using Azure CLI
You could use az resource show to show everything about an Azure resource.
So in your case you would do:
az resource show -n "RESOURCE_NAME" -g "RESOURCE_GROUP" --resource-type "RESOURCE_TYPE"
I found the what I'm looking for inspired by the above answer at this link az resource wait
So it will be something like
az resource wait -n "RESOURCE_NAME" -g "RESOURCE_GROUP" --resource-type "RESOURCE_TYPE" --updated

Azure CLI 2.0: az vm update --set/--remove does not work?

I am attempting to remove and set tags on a VM, but am getting the error unrecognized arguments.
For example, removing a tag:
az vm update –-resource-group MyResourceGroup –-name MyTestVM --remove tags.myNewTagName1
and setting a tag:
az vm update --resource-group MyResourceGroup --name MyTestVM –-set tags.myNewTagName1=myNewTagValue1
Both examples are from the documentation. I'm running v2.0.30 on Mac OS 10.12.x.
Can anyone else confirm this and/or have it work for them? I haven't found any bugs listed in the issues db.
Thanks!
I discovered what was wrong. The syntax of the command is correct and works. However, I copied the command out of the documentation and it has a different character for the dashes/hyphens that the AZ CLI does not accept.
If you copy the samples, just re-type the dashes with the standard ones on your keyboard.
I had posted it this as an issue here: https://github.com/Azure/azure-cli/issues/5976

Resources