I have a tenant where we are adding subscriptions all the time. I wish to loop over all subscriptions and run a deployment on each of them, without having to hard-code the list of subscription IDs / names. In a bicep template, is it possible to somehow obtain a list of all the subscriptions in a tenant / management group?
Context: We use ASC (Azure Security Center / Microsoft Defender for Cloud). ASC generates one initiative-assignment per subscription: "ASC Default". We wish to exempt some of the policies in this initiave, for each subscription.
If I pass a list of subscription names / IDs as a parameter to bicep, then I can loop over them. Although that requires a two-stage approach: generate the list first, then run the bicep deployment. I would prefer to do this in one stage, i.e. with a single bicep deployment. Can this be done?