0

When calling the latest (version 2020-01-01) azure tenants api (management.azure.com/tenants) I don't see the same properties in the response as I get when using the "Try it" feature on the "Tenants - List" page in the online Azure REST documentation.

The response that I get only contains the "id", "tenantId" and "tenantCategory" properties. So the cool stuff like countryCode, domains, displayName, etc. are missing. I was using an older api version before which only included the "id" and "tenantId" properties so I do see the additional "tenantCategory" property at least.

When calling the 2020-01-01 version of the subscriptions list API in my code I do get all the same properties that I see when I use the "Try it" feature.

Has anyone else experienced this issue or know what could be the cause?

Thanks in advance!

Martin D
  • 11
  • 2

2 Answers2

1

So it turns out that if you request the token under user context and use that as bearer token in the authorization header of the API call you get all the properties in the response, i.e. the same properties as you see when using the "Try it" feature online. But in my app I'm requesting it under the application context and then the expected behaviour is to only return the "id", "tenantId" and "tenantCategory" properties. So the tenants api is a bit different than the others and it's supposed to be that way.

Martin D
  • 11
  • 2
0

I tried with https://management.azure.com/tenants?api-version=2020-01-01 in Try it, it returned the properties. Try to use 2020-05-01, 2020-06-01 or 2020-07-01 versions. They all worked for me.

enter image description here

When using Postman to call the API:

enter image description here

unknown
  • 6,778
  • 1
  • 5
  • 14
  • I tried using the later versions that you mentioned in my code but I still only get the three properties. So I'm still stuck as I can't get the same data in my code as when I use the "Try it" feature. Btw, how did you find out that there are later versions than 2020-01-01? On the Tenants - List documentation page it says that 2020-01-01 is the current version and when I call the providers API directly it also says that this is the latest version of the Microsoft.Resources namespace and tenants resourceType in the apiVersions array. – Martin D Oct 27 '20 at 09:02
  • When I try with the version which is invalid, it returns all supported versions. – unknown Oct 27 '20 at 09:13
  • Have you tried to call API to get the display name of tenant? https://stackoverflow.com/a/53776799/13308381 – unknown Oct 27 '20 at 09:26
  • Cool idea to use an invalid version to get all the supported versions! A bit strange tho that the providers api and the documentation doesn't mention them. So the organisation API is returning all the data that the tenants api is missing atm. It contains pretty much everything I need but it's just strange that there's a mismatch between the actual response from the api call to the azure tenants api and when using the Try it feature. If you make a rest api call to the management.azure.com/tenants api, do you get the same response as when using "Try it"? – Martin D Oct 27 '20 at 10:50
  • Yes, I add the response with Postman in my reply. You could feedback here: https://feedback.azure.com/forums/248703-api-management. – unknown Oct 28 '20 at 02:15