Azure / Azure/azure-rest-api-specs

azure-mgmt-apimanagement version 5.0.0 fails on creating or updating a product

Open
#34,230 6 comments 0 reactions 0 assignees View on GitHub
API Management customer-reported Mgmt needs-team-attention question Service Attention
Dominant language
TypeSpec
Stars
3.1k
Forks
6k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

- **Package Name**: azure-mgmt-apimanagement
- **Package Version**: 5.0.0
- **Operating System**: Ubuntu 22.04.5
- **Python Version**: 3.13

**Describe the bug**
When calling the create_or_update method on azure.mgmt.apimanagement.operations.ProductOperations, in 4.0.1 of the SDK the call succeeds, but in 5.0.0 the call fails with an exception

**To Reproduce**
Steps to reproduce the behavior:
Register a product with APIM (Standard V2 SKU) using azure-mgmt-apimanagement==5.0.0

(code summarized and redacting values)
from azure.mgmt.apimanagement import ApiManagementClient
from azure.mgmt.apimanagement.models import ProductContract

client = ApiManagementClient(...)
client.product.create_or_update(
resource_group_name='...',
service_name='...',
product_id='...',
parameters=ProductContract(
description='...',
display_name='...'
)
)

The log shows an error:
[ERROR azure.identity] Could not create/update the Product
Traceback (most recent call last):
...
File "/mnt/vss/_work/1/s/registerapim/lib/python3.13/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer
return func(*args, **kwargs)
File "/mnt/vss/_work/1/s/registerapim/lib/python3.13/site-packages/azure/mgmt/apimanagement/operations/_product_operations.py", line 797, in create_or_update
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: (MissingOrIncorrectVersionParameter) API version query parameter is not specified or was specified incorrectly. Supported versions: 2014-02-14-preview,2014-02-14,2015-09-15,2016-07-07,2016-10-10,2017-03-01,2018-01-01,2018-06-01-preview,2019-01-01,2019-12-01-preview,2019-12-01,2020-06-01-preview,2020-12-01,2021-01-01-preview,2021-04-01-preview,2021-08-01,2021-12-01-preview,2022-04-01-preview,2022-08-01,2022-09-01-preview,2023-03-01-preview,2023-05-01-preview,2023-09-01-preview,2024-06-01-preview Example query param format: api-version=SupportedVersion
Code: MissingOrIncorrectVersionParameter

**Expected behavior**
The product is created if it does not exist, or updated if it does exist. No error is logged.

**Additional context**
The APIM SKU is Standard V2

Contributor guide

Open the contributing guide

Research direction

Start with azure/mgmt/apimanagement/operations/_product_operations.py and inspect ProductOperations.create_or_update, especially how its API-version query parameter is generated. Reproduce the call against an APIM Standard V2 service, compare version 4.0.1 with 5.0.0, and verify that creating and updating a product succeeds using a supported API version.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
api, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.