Azure自动化Runbook ADAL SQL支持 [英] Azure Automation Runbook ADAL SQL support

查看:134
本文介绍了Azure自动化Runbook ADAL SQL支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Azure Automation Runbook使用Azure AD凭据对Azure SQL数据库运行查询:

I am attempting to use an Azure Automation Runbook to run a query against an Azure SQL database using Azure AD credentials:

$cred = Get-AutomationPSCredential -Name 'SqlAdminUser'
$Username = $cred.UserName
$Password = $cred.GetNetworkCredential().Password
$Server = 'server.database.windows.net'
$Port = 1433
$cxnString = "Server=tcp:$Server,$Port;Database=$Database;Authentication=Active Directory Password;UID=$UserName;PWD=$Password;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"

$cxn = New-Object System.Data.SqlClient.SqlConnection($cxnString)
$cxn.Open()
$cmd = New-Object System.Data.SqlClient.SqlCommand($query, $cxn)
$cmd.CommandTimeout = 120
$cmd.ExecuteNonQuery()
$cxn.Close()

,我收到以下错误消息:

and I get the following error:

不支持关键字:身份验证".

Keyword not supported: 'authentication'.

因此,看来Azure自动化没有 ADAL安装了SQL库?有什么简单的方法可以解决此问题(并且仍然使用Azure AD帐户进行连接)?

So it seems like Azure Automation doesn't have the ADAL SQL library installed? Is there any easy way to work around this (and still use an Azure AD account to connect)?

我使用了以示例为起点.

I used this example as a starting point.

推荐答案

最后,我创建了混合工作程序,使我可以安装

In the end I created hybrid workers which allowed me to install the latest version of the ADAL SQL library, which supports Azure AD authentication.

这篇关于Azure自动化Runbook ADAL SQL支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