Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerShell auto-login untrusted module error #2490

Closed
aelij opened this issue Dec 10, 2023 · 3 comments
Closed

PowerShell auto-login untrusted module error #2490

aelij opened this issue Dec 10, 2023 · 3 comments
Assignees
Labels

Comments

@aelij
Copy link
Member

aelij commented Dec 10, 2023

Which version of the AzCopy was used?

10.22.0

Which platform are you using?

Windows

What command did you run?

$env:AZCOPY_AUTO_LOGIN_TYPE='PSCRED'
azcopy cp ...

What problem was encountered?

INFO: Scanning...

Do you want to run software from this untrusted publisher?
File C:\Users\user\Documents\PowerShell\Modules\Az.Accounts\2.12.5\Accounts.format.ps1xml is published by CN=Microsoft Corporation,
O=Microsoft Corporation, L=Redmond, S=Washington, C=US and is not trusted on your system. Only run scripts from trusted publishers.
[V] Never run  [D] Do not run  [R] Run once  [A] Always run  [?] Help (default is "D"):
Do you want to run software from this untrusted publisher?
File C:\Users\user\Documents\PowerShell\Modules\Az.Accounts\2.12.5\Accounts.generated.format.ps1xml is published by CN=Microsoft
Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US and is not trusted on your system. Only run scripts from trusted publishers.
[V] Never run  [D] Do not run  [R] Run once  [A] Always run  [?] Help (default is "D"):
Failed to perform Auto-login: PSContextCredentialInvalid output while retrving token.

Have you found a mitigation/solution?

Running the shell using pwsh -ExecutionPolicy Bypass, but that's not a great option.
Note that the module works fine when using it directly (e.g. calling Get-AzAccessToken).

@gapra-msft
Copy link
Member

@nakulkar-msft please take a look

@nakulkar-msft
Copy link
Contributor

Hi @aelij, this is error with powershell. Please file your issue here.
https://github.com/PowerShell/PowerShell

@aelij
Copy link
Member Author

aelij commented Jan 9, 2024

@nakulkar-msft I'm pretty sure this error is because of #2491. On my machine the modules are only installed for PowerShell 7 and azcopy tried to launch PowerShell 5. Please prefer using pwsh over powershell even on Windows, or try to detect the current shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants