Azure / azure-cli

Azure Command-Line Interface
MIT License
3.99k stars 2.97k forks source link

az apim api import to existing API clears serviceUrl when the optional --service-url parameter isn't provided #29363

Open markdebruijne opened 2 months ago

markdebruijne commented 2 months ago

Describe the bug

az apim api import to existing API clears serviceUrl when the optional --service-url parameter isn't provided Clearing/removing/blanking the serviceUrl property of an APIM API is a risk that the runtime breaks down.

Related command

az apim api import

Errors

N/A

Issue script & Debug output

az apim api import 
  --service-name apim-something-weu 
  --resource-group rg-something-weu 
  --path /ecommerce 
  --specification-format OpenApiJson 
  --specification-path C:\something\ecommerce.json 
  --api-id ecommerce-v1 
  --api-version v1 
  --api-version-set-id 'ecommerce' 
  --description "sinterklaas" 
  --display-name eCommerce

Expected behavior

Ensure properties that are not provided, as they are (intentionally) optional, won't be changed via the resulting resource provider deployment.

Environment Summary

azure-cli                         2.62.0

core                              2.62.0
telemetry                          1.1.0

Extensions:
azure-devops                       1.0.0
maintenance                        1.6.0

Dependencies:
msal                              1.28.1
azure-mgmt-resource               23.1.1

Additional context

We aim to have this split

The serviceUrl is to be configured and maintained in the former, also to have an environment agnostic OpenAPI specification file. Currently that is impossible as I can't instruct the az apim api import to stay "hands of" the serviceUrl that was configured, and is no cleared as result, breaking the runtime and resulting into unavailability.

Can be reproduced via

The error directly after that

GatewayError:
   at forward-request

Backend service URL is not defined. 
yonzhan commented 2 months ago

Thank you for opening this issue, we will look into it.

markdebruijne commented 1 month ago

Any update about this bug @yonzhan