简体   繁体   中英

Array is of fixed size (imported from JSON file object)

I'm trying to create a new JSON deployment file from an existing object.. but the new object wont allow me to add additional parameters

Export-AzResourceGroup -ResourceGroupName $InputObject.ResourceGroupName -Resource $InputObject.id -IncludeParameterDefaultValue -IncludeComments -Path ./InputObject.json

$NewObject=Get-Content -Raw ./InputObject.json | ConvertFrom-Json  

$NewObject.resources.zones={1,2,3}

#InvalidOperation: The property 'zones' cannot be found on this object. Verify that the property exists and can be set.

$newObject.resources.Add('zones')

MethodInvocationException: Exception calling "Add" with "1" argument(s): "Collection was of a fixed size."

How to add additional resource entries into the array?

(goal is to export an existing AppGateway, delete it and recreate it with zone redundancy)

Check Types of the items you get.

See <<Object>>.GetType() , System.Collections.Hashtable , Add-Member and System.Collections.Generic.List[object] .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM