Open Marcus-James-Adams opened 2 years ago
Same error. I added a breakpoint on PSGraph.psm1 script line 904 to get the value of $standardInput.ToString() and attached to the thread. standardinput.txt
Hello, Same error, any solution, Thx in advance
I had this same issue when trying to run this on a self-hosted build agent. I was able to fix this by modifying the installed C:\Program Files\WindowsPowerShell\Modules\AzViz\1.2.1\src\public\Export-AzViz.ps1 file. I didn't have any problems running Export-AzViz from Powershell locally, but when I tried to run it in an Azure DevOps pipeline, it would fail on this line. I reformatted the line and learned a bit about here strings..
I added a $combined variable to catch the concatenation.. In the end, its just trying to add "strict" to the graph output before passing it to Export. This resolved the issue running from my build machine.
before changes:
after:
yaml steps to generate diagrams from an Azure Devops pipeline: I pre-installed Az-Viz, etc on the build agent, then put this in the pipeline. create a variable called "resource_groups" and put a list of the resource groups you want to model. output.png will get attached to the pipeline as an artifact. ` steps:
task: AzurePowerShell@5 inputs: azureSubscription: 'MySubscription' ScriptType: 'InlineScript' Inline: 'Import-Module AzViz' preferredAzurePowerShellVersion: '3.1.0'
task: AzurePowerShell@5 inputs: azureSubscription: 'MySubscription' ScriptType: 'InlineScript' workingDirectory: $(Build.SourcesDirectory) Inline: "Export-AzViz -ResourceGroup $(resource_groups) -Theme light -OutputFormat png -LabelVerbosity 2 -Direction top-to-bottom -OutputFilePath $(Build.ArtifactStagingDirectory)/output.png" preferredAzurePowerShellVersion: '3.1.0'
task: CopyFiles@2 inputs: SourceFolder: 'C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\' Contents: 'output.png' TargetFolder: '$(Build.ArtifactStagingDirectory)'
task: PublishBuildArtifacts@1 inputs: PathtoPublish: '$(Build.ArtifactStagingDirectory)' ArtifactName: 'drop' publishLocation: 'Container'`
it seems a few people get this @gstevens-kyriba would you mind submitting a PR with your fix in it so all could benefit?
Hi Here, I'm having the same issue!
`dot.exe : Error:
+ CategoryInfo : NotSpecified: (Error: <stdin>:...ear 'strict':String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Export-PSGraph : System error. At C:\Program Files\WindowsPowerShell\Modules\AzViz\1.2.1\src\public\Export-AzViz.ps1:274 char:6
+ CategoryInfo : NotSpecified: (:) [Write-Error], ParseException
+ FullyQualifiedErrorId : System.Management.Automation.ParseException,Export-PSGraph
`
For most of my resource groups it works ok, however for some I get a recurring error eg
█████╗ ███████╗██╗ ██╗██╗███████╗: syntax error in line 1 near 'strict'
At C:\Users\marcus.adams\OneDrive - Novia Financial\Documents\WindowsPowerShell\Modules\PSGraph\2.1.38.27\PSGraph.psm1:904 char:53
██╔══██╗╚══███╔╝██║ ██║██║╚══███╔╝ Author : Prateek Singh (Twitter @singhprateik) ███████║ ███╔╝ ██║ ██║██║ ███╔╝ Module : Azure Visualizer v1.2.1 ██╔══██║ ███╔╝ ╚██╗ ██╔╝██║ ███╔╝ Github : https://github.com/PrateekKumarSingh/AzViz ██║ ██║███████╗ ╚████╔╝ ██║███████╗ Document : https://azviz.readthedocs.io ╚═╝ ╚═╝╚══════╝ ╚═══╝ ╚═╝╚══════╝
▶ Testing Graphviz installation... 999ms ▶ GraphViz installation path : C:\Program Files (x86)\Graphviz\bin\dot.exe ▶ Comciguring Defaults... 1.10s ▶ Target Type : Azure Resource Group ▶ Output Format : png ▶ Exluded Resource Types : ▶ Output File Path : C:\repo\orgs\mycomp\cloud_imcrastructure\projects\platform\dev\UK_South\2.1.3.sql-managed-instance\imcrastructure_diagram.png ▶ Label Verbosity : 2 ▶ Category Depth : 1 ▶ Sub-graph Direction : top-to-bottom ▶ Theme : light ▶ Launch Visualization : False ▶ Target Azure Resource Groups... 1.17s ▶ mc-dev-uks-sqlmi-rsg ▶ Starting to generate Azure visualization... 1.18s VERBOSE: Testing Azure login ▶ Exporting network associations for resource group: 'mc-dev-uks-sqlmi-rsg' ▶ Network watcher found: 'NetworkWatcher_uksouth' ▶ Obtaining network topology using Network Watcher ▶ Exporting ARM template of Azure resource group: 'mc-dev-uks-sqlmi-rsg' ▶ Processing the ARM template to extract resources ▶ Total resources found: 31 ▶ Cleaning up temporary ARM template file at: C:\Users\marcus.adams\AppData\Local\Temp\tmp54C0.tmp.json ▶ Plotting sub-graph for Azure Resource Group: "mc-dev-uks-sqlmi-rsg" 10.41s ▶ Creating Nodes ▶ microsoft.sql/managedinstances/mc-dev-uks-sqlmi-sql2 ▶ microsoft.sql/managedinstances/mc-dev-uks-sqlmi-sql1 dot.exe : Error:
Export-PSGraph : System error. At C:\repo\orgs\mycomp\AzViz\AzViz\src\public\Export-AzViz.ps1:274 char:6