Azure / api-center

Provide feedback, request features, and report issues for Azure API Center.
MIT License
25 stars 3 forks source link

Import From APIM fails with invalid resource identifier #44

Open UniperMaster opened 1 month ago

UniperMaster commented 1 month ago

Description

Import function , keeps throwing the following error when trying to import an API/s from the APIM. Initially thought it was cross subscritpions issue but it fails with an APIM in the same RG, The error says it is invalid Resource identifier but other functions (Register) can find the resource and work fine

version

"apic-extension": "1.0.0b4",

Reproduction steps

Steps to reproduce the behavior:

  1. az login --scope https://management.core.windows.net//.default
  2. az account set -s xxxxxxxx-c01b-4bdf-aa11-3da2eac23394
  3. az apic service import-from-apim --resource-group 'apimc-paas-rg-001' --service-name 'apicenter-001' --source-resource-ids '/subscriptions/xxxxxxxx-c01b-4bdf-aa11-3da2eac23394/resourceGroups/apimc-paas-rgp-001/providers/Microsoft.ApiManagement/service/apim-paas-001/apis/*' --debug
  4. See error

Expected behavior

Successfulluy import the API definition

Actual behavior

I get the following error


Code: 400
Message: Exception while importing APIM: /subscriptions/xxxxxxxx-c01b-4bdf-aa11-3da2eac23394/resourceGroups/apimc-paas-rg-001/providers/Microsoft.ApiManagement/service/apim-paas-001/apis/*, exception: Failed to retrieve identity credentials from MSI data plane. Response code: BadRequest. Response message: {"error":{"code":"BadRequest","message":"Resource identifier '/subscriptions/xxxxxxxx-c01b-4bdf-aa11-3da2eac23394/resourcegroups/aapimc-paas-rg-001/providers/Microsoft.ApiCenter/services/apicenter-001' is invalid."}}
az_command_data_logger: (400) Exception while importing APIM: /subscriptions/xxxxxxxx-c01b-4bdf-aa11-3da2eac23394/resourceGroups/apimc-paas-rg-001/providers/Microsoft.ApiManagement/service/apim-paas-001/apis/*, exception: Failed to retrieve identity credentials from MSI data plane. Response code: BadRequest. Response message: {"error":{"code":"BadRequest","message":"Resource identifier '/subscriptions/xxxxxxxx-c01b-4bdf-aa11-3da2eac23394/resourcegroups/apimc-paas-rg-001/providers/Microsoft.ApiCenter/services/apicenter-001' is invalid."}}```
UniperMaster commented 1 month ago

Also tried via postman https://management.azure.com/subscriptions/xxxxxxxx-c01b-4bdf-aa11-3da2eac23394/resourceGroups/apimc-paas-rg-001/providers/Microsoft.ApiCenter/services/apicenter-001/importFromApim?api-version=2024-03-01

called the location return and go the same error message using the portal bearer token that I can access both servcies with

juliajuju93 commented 2 weeks ago

@UniperMaster - thanks for filing an issue. We recently updated our cli extension version, could you please check if this is still an issue?

UniperMaster commented 2 weeks ago

@juliajuju93 recently ran the issue against "version": "1.0.0b5" I believe this is the last version