azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

web_apps.create_or_update_function_secret ommits required request property Properties

Open idontusenumbers opened this issue 2 years ago • 6 comments

  • 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:

  1. 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

idontusenumbers avatar Mar 24 '23 18:03 idontusenumbers

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.

mccoyp avatar Mar 24 '23 19:03 mccoyp

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Mar 24 '23 19:03 ghost

@idontusenumbers We are looking into it and get back to you for any additional information.

SaurabhSharma-MSFT avatar Mar 25 '23 01:03 SaurabhSharma-MSFT

@idontusenumbers sorry for the delay. I am able to reproduce this issue and discussing internally. I will update you at the earliest.

SaurabhSharma-MSFT avatar Apr 27 '23 20:04 SaurabhSharma-MSFT

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI @antcp.

github-actions[bot] avatar Sep 28 '23 21:09 github-actions[bot]

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}

Kacperek0 avatar Jan 10 '24 16:01 Kacperek0

@ChenxiJiang333 Please help on this issue

msyyc avatar Jul 03 '24 05:07 msyyc

got it

ChenxiJiang333 avatar Jul 03 '24 05:07 ChenxiJiang333

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.

ChenxiJiang333 avatar Jul 04 '24 08:07 ChenxiJiang333

Please use https://github.com/Azure/azure-rest-api-specs/issues/29701 to track the issue.

xiangyan99 avatar Aug 01 '24 23:08 xiangyan99