I am listing all available subscriptions. When calling subscription.id
it returns:
/subscriptions/<subscription-id>
Now if I try and pass that directly into say the Azure compute library it won't accept that as an ID.
compute_client = ComputeManagementClient(credential=credentials, subscription_id=subscription.id)
>> (SubscriptionNotFound) The subscription 'subscriptions' could not be found.
This means I have to manually clean the ID
subscription.id.replace("/subscription/", "")
Which is gross. Is there an inbuilt method to get just the ID?
This is the
subscription_id
attribute: https://learn.microsoft.com/en-us/python/api/azure-mgmt-resource/azure.mgmt.resource.subscriptions.v2019_11_01.models.subscription?view=azure-python(disclaimer I work at MS on the Azure SDK team)