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
MIT License
603 stars 151 forks source link

Formatting error in Get-ImageNode #100

Open MichaelSawczyn-AWH opened 2 years ago

MichaelSawczyn-AWH commented 2 years ago

I'm getting the following while diagramming one of my resource groups.

The resource group contained only one virtual network and one network security group

Command line: Export-AzViz -ResourceGroup services-Dev-Migrated -LabelVerbosity 2 -CategoryDepth 3 -Theme light -Show -OutputFormat png -OutputFilePath "Diagrams/Sub - ICM-Dev - RG - services-Dev-Migrated.png"

Output:

    █████╗ ███████╗██╗   ██╗██╗███████╗
   ██╔══██╗╚══███╔╝██║   ██║██║╚══███╔╝   Author    : Prateek Singh (Twitter @singhprateik)
   ███████║  ███╔╝ ██║   ██║██║  ███╔╝    Module    : Azure Visualizer v1.2.1
   ██╔══██║ ███╔╝  ╚██╗ ██╔╝██║ ███╔╝     Github    : https://github.com/PrateekKumarSingh/AzViz
   ██║  ██║███████╗ ╚████╔╝ ██║███████╗   Document  : https://azviz.readthedocs.io
   ╚═╝  ╚═╝╚══════╝  ╚═══╝  ╚═╝╚══════╝
 ▶ Testing Graphviz installation... 167ms
    ▶ GraphViz installation path : C:\Program Files\Graphviz\bin\dot.exe
 ▶ Configuring Defaults... 172ms
    ▶  Target Type            : Azure Resource Group
    ▶  Output Format          : png
    ▶  Exluded Resource Types :
    ▶  Output File Path       : Diagrams/Sub - ICM-Dev - RG - services-Dev-Migrated.png
    ▶  Label Verbosity        : 2
    ▶  Category Depth         : 3
    ▶  Sub-graph Direction    : top-to-bottom
    ▶  Theme                  : light
    ▶  Launch Visualization   : True
 ▶ Target Azure Resource Groups...  179ms
    ▶ services-Dev-Migrated
 ▶ Starting to generate Azure visualization... 180ms
    ▶ Exporting network associations for resource group: 'services-Dev-Migrated'
       ▶ Network watcher found: 'NetworkWatcher_eastus'
       ▶ Obtaining network topology using Network Watcher
    ▶ Exporting ARM template of Azure resource group: 'services-Dev-Migrated'
       ▶ Processing the ARM template to extract resources
       ▶ Total resources found: 36
       ▶ Cleaning up temporary ARM template file at: C:\Users\michael\AppData\Local\Temp\tmpD13E.tmp.json
    ▶ Plotting sub-graph for Azure Resource Group: "services-Dev-Migrated" 49.47s

Get-ImageNode : Error formatting a string: Index (zero based) must be greater than or equal to zero and less than the
size of the argument list..
At C:\Users\michael\OneDrive\Documents\WindowsPowerShell\Modules\AzViz\1.2.1\src\private\ConvertTo-DOTLangauge.ps1:182
char:39
+ ...   $nodes += Get-ImageNode -Name "$tocateg/$to".tolower() -Rows ($to,  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (<TR><TD align="...FONT></TD></TR>:String) [Get-ImageNode], RuntimeExc
   eption
    + FullyQualifiedErrorId : FormatError,Get-ImageNode
moiaune commented 2 years ago

I'm guessing its because there are some resource in your resource group that does not have an icon associated with it. You can check all the icons here and the mapping in code here.

iliyakarin commented 1 year ago

Is it possible to add some kind of default mock icon for non-existing icons?