Skip to content

[Resources] Response from Azure Stack doesn't comply with the spec subscriptions.json #9567

@jiasli

Description

@jiasli

When using 2019-06-01 with Azure Stack to get subscriptions (in this case management.redmond.azurestack.corp.microsoft.com), the response doesn't comply with the REST spec subscriptions.json. For example, authorizationSource and managedByTenants are missing from the response.

"managedByTenants": {
"type": "array",
"items": {
"$ref": "#/definitions/ManagedByTenant"
},
"description": "An array containing the tenants managing the subscription."
}

> az cloud register -n redmond --endpoint-resource-manager "https://management.redmond.azurestack.corp.microsoft.com/" 
> az cloud set -n redmond 
> az login --debug

msrest.http_logger : Request URL: 'https://management.redmond.azurestack.corp.microsoft.com/subscriptions?api-version=2019-06-01'
msrest.http_logger : Request method: 'GET'

msrest.http_logger : Response status: 200
msrest.http_logger : Response content:
msrest.http_logger : 
{
    "value": [
        {
            "offerId": "/delegatedProviders/default/offers/full-offer",
            "id": "/subscriptions/c9b8dfff-aff0-49b5-93bd-a1581f1896a0",
            "subscriptionId": "c9b8dfff-aff0-49b5-93bd-a1581f1896a0",
            "tenantId": "81cfafcd-8b9a-4419-9c85-823b54076b55",
            "displayName": "azclidevtools",
            "state": "Enabled",
            "subscriptionPolicies": {
                "locationPlacementId": "AzureStack"
            }
        }
    ]
}

This causes failure in Azure CLI when retrieving managed_by_tenants:

  File "C:\Users\jiasli\AppData\Local\Programs\Python\Python38\lib\site-packages\azure\cli\core\_profile.py", line 276, in _normalize_properties
    subscription_dict[_MANAGED_BY_TENANTS] = [{_TENANT_ID: t.tenant_id} for t in s.managed_by_tenants]
TypeError: 'NoneType' object is not iterable

The response of the public AzureCloud is:

> az cloud set -n AzureCloud
> az login --debug

msrest.http_logger : Request URL: 'https://management.azure.com/subscriptions?api-version=2019-06-01'
msrest.http_logger : Request method: 'GET'

msrest.http_logger : Response status: 200
msrest.http_logger : Response content:
msrest.http_logger : 
{
    "value": [
        {
            "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590",
            "authorizationSource": "RoleBased",
            "managedByTenants": [
                {
                    "tenantId": "2f4a9838-26b7-47ee-be60-ccc1fdec5953"
                }
            ],
            "subscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590",
            "tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a",
            "displayName": "AzureSDKTest",
            "state": "Enabled",
            "subscriptionPolicies": {
                "locationPlacementId": "Internal_2014-09-01",
                "quotaId": "Internal_2014-09-01",
                "spendingLimit": "Off"
            }
        }
    ],
    "count": {
        "type": "Total",
        "value": 1
    }
}

If 2019-06-01 is not supported, the service should return "unsupported API version" instead a wrong response which doesn't comply with the spec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Azure StackService AttentionWorkflow: This issue is responsible by Azure service team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions