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
587 stars 146 forks source link

Install error when running Install-GraphViz #12

Closed 6107psira closed 3 years ago

6107psira commented 3 years ago

PS C:\Program Files\AzViz-master> Install-GraphViz

Confirm Are you sure you want to perform this action? Performing the operation "Install-GraphViz" on target "Register Chocolatey provider and install graphviz". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): A VERBOSE: Performing the operation "Install Package" on target "Package 'Graphviz' version '2.38.0.20190211' from 'chocolatey'.".

The package(s) come(s) from a package source that is not marked as trusted. Are you sure you want to install software from 'chocolatey'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A VERBOSE: NuGet: WARNING: The request was aborted: Could not create SSL/TLS secure channel. WARNING: NuGet: System.InvalidOperationException: Unable to find version '1.3.5.1' of package 'chocolatey-core.extension'. WARNING: NuGet: at NuGet.PackageRepositoryHelper.ResolvePackage(IPackageRepository sourceRepository, IPackageRepository localRepository, IPackageConstraintProvider constraintProvider, String packageId, SemanticVersion version, Boolean allowPrereleaseVersions) WARNING: NuGet: at NuGet.PackageManager.InstallPackage(String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions) WARNING: NuGet: at NuGet.Commands.InstallCommand.InstallPackage(IFileSystem fileSystem, String packageId, SemanticVersion version) WARNING: NuGet: at NuGet.Program.Main(String[] args) VERBOSE: Skipped Package 'chocolatey-core.extension v1.3.5.1' already installed VERBOSE: NuGet: WARNING: The request was aborted: Could not create SSL/TLS secure channel. WARNING: NuGet: System.InvalidOperationException: Unable to find version '2.38.0.20190211' of package 'Graphviz'. VERBOSE: Skipped Package 'Graphviz v2.38.0.20190211' already installed VERBOSE: Skipping installed package Graphviz 2.38.0.2.

After this, when I attempt to run command Get-AzNetworkVizualization -ResourceGroups 'test-resource-group' -ShowGraph -OutputFor mat png -Verbose VERBOSE: Starting topology graph generation VERBOSE: Target resource groups: 'test-resource-group' Export-PSGraph : Could not find GraphViz installed on this system. Please run 'Install-GraphViz' to install the needed binaries and libraries. This module just a wrapper around GraphViz and is looking for it in the following paths: C:\Program Files\NuGet\Packages\Graphviz\dot.exe or C:\program files\GraphViz*\bin\dot.exe or /usr/local/bin/dot or /usr/bin/dot. Optionally pass a path to your dot.exe file with the GraphVizPath parameter At C:\Program Files\AzViz-master\AzViz\src\public\Get-AzNetworkVizualization.ps1:199 char:9

explodinghat commented 3 years ago

+1 for this issue. Tried on two machines with the same issue. Looks like a great product though, if I can get it working.

explodinghat commented 3 years ago

OK I think I've resolved this. Seems to be an error with the install-graphviz not installing graphviz into the right location. A workaround is to use the chocolatey version of graphviz, but that wasn't working either, because my machine(s) were using TLS1.3 to try and download chocolatey.

To resolve the TLS1.3 error (if you get it) - Powershell AS ADMIN:

New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server' -Force | Out-Null

New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server' -name 'Enabled' -value '0' -PropertyType 'DWord' -Force | Out-Null

New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null

New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client' -Force | Out-Null

New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client' -name 'Enabled' -value '0' -PropertyType 'DWord' -Force | Out-Null

New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null

Then change your .NET Framework default TLS version -powershell AS ADMIN:

reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:64 reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:32

Install chocolatey - powershell AS ADMIN:

iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Close and reopen powershell, then Install graphviz via chocolatey - powershell AS ADMIN:

choco install graphviz

You should then be able to run AzViz in a NON-ADMIN powershell session as per the instructions

Depending on how your executionpolicy is set (and whether or not you can change it) you might still be unable to run/ might need to run azviz as admin

I had to output the file instead of using showvisualization for it to work when running as admin - get-azviz -resourcegroup demo2 -theme light -verbose -outputformat png -OutputFilePath C:\Output\azure.png

mr-shorten commented 3 years ago

I had the same issue. The quickest solve for me was to install GraphViz via executable from here https://graphviz.org/download/#windows

And then use a new powershell window.

PrateekKumarSingh commented 3 years ago

duplicate https://github.com/PrateekKumarSingh/AzViz/issues/8