Azure Governance Visualizer aka AzGovViz is a PowerShell script that captures Azure Governance related information such as Azure Policy, RBAC (a lot more) by polling Azure ARM, Storage and Microsoft Graph APIs.
In a recent deployment of AzGovWiz we discovered that the setup wouldn't carry on when it stumbled upon a subscription with a null-valued .quotaId.
After extensive debugging, we discovered a way forward by excluding a subscription we believed to be causing troubles. This erroneous subscription was first excluded in an ugly way, by its subscription name "Free Trial". But, the real reason it failed was due to the .quotaId being null. There wasn't much detail provided in the output regarding this, it simply stopped at "Subscription picking" with the error "You cannot call a method on a null-valued expression."
However, the error comes from the .startsWith() method that is validating if the property value .quotaId starts with AAD_, but against a null-valued .quotaId.
Example:
$null.startsWith('xyz')
Will give you the output of:
InvalidOperation: You cannot call a method on a null-valued expression.
This PR simply evaluates if .quotaId is null first, and then puts these subscriptions with the null-valued .quotaId out of scope.
In a recent deployment of AzGovWiz we discovered that the setup wouldn't carry on when it stumbled upon a subscription with a null-valued
.quotaId
.After extensive debugging, we discovered a way forward by excluding a subscription we believed to be causing troubles. This erroneous subscription was first excluded in an ugly way, by its subscription name "Free Trial". But, the real reason it failed was due to the
.quotaId
being null. There wasn't much detail provided in the output regarding this, it simply stopped at "Subscription picking" with the error "You cannot call a method on a null-valued expression."However, the error comes from the
.startsWith()
method that is validating if the property value.quotaId
starts with AAD_, but against a null-valued.quotaId
.Example:
$null.startsWith('xyz')
Will give you the output of:
InvalidOperation: You cannot call a method on a null-valued expression.
This PR simply evaluates if
.quotaId
is null first, and then puts these subscriptions with the null-valued.quotaId
out of scope.