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“!