PSRule.Rules.Azure icon indicating copy to clipboard operation
PSRule.Rules.Azure copied to clipboard

[BUG] Inherited 25 subscription limit with Export-AzRuleData -All

Open picklednewtons opened this issue 4 months ago • 1 comments

Existing rule

No response

Description of the issue

When running Export-AzRuleData -All you hit a transparent 25 subscription limit inherited from any Connect-AzAccount connection that has used the default settings (such as the default connection in Azure shell). Not so much a bug but certainly fell into the 'unexpected behavior' category for me.

To overcome the limit I reconnect with Connect-AzAccount -MaxContextPopulation -1 or loop through the subscriptions, setting context each time with Set-AzContext -Subscription.

Error messages

No response

Reproduction

Connect-AzAccount followed by Export-AzRuleData -All on any tenant with more than 25 subscriptions.

Version of PSRule

2.9.0

Version of PSRule for Azure

1.45.1

Additional context

connect-azaccount default limit documentation

picklednewtons avatar Aug 20 '25 09:08 picklednewtons

Thanks for reporting the issue @picklednewtons. In the short term we'll update the documentation. Medium term we expect that this would be resolved by removing reliance of the PowerShell context which will happen though planned optimization.

BernieWhite avatar Aug 23 '25 07:08 BernieWhite