-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
I can create multiple versions for APIs via the Azure portal, and I know these versions are version set.
But if I tried the Azure CLI commands, they did not work well and I even cant find a valid example from the official document.
eg:
- This command to create a version set and I hope this set will include three different versions, eg: 5,6, and original
az apim api versionset create --display-name 'EcoConnect Mintaka UAT Rest APIs' \
--resource-group "$RESOURCE_GROUP" \
--service-name "$APIM_INSTANCE" \
--versioning-scheme 'Header' \
--description 'EcoConnect Mintaka UAT Rest APIs With Version' \
--version-header-name 'X-Api-Version' \
--version-set-id 'mkaversionset'
- Then I hope, the versions is using the header param to manage the versions.
I need each version APIs is loading from a different OpenAPI.json and from a same URL
az apim api import --path '/mintaka' \
--resource-group "$RESOURCE_GROUP" \
--service-name "$APIM_INSTANCE" \
--api-id "$REST_API_NAME" \
--display-name "$REST_API_DISPLAY_NAME" \
--specification-format 'OpenApiJson' \
--api-type 'http' \
--protocols 'https' \
--service-url "$MK_BACKEND_URL" \
--specification-path '/Users/zhaol/Desktop/MKA_V5.json' \
--api-version 5 --api-version-set-id 'mkaversionset'
az apim api import --path '/mintaka' \
--resource-group "$RESOURCE_GROUP" \
--service-name "$APIM_INSTANCE" \
--api-id "$REST_API_NAME" \
--display-name "$REST_API_DISPLAY_NAME" \
--specification-format 'OpenApiJson' \
--api-type 'http' \
--protocols 'https' \
--service-url "$MK_BACKEND_URL" \
--specification-path '/Users/zhaol/Desktop/MKA_V6.json' \
--api-version 6 --api-version-set-id 'mkaversionset'
az apim api import --path '/mintaka' \
--resource-group "$RESOURCE_GROUP" \
--service-name "$APIM_INSTANCE" \
--api-id "$REST_API_NAME" \
--display-name "$REST_API_DISPLAY_NAME" \
--specification-format 'OpenApiJson' \
--api-type 'http' \
--protocols 'https' \
--service-url "$MK_BACKEND_URL" \
--specification-path '/Users/zhaol/Desktop/MKA_V5.json' \
--api-version Original --api-version-set-id 'mkaversionset'
- the above command will overwrite, that means in the later will only Original version APIs
Related command
az apim api versionset create
az apim api import
Errors
It does not create the multiple versions, and it shows the latest version, that means overwrite the previous one
Issue script & Debug output
sorry no outstanding error message
Expected behavior
If I have three version, I hope I can get three rather than overwrite each other
Environment Summary
azure-cli 2.61.0 *
core 2.61.0 *
telemetry 1.1.0
Dependencies:
msal 1.28.0
azure-mgmt-resource 23.1.1
Python location '/usr/local/Cellar/azure-cli/2.61.0/libexec/bin/python'
Extensions directory '/Users/zhaol/.azure/cliextensions'
Python (Darwin) 3.11.9 (main, Apr 2 2024, 08:25:04) [Clang 15.0.0 (clang-1500.1.0.2.5)]
Legal docs and information: aka.ms/AzureCliLegal
Additional context
No response