Dangling DNS Finder fails with latest version of Az
lawrencewilson opened this issue · 1 comments
Describe the bug
The Azure Dangling DNS Finder does not work with Az.ResourceGraph version 0.10.0
Reproduce
Steps to reproduce the behavior:
- issue
Install-module -name Az
and ensure you've pulled the latest version (5.9.0) - Issue Get-Command "Search-AzGraph", ensure you have version 0.10.0
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Search-AzGraph 0.10.0 Az.ResourceGraph
- Run the
Get-DanglingDnsRecords
- See error
InvalidOperation: You cannot call a method on a null-valued expression.
At C:\Octopus\Tentacle\Work\20210504200347-1591704-260\scripts\dns-management\Get-DanglingDnsRecords.ps1:338 char:13
+ $key = $psitem.$keyName.trim(" ").tolower()
Expected behavior
The tool works and is able to retrieve Az-Resources as usual.
Screenshots
If applicable, add screenshots/images to help explain your problem.
Environment- if applicable
- What version of CLI was used [Az –version] 5.9.0
Desktop (please complete the following information if applicable):
- OS: Windows 10
- Browser Firefox
- Version [e.g. 22]
Logs- if applicable
- If logs are available, please provide relevant snippets
Additional context
It looks like there is a change in Search-AzGraph
(version 0.10.0) where the data returned is now encapsulated in data.
For example:
instead of
$key = $psitem.$keyName.trim(" ").tolower()
It would need to be:
$key = $psitem.data.$keyName.trim(" ").tolower()
My work-around was to:
Option 1. Ensure a previous version of Az.ResourceGraph
is used.
Option 2. Update the Dangling dns finder to account for this change.
to look like this:
return ($(Search-AzGraph -Query $query @params)).data
Looks like there is already a fix for this incoming. I will close this issue
Reference:
#40