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 !!
Related
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 :
Is there any way to enable health check via cli in azure app services? I see that we can modify some configurations but not an option to enable/disable the feature.
Thank you!
According to my test, we can enable/disable health check via changing the value of web config healthCheckPath. For more details, please refer to here.
For example(I test it via azure cloud shell)
a. Enable
az webapp config set -g <groupName> -n <web name> --generic-configurations '{"healthCheckPath": "/api/health/"}'
b.Disable
az webapp config set -g <groupName> -n <web name> --generic-configurations '{"healthCheckPath": ""}'
Thanks to #jim-xu answer I was able to get this working for our needs.
I did struggle trying to make syntax work in an existing PowerShell script with the string quotation marks and making it a variable. I thought I'd put that syntax here in case someone else is trying this via scripts not using bash.
# variables - these might be local or parameters from your function, etc..
$webAppName= "my-web-app"
$resourceGroupName = "my-resource-group"
$healthCheckPath = "/api/health/"
# the important part
$genericConfigurations = "{\""healthCheckPath\"": \""$healthCheckPath\""}"
az webapp config set --name $webAppName `
--resource-group $resourceGroupName `
--generic-configurations $genericConfigurations `
--output none
Yes I did attempt to be conscientious and read through Use Azure CLI effectively - Using quotation marks in values and it still wasn't clear to me.
I saw many other posts with users getting caught on this syntax; example 1, example 2, example 3.
I wonder if anybody knows how to add a connection string to an Azure function using a Powershell script? Perhaps something similar to this:
az functionapp config appsettings set --name FunctionName --resource-group MyResourceGroup --settings "ConnectionStrings=connection_value_here"
This command does create an application setting. I haven't been able to find a similar for connections.
TIA
Actually, I found a simpler solution:
az webapp config connection-string set -g "$ResourceGroup" -n "$FunctionAppName" -t custom --settings SchedulerServiceBusConnection="$FunctionConnectionString"
Just need to replace the values in quotes.
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
I am trying to configure a Pipeline with Jenkins and deploying it to Azure. I am at the last step of a tutorial:
https://learn.microsoft.com/en-us/azure/jenkins/tutorial-jenkins-deploy-web-app-azure-app-service
This last step is as follows, i have to enter this in the Azure CLI:
az group create --name yourWebAppAzureResourceGroupName --location region
az appservice plan create --name appServicePlanName --resource-group rgname --is-linux
az webapp create --name webAppName --resource-group rgName --plan appServicePlanName --runtime "java|1.8|Tomcat|8.5"
The last command gives me the error:
'1.8' is not recognized as an internal or external command,
operable program or batch file.
So I thought maybe Tomcat is not installed on my Azure VM, which is a Linux machine. So I used the next tutorial to install Tomcat:
https://www.howtoforge.com/tutorial/how-to-install-apache-tomcat-8-5-on-ubuntu-16-04/
After this I tried to do the --runtime command again, but I still get the same error. I have no idea how to fix this. I hope someone can help me with this problem.
I tried to check the webapp list-runtimes and I get this list:
"java|1.8|Tomcat|8.5" is in here. I've tried all of the versions, but it did not work.
EDIT: It works in the Azure Cloud Shell, but then there is another error:
Linux Runtime 'java|1.8|Tomcat|8.5' is not supported.Please invoke 'list-runtimes' to cross check
I have tried all the runtime versions, but still this error. I have also tried it with double quotes
I bet you solved your problem already, but in case others find this and are using PowerShell to run Azure CLI commands. This is what worked for me.
The problem is in how PowerShell interprets the pipe, '|', character inside the --runtime parameter, when evaluating the whole line.
Add the --% to be beginning of the command to turn off PowerShell evaluation of expressions, as suggested in the code block here.
Note: this will also stop PowerShell from evaluating any variables inside the command. What you can do is move the --runtime to the end of the line to get around this problem, e.g. like this
az webapp create -g $rg -p $appPlanName -n $appName --deployment-local-git --% --runtime "DOTNETCORE|3.0"
ok, i got it, that list is for windows webapp, not linux. for linux use:
az webapp list-runtimes --linux
so working solution:
az webapp create --name yourWebAppName --resource-group yourWebAppAzureResourceGroupName --plan yourLinuxAppServicePlanName --runtime "TOMCAT|8.5-jre8"