Created
March 27, 2025 15:05
-
-
Save JosiahSiegel/3abb809af169cbb9b0cc28aa32fd684b to your computer and use it in GitHub Desktop.
PowerShell Connect Azure SQL DB MFA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
azureAccount = Connect-AzAccount | |
$azureToken = Get-AzAccessToken -ResourceUrl https://database.windows.net | |
$azureInstance = "MyServer.database.windows.net" | |
$azureDatabase = "MyDB" | |
$server = Connect-DbaInstance -SqlInstance $azureInstance -Database $azureDatabase -AccessToken $azureToken | |
Invoke-DbaQuery -SqlInstance $server -Query "SELECT @@VERSION" | Format-Table -AutoSize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment