(UCMDB) Support Tip: Azure by Webservices does not discover tag information on large amount of subscriptions queried

1 Likes

UCMDB DDM Content Pack 2022.05

Getting Azure tags has been incorporated in CP 2022.05. It has been detected what appears to be an Azure bug that prevents getting tags on some Azure subscriptions when the number of subscriptions in the tenant is large.


The discovery makes a call to https://management.azure.com/subscriptions?api-version=2020-01-01 to have the detail of the subscriptions, if the number is large, the response obtained does not have tags in all the subscriptions.

Cause

Azure cannot handle large queries for subscription tags.

 

Resolution

It is best to create a new adapter and job and make a new script for the modified azure_discoverer.py script. 

1. Create a new adapter

2. Add all the scripts - vendors.py, rest_json.py, rest_cache.py, rest_requests.py,
(the modified) azure_discoverer.py
Modify the SubscriptionDiscoverer class in the azure_discoverer.py script:

def discover(self):

#DFO fix to get tags in all subscriptions

subscriptionIds = []

subscriptions = []

subscriptions_json = self.client.getValues(self.api_url + 'subscriptions?api-version=' + self.subscription_api_version)

 

if subscriptions_json is None:

return None

 

if subscriptions_json:

for subscription_json in subscriptions_json:

logger.debug('found subscription(1): %s' % subscription_json)

subscriptionIds.append(subscription_json['subscriptionId'])

#subscription = self.get_object_from_json(subscription_json)

 

#if subscription.state == 'Enabled':

# subscriptions.append(subscription)

for subscriptionId in subscriptionIds:

subscription_json = self.client.get_json_response(self.api_url + 'subscriptions/' + subscriptionId + '?api-version=' + self.subscription_api_version)

logger.debug('found subscription(2): %s' % subscription_json)

subscription = self.get_object_from_json(subscription_json)

subscriptions.append(subscription)

 

return subscriptions

And add the rest of the OOTB scripts azure_utils.py, azure_common.py, basic_azure.py, basic_azure_by_webservices.py, azure_generic_handler.py, azure_reporter.py, azure_by_webservices_common.py)

3. Add all the permissions, protocols, Discovered CITs, Global Configuration files and Adapter Parameters like the OOTB Azure_by_WeServics adapter

4. Make a new job and name it differently, add the adapter you just created, make sure you use the same Trigger Queries and all the properties of the OOTB job.

This way you will keep the OOTB job with the way it functions, and you will have a modified one for the subscriptions.

Labels:

Support Tip
Comment List
Related
Recommended