az functionapp keys set returns invalid status 'Bad Request', properties object not present in request body
This is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az functionapp keys set
I also tried to use az rest to see if that would work: az rest --method put --url "https://management.azure.com/subscriptions/REDACTED/resourceGroups/REDACTED/providers/Microsoft.Web/sites/REDACTED/host/default/functionKeys/testKey?api-version=2022-03-01" --body '{"testKey": ""}' --debug --verbose (Also tried some non-empty text values for the key value)
Every time got this kind of error: Bad Request({"Code":"BadRequest","Message":"Properties object is not present in the request body.","Target":null,"Details":[{"Message":"Properties object is not present in the request body."},{"Code":"BadRequest"},{"ErrorEntity":{"ExtendedCode":"51006","MessageTemplate":"{0} object is not present in the request body.","Parameters":["Properties"],"Code":"BadRequest","Message":"Properties object is not present in the request body."}}],"Innererror":null})
This is consistent in an Azure DevOps Ubuntu agent (Microsoft-hosted) as well as locally, Azure CLI 2.42 (reported below) and 2.43 - I updated after generating this ticket but same behavior.
Errors:
Operation returned an invalid status 'Bad Request'
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
az functionapp keys set --key-name {} --key-type {} --name {} -g {} --verbose --debug
Expected Behavior
The function app key gets created/updated correctly.
Environment Summary
Windows-10-10.0.19044-SP0
Python 3.10.8
Installer: MSI
azure-cli 2.42.0
Extensions:
account 0.2.3
datafactory 0.7.0
monitor-control-service 0.3.0
Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1
Additional Context
route to CXP team
@plzm I believe this is not a cmdlet issue. You are getting this error because your function app is not able to access the configured storage account either because of a network misconfiguration or because of an issue on the storage side. This storage account gets referenced by the Function App Application Setting “AzureWebJobsStorage”.
Can you try creating the key from Azure Portal? or try creating a new function app and then using the cmdlet.
Thanks @SaurabhSharma-MSFT.
I was able to create keys once I created a Function without any private link/endpoint, and a storage account that accepted all public network traffic. I expect that Function with VNET_ROUTE_ALL and a storage account with private endpoint for all services is the issue.
Is there any way to parse the output of az functionapp keys set and determine that "Bad Request" actually means that a storage or network configuration issue is the problem? I ran with --debug and didn't see anything obvious.
I'll go ahead and close this issue but it would be great to have the error message be more specific - apologies if I missed this reason in the output somewhere.
One other comment - on the Function where this failed, I created another storage account that accepted all public network traffic and set its conn string on the Function AzureWebJobStorage, saved Config, also explicitly restarted Function app. That didn't help - no keys, and no blob containers created in the new storage account. I checked Function docs for storage acct requirements (no Premium, must be GP, same region etc. etc.) and confirmed meeting all of them.
Does reconfiguring a Function for a wide open storage account not fix the key issue?
One other comment - on the Function where this failed, I created another storage account that accepted all public network traffic and set its conn string on the Function AzureWebJobStorage, saved Config, also explicitly restarted Function app. That didn't help - no keys, and no blob containers created in the new storage account. I checked Function docs for storage acct requirements (no Premium, must be GP, same region etc. etc.) and confirmed meeting all of them.
Does reconfiguring a Function for a wide open storage account not fix the key issue?
@plzm I believe reconfiguration should fix this key issue. In case you feel you don't any network issues connecting storage account, I suggest you to please open a Azure Support Ticket so that a Support engineer can investigate this connectivity this issue.