PrateekKumarSingh / AzViz

⚡ ☁ Azure Visualizer aka 'AzViz' : A #powershell module to automatically generate Azure resource topology diagrams by just typing a PowerShell cmdlet and passing the name of one or more Azure Resource groups

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple StorageAccounts in ResourceGroup results in Error

karyn3864 opened this issue · comments

Several of our ResourceGroups have multiple StorageAccounts. It seems to be the cause of the resulting error:

ConvertFrom-Json : Cannot convert the JSON string because a dictionary that was converted from the string contains the duplicated keys 'StorageAccount' and 
'storageAccount'.
At C:\Program Files\WindowsPowerShell\Modules\AzViz\1.2.1\src\private\ConvertFrom-ARM.ps1:72 char:50
+             $arm = Get-Content -Path $template | ConvertFrom-Json
+                                                  ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [ConvertFrom-Json], InvalidOperationException
    + FullyQualifiedErrorId : DuplicateKeysInJsonString,Microsoft.PowerShell.Commands.ConvertFromJsonCommand
 

I was able to address this issue by updating ConvertFrom-ARM.ps1:71:

FROM: $arm = Get-Content -Path $template | ConvertFrom-Json
TO: $arm = Get-Content -Path $template | ConvertFrom-Json -AsHashtable