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

Connect-DbaInstance doesn't support Entra ID MFA #9565

Open
reitse opened this issue Dec 16, 2024 · 4 comments
Open

Connect-DbaInstance doesn't support Entra ID MFA #9565

reitse opened this issue Dec 16, 2024 · 4 comments
Labels
bugs life triage required New issue that has not been reviewed by maintainers

Comments

@reitse
Copy link

reitse commented Dec 16, 2024

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

PowerShell credential request
Enter your credentials.
User: fabricuser@.onmicrosoft.com
Password for user fabricuser@
.onmicrosoft.com: ********************

WARNING: [19:48:02][Connect-DbaInstance] Failure | Error connecting to [-inl74sr6xmmudbus67vm4dvwhe.database.fabric.microsoft.com]: Failed to authenticate the user fabricuser@*.onmicrosoft.com in Active Directory (Authentication=ActiveDirectoryPassword).
Error code 0xinvalid_grant
AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access '022907d3-0f1b-48f7-badc-1ba6abab6d66'. Trace ID: 49d46701-3e05-4fa3-a546-84c5d6794900 Correlation ID: 48e3b3b9-9f3f-471f-889e-aa99796a25ef Timestamp: 2024-12-16 18:48:02Z

Steps to Reproduce

$sqlCred = Get-Credential #'fabricuser@****.onmicrosoft.com'
$server = Connect-DbaInstance -SqlInstance ****-inl74sr6xmmudbus67vm4dvwhe.database.fabric.microsoft.com -SqlCredential $sqlCred
-Database "Sql DB TPCH-716712e7-288f-456f-aa81-32bfc5cee8a7" -AzureDomain database.fabric.microsoft.com
-DisableException

Please confirm that you are running the most recent version of dbatools

2.1.27

Other details or mentions

It is trying to connect to a Fabric SQL database which is a far stretch but still.

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe), Windows PowerShell (powershell.exe), Windows PowerShell ISE (powershell_ise.exe), VS Code (terminal), VS Code (integrated terminal)

PowerShell Host Version

Name Value


PSVersion 7.4.6
PSEdition Core
GitCommitId 7.4.6
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

SQL Server Edition and Build number

Microsoft SQL Azure (RTM) - 12.0.2000.8 Nov 6 2024 14:47:11 Copyright (C) 2022 Microsoft Corporation

.NET Framework Version

PSChildName Version


v2.0.50727 2.0.50727.4927
v3.0 3.0.30729.4926
Windows Communication Foundation 3.0.4506.4926
Windows Presentation Foundation 3.0.6920.4902
v3.5 3.5.30729.4926
Client 4.8.09032
Full 4.8.09032
Client 4.0.0.0

@reitse reitse added bugs life triage required New issue that has not been reviewed by maintainers labels Dec 16, 2024
@andreasjordan
Copy link
Contributor

Hi Reitse!

Not sure how I can help here. How should dbatools handle the MFA?

Generally, it is way to complicated for me to reproduce the situation. So all I can do is help you extract the important lines from Connect-DbaInstance so that you can find a better way to connect to the instance. Then I can help implementing this inside of Connect-DbaInstance. But the main part of work would be on your side,

@reitse
Copy link
Author

reitse commented Dec 19, 2024 via email

@andreasjordan
Copy link
Contributor

Connect-DbaInstance is currently far away from opening a browser window.

Maybe you can use commands from the Az module to handle the login and MFA and then connect to the database? Have you had a look at examples 15 and 16?

@reitse
Copy link
Author

reitse commented Dec 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs life triage required New issue that has not been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants