Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Azure CLI to create the multiple version of APIM #30372

Open
kensinzl opened this issue Nov 18, 2024 · 3 comments
Open

How to use Azure CLI to create the multiple version of APIM #30372

kensinzl opened this issue Nov 18, 2024 · 3 comments
Labels
API Management az apim Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.

Comments

@kensinzl
Copy link

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

@kensinzl kensinzl added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Nov 18, 2024
Copy link

Hi @kensinzl,

2.61.0 is not the latest Azure CLI(2.66.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

@azure-client-tools-bot-prd azure-client-tools-bot-prd bot added the Auto-Resolve Auto resolve by bot label Nov 18, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Service Attention This issue is responsible by Azure service team. API Management az apim labels Nov 18, 2024
@kensinzl
Copy link
Author

I have updated into the latest but still for the issue, please have a look

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 18, 2024

route to APIM service team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Management az apim Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants