0
votes

I am trying to get a list of subscriptions in an Azure tenant using the Python SDK.

I want to use this class: https://docs.microsoft.com/en-us/python/api/azure-mgmt-subscription/azure.mgmt.subscription.operations.subscriptionsoperations

and the list method.

The documentation says "You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute."

What does that mean?

This is what I have:

client = SubscriptionClient(credentials)

test = SubscriptionClient.SubscriptionsOperations(client)

I am getting this:

AttributeError: type object 'SubscriptionClient' has no attribute 'SubscriptionsOperations'

Thanks,

Mick

1

1 Answers

1
votes

I got this working:

client = SubscriptionClient(credentials) # correct
print (client.subscriptions)

Which gives me azure.mgmt.subscription.operations.subscriptions_operations.SubscriptionsOperationswhich works when i use it.

This is what they mean by:

"You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute."