How to Delete WEBSITE_TIME_ZONE application setting in Azure. Clicking DELETE does not remove it - azure-web-app-service

I added a variable to the configuration settings area of my application and I need to delete it now because I do not need it or want that setting anymore. It's called WEBSITE_TIME_ZONE. I would like to get rid of the setting but I can't.
I have clicked on the delete button but it does not work. As soon as I refresh the page or log back in, the setting/variable (WEBSITE_TIME_ZONE) is there once again.
I have tried multiple browsers and clearing cache but none of that works.
I have clicked on Advanced Edit and tried to delete it from there as well but that does not work either. It just comes back after refreshing the page, (after saving the changes).
I have tried to edited the name and the value to bogus data which I then try and delete but that does not work either. I can't even actually edit the name of the setting, WEBSITE_TIME_ZONE. After an edit I save it and as soon as I come back to the page, the variable name WEBSITE_TIME_ZONE is there again.
I have stopped the app and tried to delete the entry and then start the app again but still does not work.
I tried running this command in command prompt on the SCM back end and that does not work either. It says 'az' is not recognized as an internal or external command, operable program or batch file.
az webapp config appsettings delete --name MyWebApp --resource-group MyResourceGroup --setting-names {setting-names}
I read about typing that in the Azure CLI by using the Azure Cloud Shell, but that seems to not be included in the subscription($200 USD / month) I am already paying for see image below. I thought this would work with PowerShell or the CMD on the KUDU console SCM area but I guess not. Looks like it has to be with Azure Cloud Shell which you have have to pay for on top of the normal costs...
Is there any way to delete this app setting without having to pay for yet another service? I have searched everywhere on the internet for this and every post that I see ends in the same, "I can't delete it".
Any suggestions?
Thank you!

I am able to delete the AppSetting WEBSITE_TIME_ZONE from Application Settings without any issues.
After refreshing, I can see the AppSetting is deleted.
I thought this would work with PowerShell or the CMD on the KUDU console SCM area but I guess not.
This command has to be run from Cloud Shell.
Open the Cloud Shell.
Tried to delete with the below command in Azure cloushell - Bash.
az webapp config appsettings delete --name YourWebAppName --resource-group YourRGName --setting-names {WEBSITE_TIME_ZONE}
It says 'az' is not recognized as an internal or external command, operable program or batch file.
As you are running the cloud shell for the first, you will get this error.
We need to set the Subscription and create storage account to run commands in Cloud shell.
Follow the steps mentioned in the MSDOC - Quickstart for Bash in Azure Cloud Shell
az account list
az account set --subscription 'YourSubscriptionName'

Related

Azure CLI "az ams job start" is returning "index out of range"

