cloudquery / cq-provider-azure

CloudQuery Provider for Azure
https://cloudquery.io
Mozilla Public License 2.0
11 stars 14 forks source link

feat: Add support for Tenants #412

Closed hermanschaaf closed 2 years ago

hermanschaaf commented 2 years ago

Summary

As requested in https://github.com/cloudquery/cq-provider-azure/issues/406, this adds support for listing tenants under a subscription.

It can be used by adding subscriptions.tenant to the cloudquery config, which will then populate a table named azure_subscription_tenants.

To add this, we had to start using the new armsubscriptions Azure SDK, which requires Go 1.18 and uses generics. The implementation for the subscriptions client has been switched to use this now. The benefit of this is that we also get new columns and relations on the accounts and subscriptions tables.

Tables updated in this PR:

Closes https://github.com/cloudquery/cq-provider-azure/issues/406

hermanschaaf commented 2 years ago

After a lot of digging, I discovered that the Azure Go SDK doesn't provide all the fields that the API does, including Tenant ID per subscription. Before we continue with this, I think it would be good to hear back from Microsoft to see if they are willing to add this functionality (or would allow me to add it). https://github.com/Azure/azure-sdk-for-go/issues/18620 and https://github.com/Azure/azure-sdk-for-go/issues/18619

hermanschaaf commented 2 years ago

@bbernays This is now ready for another look - I've updated it to use the new Azure SDKs, which introduces a few new columns and tables and supports a way to link subscriptions with tenants.