azure-sdk-for-python
azure-sdk-for-python copied to clipboard
web_apps.create_or_update_function_secret ommits required request property Properties
- Package Name: azure-mgmt-web
- Package Version: 7.0.0
- Operating System: macOS 12.6.3 (21G419)
- Python Version: Python 3.10.9
Describe the bug
There seems to be a missing required parameter in the KeyInfo object
To Reproduce Steps to reproduce the behavior:
- Try to call
create_or_update_function_secret
website_mgmt_client: WebSiteManagementClient = WebSiteManagementClient(
subscription_id=subscription_id,
credential=DefaultAzureCredential()
)
key_info = website_mgmt_client.web_apps.create_or_update_function_secret(resource_group_name=resource_group_name,
name=site_name,
function_name=function_name,
key_name=key_name,
key=key_info
)
Expected behavior Request succeeds with HTTP 201
Actual behavior Error returned from Azure:
{
"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
}
Additional context I tried issuing the same request with a REST client, replicating the URL, Authorization header, and JSON request body that the client is using:
{"name": "keyname", "value": "keyvalue"}
and got he same error response.
I then amended the request to simply add an additional Properties object:
{"name": "keyname", "value": "keyvalue", "Properties": {}}
And the request succeeded and the new key shows in Azure portal
Hi @idontusenumbers, thank you for opening an issue! I'll tag some folks who should be able to help and we'll get back to you as soon as possible.
Thank you for your feedback. This has been routed to the support team for assistance.
@idontusenumbers We are looking into it and get back to you for any additional information.
@idontusenumbers sorry for the delay. I am able to reproduce this issue and discussing internally. I will update you at the earliest.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI @antcp.
Hi,
Is there any progress within this case? It seems quite old, however problem still persists
key_info = KeyInfo(
name=endpoint_key.name,
value=endpoint_key.api_key
)
web_client.web_apps.create_or_update_function_secret(
resource_group_name=function_app.resource_group,
name=function_app.function_app,
function_name=endpoint.endpoint,
key_name=endpoint_key.name,
key=key_info
)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request' Content: {"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}
@ChenxiJiang333 Please help on this issue
got it
Hi,
Is there any progress within this case? It seems quite old, however problem still persists
key_info = KeyInfo( name=endpoint_key.name, value=endpoint_key.api_key ) web_client.web_apps.create_or_update_function_secret( resource_group_name=function_app.resource_group, name=function_app.function_app, function_name=endpoint.endpoint, key_name=endpoint_key.name, key=key_info )
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request' Content: {"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}
Hi, since it might be service issue, please follow https://github.com/Azure/azure-rest-api-specs/issues/29701.
Please use https://github.com/Azure/azure-rest-api-specs/issues/29701 to track the issue.