question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when using -FetchDnsRecordsFromAzureSubscription in Cloudshell

See original GitHub issue

Describe the bug When executing .\Get-DanglingDnsRecords.ps1 -FetchDnsRecordsFromAzureSubscription in CloudShell execution fails with the error: Import-Module: Line | 13 | … Import-Module -name $module -Scope Local -Force | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Assembly with same name is already loaded

Reproduce Steps to reproduce the behavior:

  1. Open CloudShell in Azure Portal
  2. Execute the following command in CloudShell Invoke-WebRequest -Uri "https://raw.githubusercontent.com/Azure/Azure-Network-Security/master/Cross%20Product/Find%20Dangling%20DNS%20Records/Get-DanglingDnsRecords.ps1" -OutFile "Get-DanglingDnsRecords.ps1"
  3. Execute the following command in CloudShell .\Get-DanglingDnsRecords.ps1 -FetchDnsRecordsFromAzureSubscription
  4. See error: Import-Module: Line | 13 | … Import-Module -name $module -Scope Local -Force | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Assembly with same name is already loaded

Expected behavior A list of dangling CNAME records for the subscription listed.

Environment- if applicable Azure portal CloudShell

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
LarsHoltecommented, Dec 2, 2020

Same issue here also. Workaround in the cloud shell is to replace L373 with $AZModules = ('Az.Dns') as the Az.Accounts module already is loaded

0reactions
Arun-Mudirajcommented, Dec 9, 2020

Thanks for sharing the details, I see there are 2 version of Az.Accounts loaded Script 2.2.1 Az.Accounts (version loaded in memory) Script 2.2.2 Az.Accounts (version present in modules)

When the script tries to load the latest module it fails with the error, as another version of the module is currently loaded. Can you please wrap the lined in the code Import-Module -name $module -Scope Local -Force to below, and let us know the result.

if (-not (Get-Module -Name $module)) { Import-Module -name $module -Scope Local -Force }

Will update code accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure DNS troubleshooting guide
This error means that Azure DNS was unable to allocate name servers for this DNS zone. Try using a different zone name.
Read more >
Export/Get-DanglingDnsRecords.ps1 0.0.5
Export/Get-DanglingDnsRecords.ps1 ... To fetch DNS records from Azure subscription with subscription Id and DNS zone filters to reduce the scope of search.
Read more >
Error when trying to fetch azure subscription rate card and ...
Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); HttpResponseMessage response = HTTPClient.SendAsync(request).Result; // ...
Read more >
Stopping Azure Subdomain Takeovers
The takeover occurs when a user has a DNS record that points to a deleted Aure ... This can also be performed from...
Read more >
gcloud dns record-sets | Google Cloud CLI Documentation
cloud -shell ... error-reporting ... gcloud dns record-sets - manage the record-sets within your managed-zones. SYNOPSIS. gcloud dns record-sets GROUP ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found