Azure

Generate Azure Resource Diagrams using PowerShell

We’ve all been there. You’ve been working on implementing a solution in Azure and you’ve finally finished building it. It’s all working, and it is time to hand it over to someone else to support. The adage of a picture is worth a thousand words has always stuck in my head, and I always start with a diagram. They can be very time consuming to create and even more so maintain. Recently I saw this tweet from Prateek Singh on a module he’d just published for generating Azure Resource Diagrams using PowerShell. I investigated AzViz and it does just that. Point it at Azure Resource Group(s) and it will generate a diagram of the resources and their relationships with each other. And all using my favorite language PowerShell.

Installing and Importing the AzViz PowerShell Module

The AzViz module can be installed from the PowerShell Gallery with Windows PowerShell 5.1+ or PowerShell 7+. Likewise, so can the Az (Azure PowerShell) PowerShell Module Az which is required to access your Azure Tenant.

install-module -name AzViz
install-module -name Az

The AzViz PowerShell Module also requires GraphViz. That can be downloaded from GraphViz here. Then install it on the computer you will be using AzViz on.

With GraphViz, AzViz and Az installed, import the AzViz module and use the Connect-AzAccount cmdlet from Az to authenticate to your Azure Tenant.

Import-Module AzViz
Connect-AzAccount -TenantId <yourAADTenantID>

Using AzViz

Using the module is very straightforward. Provide it with the Resource Group(s) you want to Generate Azure Resources Diagrams using PowerShell for and specify an output format (currently SVG or PNG). Colorization is optional using the -theme (light, dark or neon) option. The time to generate the Azure resource diagrams using PowerShell will depend on the number of resources in the resource group and their relationships.

Export-AzViz -ResourceGroup yourResourceGroup -Theme light -OutputFormat svg -show

Exported Diagram

Using the -show switch will open the diagram in your browser or default application for PNG/SVG files. By default without using the -OutputFilePath option to provide a path and filename the generated diagram will named output.svg (or output.png) and placed in the %localappdata%\temp directory (on Windows). For more depth of resource categories explore the -CategoryDepth option. And for more verbose labels explore the -LabelVerbosity option.

Editing Exported Diagrams in Visio

When I first looked at this a couple of weeks back, my first thought was this is awesome. My second was, how do I edit the generated diagram so I can add additional details or change some formatting. I even submitted a feature request for that.
Since then I have realized that Microsoft Visio has the ability to handle SVG files and treat elements in a generated diagram as discreet entities. Therefore, they can be rearranged and the diagram updated.

Summary

Using AzViz allows you to quickly generate diagrams for Azure Resources. Quickly being able to generate accurate diagrams for documentation means we can get onto building the next interesting thing. Thanks Prateek.

Darren Robinson

Bespoke learnings from a Microsoft Identity and Access Management Architect using lots of Microsoft Identity Manager, Azure Active Directory, PowerShell, SailPoint IdentityNow and Lithnet products and services.

Recent Posts

EntraPulse – Your AI-Powered Gateway to Microsoft Graph & Docs

Today, I’m super excited to finally announce the Beta release of EntraPulse Lite – a…

2 months ago

Lokka MCP Authentication Enhancements

I'm excited to share some significant authentication enhancements I've contributed to the Lokka MCP Server…

3 months ago

AI Inception: Building AI Solutions with AI for AI

Last month I had the pleasure of speaking at the Sydney event for Global Azure.…

3 months ago

A Have I Been Pwned MCP Server for Claude

Model Context Protocol (MCP) is a powerful framework that extends AI clients like Claude and…

5 months ago

Azure AI Developer Hackathon

I've just completed participating in the Azure AI Developer Hackathon that was looking to provide…

5 months ago

Dynamics 365 CE (Sales, CRM) IAM PowerShell Module

Updated: July 2025 v1.0.2 Fixes issue setting D365SalesGlobals enabling session management for D365 Sales API…

6 months ago

This website uses cookies.