I need to automate the creation of Assets, the uploading of MP3 files and the running Jobs in Azure Media Services.
I have successfully created Azure CLI scripts to create Assets and upload the MP3 files into those assets.
However, when I create a Job using the "az ams job start" (https://learn.microsoft.com/en-us/cli/azure/ams/job?view=azure-cli-latest#az-ams-job-start) command it returns with
"list index out of range"
If I run the same command in the Azure portal, it returns with the same error message.
The paramaters that I am using are of this format.
az ams job start --account-name myaccount --input-asset-name "myinputasset" --files "myfile.mp3" --transform-name "mytransform" --output-assets "myoutputasset" --resource-group "mygroup" --name "myname"
Can anyone provide any hints as to what I have done wrong or how I can get more details about what I need to do differently? The documentation is not great and I feel I have tried every combination of settings to get this to work.
The reason the command is failing is because you are missing an "=" sign after the --output-asset parameter. To clarify, this is how the CLI says the --output-asset parameter should be formatted:
--output-assets [Required] : Space-separated assets in 'assetName=label' format. An asset without label can be sent like this: 'assetName='.
To get the command to work change the command from --output-assets "myoutputasset" to --output-assets "myoutputasset="
Sorry about the error message, it is definitely not helpful. I have submitted a PR to update the error message to something more useful, thanks!

Running Azure Powershell Inline Script

I have a powershell script in order to make a backup of a SQL Database. I run the script locally, i run the script on TFS release phase with Powershell Script (not the azure powershell task), and everything went well.
Now, i want it to run it with the Azure PowerShell script: InlineScript because i want to remove the login part from my powershell. I saved the username \ password in the variables in order to login and i want to get rid of that
This is the script :
Please notice that i put the Login-AzureRmAccount because of the error. After this, i'm still getting it.
Error message:
[error]Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
[error]Run Login-AzureRmAccount to login.
As mentioned above please change the dropdown to "Azure Resource Manager" because in Azure classic this command will translate to Start-AzureSqlDatabaseCopy which does not have all the options available
https://learn.microsoft.com/en-us/powershell/module/servicemanagement/azure/start-azuresqldatabasecopy?view=azuresmps-4.0.0

AZ CLI login using Service Principal fails from specific computer

I have posted previously about az login using a Service Principal failing with the error No subscriptions found and I have run across others that have had similar issues. Capability seems shaky for some reason. What I am seeing now that has me scratching my head is when I run a script I have that does an az login with a service principal from my desktop computer it works fine...no issues. When I run the same script from my laptop, the login fails with the No subscriptions found error. What I have tried on the laptop:
Checked AZ CLI version...same as desktop
Ran az account clear to make sure everything was cleared out
Deleted Service Principal from AAD and recreated from laptop
I even ran az account clear on my desktop to make sure it was not working simply because it was cached and even after the clear, the az login worked fine.
Any thoughts on what might be causing this?
You need to assign a Role to the Service Principle, or add the flag --allow-no-subscriptions.
I have posted resolution for this under following thread.
https://stackoverflow.com/a/66108965/1712969
you might want to try command with this flag "--allow-no-subscriptions"

Azure WebApp container restart issue

I've created an web app running the grafana docker image as this
az group create --name grp-test-container-1
--location "West Europe"
az appservice plan create --name asp-test-container-1
--resource-group grp-test-container-1
--sku B1
--is-linux
az webapp create --resource-group grp-test-container-1
--plan asp-test-container-1
--name app-test-container-1
--deployment-container-image-name grafana/grafana:latest
Then I updated the appsettings in order to pass env variables to the docker run command
az webapp config appsettings set --name app-test-container-1
--settings GF_INSTALL_PLUGINS='grafana-azure-monitor-datasource'
--resource-group grp-test-container-1
Then I need to restart the container in order to get the added env variable in the docker run command.
I tried to restart the web app, stop/start it, change the docker image name and save under the Container Settings.. nothing works
Any suggestions?
Solution/Bug
As Charles Xu said in his answer, to reload the container you need to change the docker image and save in order to make the web app fetch the image again and apply the added env variables.
In my case, I did that change and then looked at the log output but the log never got updated. I waited 5-10 minutes and still no logs were added..
But when I visit the site and browsed to the extension, which were installed by the env varibles, I could se that it all had gone through.
So, to summarize: The log in the Container Settings are not to be trusted, when doing a change those changes might not show up in the log.
I just got off the phone with a support engineer from the Azure web apps/app services team, after having pulled my hair out for several days. Literally.
So in case anyone else having trouble with their app service not responding to restarts, configuration changes, docker image changes, etc, you can try this:
In the Azure Portal navigate to your app service and then "Configuration"->"General settings" and set the "Always on" setting to "On". This setting is by default set to "Off" and will make the app service enter an "idle state" after some time of not receiving any requests.
The only way to trigger the app service out of this idle state is to perform a request towards it. Restarts, config changes, docker image changes, etc., will have no effect until that first request is done. Setting the "Always on" setting to "On" will prevent the app service from entering this idle state, and so it will always be responsive.
In terms of cost this setting change shall have no impact. That is unless you are trying to force as many applications into a single app service plan as possible, where many of them are seldomly in use and hence in an idle state will not use any resources of your app service plan total.
What you need to do is change the image from grafana/grafana:latest into grafana/grafana, just delete the version latest and click the save button below. Then it will work.

What is a proper endpoint format for creating an Event Grid subscription

I have an Azure Function executed by Event Grid trigger. The function is debugged and functioning as designed. I was able to successfully create a subscription to an Event Grid topic using UI in the Azure Portal (click Add Event Grid subscription and complete the on-screen form).
The problem is I cannot get the endpoint format correct when attempting to use the CLI (Cloud Shell logged in as Administrator) to create a subscription. The basic template I'm using is
az eventgrid event-subscription create --resource-group $resourceGroup
--topic-name $topicName
--included-event-types $includedEventTypes
--name $eventSubscriptionName
--endpoint https://XXX.azurewebsites.net/admin/extensions/EventGridExtensionConfig?functionName=FunctionName&code=ABC123
I've tried copying the auto-populated endpoint, including its code parameter, from the UI. It works in the UI but not from CLI. When I run the above script using the endpoint and code provided in the portal, I get the following
The term 'code=<XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX> is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
If I omit the code, I get a message indicating the subscription failed because it couldn't validate the endpoint.
If I attempt to use the endpoint, in the form usually seen for function endpoints, https://XXX.azurewebsites.net/FunctionName, I also get complaints about validation.
What is the proper format for the endpoint when creating a subscription from the CLI in Cloud Shell? Do I include the code parameter or not? Where do I get the proper code?
Using:
Microsoft.NET.Sdk.Functions 1.0.19
Microsoft.Azure.EventGrid 1.4.0
Microsoft.Azure.WebJobs.Extensions.EventGrid 1.0.0
Try to wrap your function endpoint with quote sign, & seems a reserved sign in CLi syntax hence your parameter code is cut from the url.

Resources