subscription class should return the tags associated with the subscription
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like A clear and concise description of what you want to happen.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
https://docs.microsoft.com/en-us/python/api/azure-mgmt-subscription/azure.mgmt.subscription.models.subscription?view=azure-python
This class does not include tags, although tags are included in the rest api:

@nancybelser thanks for reporting this, @nickzhums could you take a look at this?
Any status updates on this?
@RodgeFu please have someone take a look at this, thanks!
Hi @nancybelser , would you help to provide the link address for the rest api doc you showed? Thanks.
It is on this page: https://docs.microsoft.com/en-us/rest/api/resources/subscriptions/get?view=azurermps-6.9.0
We are setting tag values on our subscriptions. I need to retrieve those values in a python script I am currently writing.
Hi @nancybelser , the rest api you referred is actually belong to azure-mgmt-resource, not the azure-mgmt-subscription in your python doc link. And meanwhile, the SDK release is sometime behind the rest api release, the 'tags' feature has not been added into current azure-mgmt-resource SDK. It's expected that it can be included in the next release of azure-mgmt-resource.
I see this issue got added to the backlog. Does that mean it will not be worked on anytime soon?
Hi @nancybelser No, it doesn't mean that, this is just the default milestone while we are investigating the issue we want to prioritize. I let @zikalino and @changlong-liu give you a more concrete answer on the status of the issue. Thanks!
Hi @nancybelser , the subscription tag retrieving feature has been included in azure-mgmt-resource 9.0.0 released at early April. https://pypi.org/project/azure-mgmt-resource/9.0.0/.
Hi @changlong-liu,
I upgraded to latest azure-mgmt-resource, but I noticed that the class I am using to list all subscriptions is in azure-mgmt-subscription.
In this file, https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models.py:
I think this needs to change to include tags: _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'state': {'key': 'state', 'type': 'SubscriptionState'}, 'subscription_policies': {'key': 'subscriptionPolicies', 'type': 'SubscriptionPolicies'}, 'authorization_source': {'key': 'authorizationSource', 'type': 'str'},
This is an excerpt of my script: def get_subscriptions(credentials): subscription_client = SubscriptionClient(credentials) subscriptions = subscription_client.subscriptions.list() for subscription in subscriptions: print(subscription)
It does not return tags.
Thanks.
yes, @nancybelser, azure-mgmt-subscriptions don't have tag yet. If you just want to retrieve subscription tags, would you have a try on azure-mgmt-resource? https://github.com/Azure/azure-sdk-for-python/blob/cd25de58e00d624511b5154e9fe8683826020bc0/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py#L293
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @anuragdalmia, @shilpigautam, @ramaganesan-rg.
Just tried it and it worked. Thanks!
From: changlong-liu [email protected] Reply-To: Azure/azure-sdk-for-python [email protected] Date: Friday, May 8, 2020 at 3:33 AM To: Azure/azure-sdk-for-python [email protected] Cc: Nancy Belser [email protected], Mention [email protected] Subject: Re: [Azure/azure-sdk-for-python] subscription class should return the tags associated with the subscription (#10240)
yes, @nancybelserhttps://github.com/nancybelser, azure-mgmt-subscriptions don't have tag yet. If you just want to retrieve subscription tags, would you have a try on azure-mgmt-resource? https://github.com/Azure/azure-sdk-for-python/blob/cd25de58e00d624511b5154e9fe8683826020bc0/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py#L293https://github.com/Azure/azure-sdk-for-python/blob/cd25de58e00d624511b5154e9fe8683826020bc0/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py#L293
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-sdk-for-python/issues/10240#issuecomment-625681666, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJ3OJ57NXBN44DJJJ4OYN43RQOYSXANCNFSM4LFGYV6A.
Thanks for feedback @nancybelser , I close this issue for now.
hi @nancybelser how did you list the tags for the subscriptions? mine shows up as "none"
ie:
{'additional_properties': {}, 'id': '/subscriptions/4e37827xxx00f3d5d', 'subscription_id': '4e378272-xxxf3d5d', 'display_name': 'display name', 'tenant_id': '5d3exxx', 'state': 'Enabled', 'subscription_policies': <azure.mgmt.resource.subscriptions.v2021_01_01.models._models_py3.SubscriptionPolicies object at 0x106f4df90>, 'authorization_source': 'RoleBased', 'managed_by_tenants': [], 'tags': None}