Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

sql server - Active Directory Password Connection Azure SQL Failure from Azure Automation

I need to connect via Azure Automation to an Azure SQL Server using my Azure Active Directory Admin account that is set as the Azure SQL Server AZ AD Admin.

I am able to connect to Azure SQL:

  1. Using SSMS with the Azure AD Admin Account
  2. Using the PowerShell ISE with the Azure AD Admin Account in a SQL ConnectionString
  3. Using Azure Automation with the Azure SQL Admin account (the one created when a new Azure SQL Server is created) in a SQL ConnectionString

However, when attempting to connect to Azure SQL in Azure Automation using the Active Directory Admin account in Azure Automation in a SQL ConnectionString, I get the following error:

New-Object : Exception calling ".ctor" with "1" argument(s): "Keyword not supported: 'authentication'."

Here is my connection attempt:

$server = "tcp:myazuresql.database.windows.net,1433"
$database = "TestDB"
$adminName = "[email protected]"
$adminPassword = "test1234"

$connectionString = "Server=$server;Database=$database;User ID=$adminName;Password=$adminPassword;authentication=Active Directory Password;"
$connection = New-Object -TypeName System.Data.SqlClient.SqlConnection($connectionString)

Any ideas on why I can connect via PowerShell ISE and SSMS but not Azure Automation with the Azure Active Directory Admin? I can also connect via Azure Automation and the Azure SQL Admin account (the default admin account you create with Azure SQL).

The only way I can't connect is when using the Azure Active Directory Admin tied to Azure SQL when using Azure Automation.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Using Azure AD to connect to SQL is not yet supported with Azure Automation Account.This feature requires .NET Framework 4.6 and currently Azure Automation workers only had .NET Framework 4.5.

Suggestion:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...