Please feel free to provide feedback or file bugs here.

using module <Module> does not work as expected

I have a problem with loading classes from a module.

Script is just two lines as following:
using module AzureAD
class TestClass { [Microsoft.Open.AzureAD.Model.Application] static DoIt() { return $null; } }

If I run this, using .\Script.ps1 I get the following error:
At C:\path\Script.ps1:3 char:20
+ class TestClass { [Microsoft.Open.AzureAD.Model.Application] static D ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [Microsoft.Open.AzureAD.Model.Application].
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : TypeNotFound

However, if I run "using module AzureAD" from the command line first and then run the script, it works fine...

What is the difference in running using module from the command line versus running it in the script?

1 vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Stein RustadStein Rustad shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base