Table of Contents
Hello friend, Welcome to my blog! 😇
Before we jump into understanding why and how we can visualize and document Azure infrastructure, let’s take a pause here and talk a little bit about what are the challenges and problems in current visualization tools and in the approach of manual documentation. 👇
If you like reading my content and projects I pursue follow me on Twitter @singhprateik, for all the updates!
Problem Statement
- Manual Documentations: Cloud admins are
doomed to manually document a cloud environment
or infrastructure! As the environment grows it becomes complex to maintain the documentation. There has to be a better way to do this in an automated approach! - Maintaining and updating the documentation: It is painful inheriting an undocumented cloud landscape to support. But the bigger problem is manual documentation
consumes a lot of effort and time
and it isstatic in nature
andyou have to update your documentation after regular intervals.
- Gaps in existing tools: There are some visualization tools like Armviz.io and VSCode Extension for ARM Template Visualizer (I love this extension), but I
can only target one ARM template at a time
use these. What if I wantability target a real Azure environment(s) or multiple resource groups at once
, without downloading the template for an individual resource group? There has to be a better which is automated, modular, and extensible so that we can import it and write our own custom tooling on top of that.. that is whyPowerShell
comes into the picture. - Basic visualizations: Not many insights from the graphs and diagrams unless you spend a week designing them manually.
- No mechanism to change the label verbosity. What if I want to see the resource category, or
sku
orOS profile
of a Virtual machine likeWindows
,Linux
etc? right now you can’t get that.. - What if I want to see the
resource dependencies
andnetwork flow
? not possible with existing tools.
- No mechanism to change the label verbosity. What if I want to see the resource category, or
Introducing ‘Azure Visualizer’ aka ‘AzViz’
Introducing Azure Visualizer aka 'AzViz'
– #PowerShell module to automatically generate #Azure resource topology diagrams
or rich infrastructure visualizations
by just typing a PowerShell cmdlet and passing the name of one or more Azure Resource Group(s). See the following image 👇😇 to understand what this module can generate…
Github Project Repository: https://github.com/PrateekKumarSingh/AzViz
Project is open-source on above URL, please feel free to open issues and collaborate if something is not working for you and I’ll pick them up as soon as I get a moment.
Resumed working on project ‘AzViz’ again after a year during RestUp week (Entire Week off for all LinkedIn employees) here at LinkedIn and making some good progress here and having a blast 😇
Update: There has been few recent releases of this module since this blog post was published, you can find more details and new feature in the module here: Azure Visualizer PowerShell module v1.1.2
Capabilities
- Can
target 1 or more Azure Resource groups
at once. - All Resource Groups are labeled with names and the entire graph is labeled with
Subscription Name/Id
- Visualization generated can be in any of two formats:
PNG
,SVG
- Support
Icons for 50+ most popular Azure Resource types
. - Labels each Azure resource (also known as nodes) with information like:
Name
,Provider
,Type
etc. And Ability to increase or decrease the label verbosity - Connect dependent nodes with edges, if dependency between them exists. Basically using the
'DependsOn'
property in an ARM template. - Supports
themes
in visualization images like:light
,dark
andneon
- Ability to change direction in which resource groups are plotted, i.e,
left-to-right
ortop-to-bottom.
- Resource filtering based on categories/sub-categories and types like:
Microsoft.Storage/storageAccounts
andMicrosoft.Storage/storageAccounts/blobServices
- Ability to
Rank Azure resource
(Work in progress). This feature will enable youto control the position of resources
, for example, I like to see my load balancers at the top of my image.
Demo Video on Youtube
Prerequisite
We need to download and install GraphViz on our system before we can proceed with using the ‘AzViz’ PowerShell module. Depending upon the operating system you are using please follow the below-mentioned steps:
Linux
# Ubuntu
$ sudo apt install graphviz
# Fedora
$ sudo yum install graphviz
# Debian
$ sudo apt install graphviz
Windows
# chocolatey packages Graphviz for Windows
choco install graphviz
# alternatively using windows package manager
winget install graphviz
Mac
brew install graphviz
Installation of PowerShell Module
From PowerShell Gallery
# install from powershell gallery Install-Module AzViz -Verbose -Scope CurrentUser -Force # import the module Import-Module AzViz -Verbose # login to azure, this is required for module to work Connect-AzAccount
Clone the project from GitHub
# optionally clone the project from github git clone https://github.com/PrateekKumarSingh/AzViz.git Set-Location .\AzViz\ # import the powershell module Import-Module .\AzViz.psm1 -Verbose # login to azure, this is required for module to work Connect-AzAccount
How to use the Module?
Target Single Resource Group
# target single resource group
Export-AzViz -ResourceGroups demo-2 -Theme light -Verbose -OutputFormat png -Show
Target Single Resource Group with more sub-categories
# target single resource group with more sub-categories
Export-AzViz -ResourceGroups demo-2 -Theme light -Verbose -OutputFormat png -Show -CategoryDepth 2
Target Multiple Resource Groups
# target multiple resource groups
Export-AzViz -ResourceGroups demo-2, demo-3 -LabelVerbosity 1 -CategoryDepth 1 -Theme light -Verbose -Show -OutputFormat png
Add Verbosity to Resource Label
# adding more information in resource label like: Name, type, Provider etc
Export-AzViz -ResourceGroups demo-2 -Theme light -Verbose -OutputFormat png -Show -LabelVerbosity 2
Change Theme of Visualization to ‘Dark’ or ‘Neon’
# changing visualization to darker tone
Export
-AzViz -ResourceGroup test1 -Verbose -OutputFilePath C:\temp\3.png -Show -LabelVerbosity 2 -Theme dark
Future of this Module?
- Right now I’m fiddling with two ideas to generate the visualization
- using
dependsOn
property in ARM template to find dependency in an ARM template - and using
Network watcher
to find associations. Which also provides thenetwork flow like PublicIP > LoadBalancer > NIC > VM
. I may end up using both because both have pros and cons, and by overlaying data from both these approaches on the same graph will give amazing details and insights of you Azure infrastructure.
- using
- Today we only use ‘GraphViz‘ which is open-source visualization software, I will add support for more visualization engines, graphing tools like:
Visio
,Lucid Charts
, etc - Ability to expose
'Custom properties'
of an Azure resource type on the image, likeIPAddress on NIC card
etc - Right now, the module doesn’t support
clustering similar resources and subcategories into a logical cluster/group
. This is a work in progress and would make the diagram much easier to understand once implemented - Ability to exclude Azure resource types like
Microsoft.Storage/storageAccounts/blobServices
- Support visualization from ARM templates passed as an
URL
or alocal File
- Work in progress!.
- Infrastructure DIFF! yeah, you heard it right this is going to be my favorite feature to implement. This will give us the
ability to identify/detect what has changed in Azure infrastructure
, for example, a resource has been deleted, or IPAddress has been changed something like that.
Author of “PowerShell Guide to Python“, “Windows Subsystem for Linux (WSL)“, “Learn C# in 30 minutes” and currently writing the most awaited book: “PowerShell to C# and Back“!
Prateek Singh
Related posts
19 Comments
Leave a ReplyCancel reply
Categories
Author of Books
Awards
Open Sourced Projects
Author at
Blog Roll
Mike F RobbinsDamien Van Robaeys
Stéphane van Gulick
Kevin Marquette
Adam Bertram
Stephanos Constantinou
Francois-Xavier Cat
Ravikanth Chaganti
Roman Levchenko
Blog Stats
- 1,131,844 People Reached
Draw.io would be another nice integration and they have Azure icons already https://github.com/ourchitecture/azure-drawio-icons
Sure, I’ll look into it!
in your examples you have the option set as “”ResourceGroups” with an s. The Parameter is without an s however. Nothing major but I thought you would like to know. Playing around withit now. The Diff Feature would be a great Addition!
Thanks for a Great Module!
Thanks Carl, fixing that in new version! 🙂
Awesome module Prateek! Thanks
Thanks Herman!
Would you like to work with a pliot customer ?
This is an awesome module. Been testing it out and I am impressed. Would it be possible to do this on a subscription level?
Yes, Good news is I’m working on this feature, which is coming in next release. Stay tuned!
and thanks for the feedback!
Hi Prateek
Really is an amazing module, thank you so much.
I have used the SVG output and was able to put it into Visio and ungroup worked perfectly 🙂
My question is around the subscriptions, we have multiple and is it only recognizing our default subscription.
Is there any parameter to use the subscription name or ID?
Hi PRateek, thanks alot for this awesome tool. I have used it against almost all our Resource groups, unfortunately some have over 200 objects, and even if I filter out enough to reduce it to under 200, Export-AzResourceGroup still crashes.
Is this on the roadmap to increase the number of objects per resource group?
This is Excellent! I would love Visio output and the ability to see IP addresses and such when you’re able to get to it. This is soooo cool!
Couple of items of feedback
– Just some more useful “client facing” information like that would be ideal. (IP’s, and stuff like that)
– Error handling would be great – I’m attempting to document on an environment where I’m getting reference to resource groups which don’t exist any more, and on error the export just quits…would be nice to have it continue and generate some sort of placeholder…but heck, as is this is still great.
Thanks for the feedback!
I’m working on error handling and a feature that will allow us to display custom properties, like IPAddress.
Nicely done. I tried and it worked in windows with out any issues. Loved it… How to use this in office Mac(VPN, proxy and others stuff for Azure login::: powershell on mac did’t do the job). Can you pls provide some steps for this. Thanks in advance.
Great product, real life saver.
As a small feature request, would it be possible to show peering between virtual networks?
This would be good and i think achievable
Regards
Ace
whenever I try to run the command I get this error
Line |
29 | … rkObjects = ConvertFrom-Network -TargetType $TargetType -Targets $Tar …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The term ‘Get-AzNetworkWatcher’ is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling
| of the name, or if a path was included, verify that the path is correct and try again.
i am getting error
Exporting network associations for resource group: ‘xx-xxxxx-rg’
ConvertFrom-Network : The term ‘Get-AzNetworkWatcher’ is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At C:\Users\xxxxx\Documents\WindowsPowerShell\Modules\AzViz\1.2.1\src\private\ConvertTo-DOTLangauge.ps1:29 char:27
+ … rkObjects = ConvertFrom-Network -TargetType $TargetType -Targets $Tar …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzNetworkWatcher:String) [ConvertFrom-Network], CommandNotFoundExce
ption
+ FullyQualifiedErrorId : CommandNotFoundException,ConvertFrom-Network
Hi,
When i run Export-AzViz -ResourceGroup AzureBackupRGeast_1 -Theme light -Verbose -OutputFormat png -Show
Getting the below error?
The term ‘Get-AzNetworkWatcher’ is not recognized as the name of a cmdlet, function, script
file, or operable program.
This is an amazing tool, much needed thank you very much. Is there a way to get the IP address to show on the network objects? I am not able to get the IP address to show on my output. Thank you.