gpt4 book ai didi

powershell - 如何使用 AAD+MultiFactorAuth 调用 sqlcmd(或 sqlcmd.exe)

转载 作者:行者123 更新时间:2023-12-01 12:23:12 25 4
gpt4 key购买 nike

我可以找到的所有文档和帮助线程都包含带有 Authentication=ActiveDirectoryIntegrated 的引用连接字符串,以便通过 AAD 集成命中 SQL。如果我使用的是 SSMS,我还可以选择“Active Directory Universal”,如果需要 MultiFactorAuth (MFA),它会给出提示。

我想使用 powershell 调用 sqlcmd,甚至直接调用 sqlcmd.exe —— 是否支持 MFA 流程?我还能如何获取针对启用 AAD 并启用 MFA 的 SQLAzure 实例的命令行查询?

invoke-sqlcmd : Failed to authenticate the user NT Authority\Anonymous Logon in Active Directory
(Authentication=ActiveDirectoryIntegrated).
Error code 0xCAA2000C; state 10
AADSTS50079: The user is required to use multi-factor authentication.
Trace ID: 54f0cb31-2f0f-4137-b142-b312a6cd441b
Correlation ID: 70204904-576c-4db5-9c3b-6ccd7fe6b409
Timestamp: 2017-02-09 22:56:39Z

我看过 https://learn.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication ,并且一切正常,直到应用 MFA,或者当它意识到是时候重新授权和提示时。

如果我有办法缓存凭据,那么 ActiveDirectoryIntegrated 一般都可以工作,我只需要在它决定是时候强制执行 MFA 提示时重新授权和重新缓存,我也对此持开放态度。

最佳答案

I want to use powershell to invoke-sqlcmd, or even sqlcmd.exe directly -- do either support an MFA flow?

没有。据我所知,SSMS 是目前唯一通过 Active Directory 通用身份验证为 MFA 启用的工具。(引用 here )

如果您对Azure SQL数据库有任何想法或建议,可以通过here提交。 .

关于powershell - 如何使用 AAD+MultiFactorAuth 调用 sqlcmd(或 sqlcmd.exe),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42148836/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com