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

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.

Related

How to Delete WEBSITE_TIME_ZONE application setting in Azure. Clicking DELETE does not remove it

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'

How to refresh durable function key "durabletask_extension" using Az Cli

We are facing a strange issue with one of our Az Functions. We are using a durable functions which it does have several AppKeys configured, one of them is called "durabletask_extension".
We are trying to automate the refresh of the keys using Az Cli but apparently when we try to refresh the key - the shell gives an error like "Operation Returned an invalid status "NotFound" "
However, I can see from listing the keys that the key-name provided is supposed to be correct.
Kindly see images attached :)
is this a bug or am I doing something wrong?
Refresh of default or master keys seems to be working just fine.
Images:
Keys List:-
Keys Set:-
We are able to reproduce the issue,
The key name which you have provided is systemKeys which is automatically managed by the Function runtime.
Instead, of that we have tried with functionkeys and it just worked fine with the same keyname "durabletask_extension" which we can add in our function app .
NOTE:- To add masterKey as in your functions you can use the below cmdlts.
az functionapp function keys set -g MyResourceGroup -n MyFunctionAppName --function-name MyFunctionName --key-name systemKey --key-value MyKeyValue
For more information please refer the below links:-
MS DOC| az functionapp keys set.& az functionapp function keys set .

Request timing out when exporting Azure resource group in powershell

I want to export an ARM template for a resource group in Windows Azure. I'm using the Azure Powershell module.
Whenever I try to export the resource group using Export-AzResourceGroup, the cmdlet fails with the following error:
Export-AzResourceGroup : Operation failed because a request timed out.
I have inspected the web traffic with Fiddler and I can see that the actual HTTP call to Azure is completing successfully, it's just taking a long time. So it's not a matter of e.g. extending the timeout on the ServicePointManager.
Is there any solution or work-around to stop this cmdlet timing out?
This issue maybe occurring due to a previous version of Az powershell module. Please update your Az module to the latest version and try again.
Also make sure you have the write permissions in the directory you are trying to create the json file.
Meanwhile, you can create the template from the portal just to check if the json file is getting created successfully:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/export-template-portal#export-template-from-a-resource-group

"The term '***' is not recognized as the name of a cmdlet" error thrown in Azure Powershell step in Azure DevOps Pipeline

I have an Azure Powershell step in my release pipeline that calls the Invoke-RestMethod cmdlet to make a call to the kudu API.
At the point of creating the step is selected my Azure Subscription from the list of available subscriptions and it uses this to authenticate.
I was able to run the step successfully at first, getting the following output in the console log:
However, for every subsequent release now I am receiving the error ##[error]The term '***' is not recognized as the name of a cmdlet, function, script file, or operable program. with the following output:
I haven't changed the powershell that the step actually runs. Could there be an issue with the way the release pipeline is authenticating and selecting the subscription? I see in the output that the TenantId is shown as ***, which is what the error message is complaining about, could that be the source of it?
It looks like a problem in your script. *** is used to mask secret variables, so your script is probably doing something where it's trying to run the contents of a variable. Maybe something like &$TenantId.

Azure function app deployment through intellij

I'm trying to deploy azure function app from intelliJ, getting following error when run mvn azure-functions:deploy
"The specified function app does not exist. Creating a new function app..."
after above getting status code : 400
Not sure why 400 since there is nothing printed or returned.
In pom, check functionResourceGroup of properties, resource group has some naming restrictions
Alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters.
Maven Plugin for Azure Functions seems not to provide concrete error message as it does for functionAppName.
In my case I had multiple subscriptions attached to my account, since I was not setting any subscription upon login, azure was using default subscription and was not finding the function app.
I set the subscription in which function app was created then it worked properly.
az login -u <> -p <>
and then set the subscription
az account set
after above run the azure deploy. it worked for me.

Resources