Azure / Azure-Network-Security

Resources for improving Customer Experience with Azure Network Security

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DNS - Find Dangling DNS Records Error on run "Assembly with same name is already loaded"

WB-Sh opened this issue · comments

commented

Describe the bug
The "DNS - Find Dangling DNS Records" script fails on first time run to scan subscriptions and produce a list of dangling CNAMEs. Script will run successfully in locally from my own machine.

Reproduce
Right after installing, importing, and then running the module as follows:
Get-DanglingDnsRecords -FetchDnsRecordsFromAzureSubscription
I see some progress and it seems to finish fetching subscriptions then begin processing subscriptions & DnsZones/DnsRecordSets
Before the command errors out with the following error message:
Import-Module: Line | 13 | … Import-Module -name $module -Scope Local -Force | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Assembly with same name is already loaded

Expected behavior
Expected script to finish & produce report

Screenshots
image

Environment- if applicable

  • Using the Cloud Shell within Azure
  • New Cloud Shell being created/tested
  • Installed latest version of module as of today
    image

Desktop (please complete the following information if applicable):
N/A - Cloud Shell

Just to add that I have had the same issue when trying to run this today
image

Also adding that the issue is still there
image

Also it breaks my cloud shell until I restart it.
image

Does this happen only in the cloud shell?

@drknite72 Did you experience this when not using Cloud shell?

Have not tried in out of cloud shell. Just came back to the tool to see if it had been fixed and was going to try it locally in PS

Update it seems to run just fine locally, the problem still happens when running it from cloud shell

Found a workaround - Deleting the Az.Accounts module imported by this tool seems to let the tool run.

rm -rf /home/<user>/.local/share/powershell/Modules/Az.Accounts

Closing this issue because a work around exist. Feedback received