Hello Team,
I have created the dynamic inventory and used “Microsoft Azure Resource manager” as a SOURCE.
My credential section has the below details:
subscription id:
client id:
client secret:
tenant id:
When i sync the inventory it fetches the hosts in that subscription.
My question is : How can i fetch all the hosts which are in different subscription ? in other words how to add multiple subscriptions ?
Thanks
Sandeep
You can add multiple sources to your inventory, each with its own credentials.
Dave
Thanks for the reply Dave !
I have one azure account and each customer is deployed in different subscrption in that . If i go with your logic then i have to add the "new source " whenever a new customer is deployed,which is not a best option.
Regards
Sandeep
Yea, that can get challenging. You might try adding sources directly to the API with a script or playbook.
Dave
I looked at improving the azure inventory plugin but the Azure API just isn't designed for it.
Unfortunately I am dealing with almost 200 subscriptions, my solution was a simple python script that talks to azure to get the subscription information and adds a credential and inventory source per subscription.
Updating a single inventory with that many sources times out so I add individual hosts to the appropriate group via API before calling the callback url.
Improvements can be made but this is amazingly easier than trying to create a single tenant inventory plugin using the Azure API.
Hello Adam,
Would you mind sharing the python script you are using ?
Atleast a sniffet of it and i can modify or improvise it.
Regards
sandeep