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
597 stars 148 forks source link

AzViz not finding existing resource groups. #33

Closed bourbonfgiles closed 3 years ago

bourbonfgiles commented 3 years ago

When running "Export-AzViz -ResourceGroup prod01 -Theme light -Verbose -OutputFormat png -Show -CategoryDepth 2" I get a return of the below:

VERBOSE: Target Azure Resource Groups: VERBOSE: > 'prod01' VERBOSE: Starting to generate Azure visualization... VERBOSE: Testing Azure login VERBOSE: [+] Exporting ARM template of Azure Resource group: "prod01" Export-AzResourceGroup : ResourceGroupNotFound : Resource group 'prod01' could not be found. CorrelationId: 2fde82a2-f5b9-4825-8c6f-e01ad27039f7 At C:\Users\Giles\Documents\WindowsPowerShell\Modules\AzViz\1.0.9\src\public\Export-AzViz.ps1:232 char:34

In the account there is prod01, dev01 and dev02, but are also 10 subscriptions. I don't see a way to ensure it's picking the right one, which I'm guessing is the issue?

PrateekKumarSingh commented 3 years ago

@bourbonfgiles You have to use Set-AzContext cmdlet to specify your subscription and azure context. Once that is done and you are good to run the Export-AzViz cmdlet for the resource groups under that context/subscription for now. Will add this to documentation as well.

More than that, I'm getting this feedback of capturing resource groups across subscriptions and I'm coming up with a wrapper function that will do that soon. So, I'll keep this issue open till then.

bourbonfgiles commented 3 years ago

@PrateekKumarSingh worked a charm, thanks so much.