- {
- "if": {
- "allOf": [
- {
- "not": {
- "field": "tags.Financial",
- "in": [
- "prod",
- "dev"
- ]
- }
- },
- {
- "field": "type",
- "equals": "Microsoft.Resources/subscriptions/resourceGroups"
- }
- ]
- },
- "then": {
- "effect": "deny"
- }
- }
Insert value in JSON
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Insert value in JSON
Hi JRV.. long time!! I've been out of the PS arena for quite awhile and I have this json driving me mad. I need to insert 'test' into the in: array. Trying to insert new object in NOT tells me that NOT can't be found. Trying to += IN, tells me the property IN can't be found.
Re: Insert value in JSON
This seems to do it.
Add-Member -InputObject $a.if.allof.not -Type noteproperty -Value $arr -Name in -Force
Add-Member -InputObject $a.if.allof.not -Type noteproperty -Value $arr -Name in -Force