title: Error of Assembly with same name is already loaded doing Import-Module in Azure Function
body: <p>In an Azure Function I am trying to load a PowerShell module but getting the error Assembly with same
  name is already loaded.</p>
  <p><strong>Code Sample</strong></p>
  <pre><code>Import-Module &quot;D:\home\site\wwwroot\HelloWorld\modules\MsrcSecurityUpdates\1.7.2\MsrcSecurityUpdates.psd1&quot;
  </code></pre>
  <p><strong>Error Message</strong></p>
  <pre><code>Import-Module : Assembly with same name is already loaded
  At C:\home\site\wwwroot\HelloWorld\run.ps1:25 char:5
  +     Import-Module &quot;D:\home\site\wwwroot\HelloWorld\modules\MsrcSecuri ...
  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : InvalidOperation: (:) [Import-Module], FileLoadException
  + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
  </code></pre>
  <p><strong>Some additional background..</strong></p>
  <p>This code was working yesterday. I have made a lot of edits so cannot clearly state the same code which was working yesterday is now failing.</p>
  <p>I am editing the code directly via the browser.</p>
  <p>I have restarted the web app, to potentially flush out any assemblies loaded during my code. Did not make a difference.</p>
  <p>I checked if the module is available with the following, which returns the MsrcSecurityUpdates is NOT installed.</p>
  <pre><code>if (-not (Get-Module -Name &quot;MsrcSecurityUpdates&quot;))
  {
      Write-Output &quot;MsrcSecurityUpdates NOT installed&quot;;
  }
  else
  {
      Write-Output &quot;MsrcSecurityUpdates YES installed&quot;;
  }
  </code></pre>
  <p>I downloaded the module with</p>
  <pre><code>Save-Module -Name MsrcSecurityUpdates -Path &quot;C:\TEMP&quot; -Force
  </code></pre>
  <p>and subsequently uploaded to the Azure Function File Share using the Kudo console. As per the steps outlined in this <a href="https://stackoverflow.com/questions/37724769/how-to-install-a-powershell-module-in-an-azure-function">Stackoverflow question</a></p>