Skip to content

Autoloading the AzureRm module doesn't work in worker - but works fine interactively #48

@TylerLeonhardt

Description

@TylerLeonhardt

Have a function that just runs:

Login-AzureRmAccount

Note the error:

{
    "Exception": {
          "Source": "Microsoft.Azure.Commands.Common.Authentication.Abstractions",
          "StackTrace": "   at Microsoft.Azure.Commands.Common.Authentication.AzureSession.get_Instance()
                            at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.BeginProcessing()\n   
                            at System.Management.Automation.Cmdlet.DoBeginProcessing()
                            at System.Management.Automation.CommandProcessorBase.DoBegin()",
          "Message": "The Azure PowerShell session has not been properly initialized.  Please import the module and try again."
    }
}

This same cmdlet works just fine in pwsh:

> Login-AzureRmAccount
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code AASFDASF to authenticate.

We can fix the above error by Import-Module AzureRm.Netcore but we should understand why this is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions