Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
. 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."After extensive debugging, we discovered a way forward by excluding a subscription we believed to be causing troubles. We began excluding the erroneous subscription in an ugly way, by implementing a check against the subscription name "Free Trial". We found out afterwards that the real reason it failed was due to the
.quotaId
being null.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.Azure Governance Visualizer (6.5.3) run identifier:
D4038018B71F6625F4C78177872EF6140EFFF16F9D5439D4487EE760A7F50458F7DE1C17D3DD0460B4182C8E1610BE9F9C0BB3A1BDDDE2916BD8079B8E468B63