我正在尝试在 powershell 脚本中自动执行 azure 登录,为此,我按照 Microsoft 文档中的建议使用以下命令:
az login --tenant <tenant> --use-device-code
Run Code Online (Sandbox Code Playgroud)
但脚本在这里暂停,并出现以下警告,要求我们打开浏览器并输入代码。
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <code> to authenticate.
Run Code Online (Sandbox Code Playgroud)
如何在 powershell 脚本中自动登录?
编辑:这篇文章的目的是了解 --use-device-code 的工作原理并使其按预期工作。