【发布时间】:2018-05-17 06:10:04
【问题描述】:
我正在尝试通过 Azure 自动化服务安排我之前在 Azure Data Lake Analytics 上运行的一些 U-SQL 脚本(我也尝试在 ADF 中执行此操作,但它也对我不起作用,我'将起草另一个问题来解决该路径)。
这是基于MS Docs Guidance 的简化运行手册代码,但对我来说仍然存在错误:
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
Connect-AzureRmAccount -ServicePrincipal `
-Tenant $Conn.TenantID `
-ApplicationId $Conn.ApplicationID `
-CertificateThumbprint $Conn.CertificateThumbprint
$adla = "example_adla01"
$script = @"
@a =
SELECT * FROM
(VALUES
("Contoso", 1500.0),
("Woodgrove", 2700.0)
) AS D( customer, amount );
OUTPUT @a
TO "/data.csv"
USING Outputters.Csv();
"@
Submit-AdlJob -AccountName $adla -Script $script -Name "Demo"
正在调用的命令的版本。
CommandType Name Version Source
----------- ---- ------- ------
Alias Submit-AdlJob 4.2.3 AzureRM.DataLakeAnalytics
此作业在我的本地 Powershell ISE 和 Cloud Shell 中运行良好;但在 Azure 自动化服务测试运行程序中失败并出现此错误(已更新以包含更详细的错误):
Submit-AzureRmDataLakeAnalyticsJob : A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message:
Method not found: 'Newtonsoft.Json.Serialization.IAttributeProvider
Newtonsoft.Json.Serialization.JsonProperty.get_AttributeProvider()'.
At line:23 char:1
+ Submit-AzureRmDataLakeAnalyticsJob -AccountName $adla -Script $script ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (:) [Submit-AzureRmDataLakeAnalyticsJob], HostException
+ FullyQualifiedErrorId : HostFunctionNotImplemented,Microsoft.Azure.Commands.DataLakeAnalytics.SubmitAzureDataLakeAnalyticsJob
我已经导入了我认为正确的模块,但无法找到与 JSON 相关的任何其他模块,或者根本无法调用 JSON 序列化程序的原因,否则这是我站起来的全新自动化实例今天早上。
命令的调试输出:
7:04:53 PM - SubmitAzureDataLakeAnalyticsJob begin processing with ParameterSet 'SubmitUSqlJob'.
7:04:53 PM - using account id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'...
[Common.Authentication]: Authenticating using Account: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', environment: 'AzureCloud', tenant: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
04/23/2018 19:04:54:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - AcquireTokenForClientHandler: === Token Acquisition started:
Authority: https://login.microsoftonline.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/
Resource: https://management.core.windows.net/
ClientId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (1 items)
Authentication Target: Client
Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - <RunAsync>d__0: Looking up cache for a token...
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - TokenCache: An item matching the requested resource was found in the cache
Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - <RunAsync>d__0: 59.9101559033333 minutes left until token in cache expires
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - <RunAsync>d__0: A matching item (access token or refresh token or both) was found in the cache
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - AcquireTokenHandlerBase: === Token Acquisition finished
successfully. An access token was retuned:
Access Token Hash: //removed
Refresh Token Hash: [No Refresh Token]
Expiration Time: 04/23/2018 20:04:48 +00:00
User Hash: null
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 04/23/2018 19:04:54: - AuthenticationStoreTokenCache: Serializing token cache with 1 items.
[Common.Authentication]: Authenticating using Account: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', environment: 'AzureCloud', tenant: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - AcquireTokenForClientHandler: === Token Acquisition started:
Authority: https://login.microsoftonline.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/
Resource: https://datalake.azure.net/
ClientId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (1 items)
Authentication Target: Client
Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - <RunAsync>d__0: Looking up cache for a token...
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - <RunAsync>d__0: No matching token was found in the cache
Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - <RunAsync>d__0: Storing token in the cache...
Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - <RunAsync>d__0: An item was stored in the cache
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
Access Token Hash: //removed
Refresh Token Hash: [No Refresh Token]
Expiration Time: 04/23/2018 20:04:53 +00:00
User Hash: null
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 04/23/2018 19:04:54: - AuthenticationStoreTokenCache: Serializing token cache with 2 items.
[Common.Authentication]: Authenticating using Account: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', environment: 'AzureCloud', tenant: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
04/23/2018 19:04:54: 1cdd67fa-ce99-4931-b1aa-4ced126fa018 - AcquireTokenForClientHandler: === Token Acquisition started:
Authority: https://login.microsoftonline.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/
Resource: https://datalake.azure.net/
ClientId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (2 items)
Authentication Target: Client
Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - <RunAsync>d__0: Looking up cache for a token...
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - TokenCache: An item matching the requested resource was found in the cache
Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - <RunAsync>d__0: 59.9828124866667 minutes left until token in cache expires
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - <RunAsync>d__0: A matching item (access token or refresh token or both) was found in the cache
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
04/23/2018 19:04:54: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
Access Token Hash: //remove
Refresh Token Hash: [No Refresh Token]
Expiration Time: 04/23/2018 20:04:53 +00:00
User Hash: null
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 04/23/2018 19:04:54: - AuthenticationStoreTokenCache: Serializing token cache with 2 items.
【问题讨论】:
-
您能否提及您使用的是哪个版本的 cmdlet?要获取此信息,您可以运行
Get-Command Submit-AdlJob -All。另外,您能否在运行脚本时尝试通过在脚本的最后一行添加-Debug来获取调试输出? (如果您在此处共享调试输出,您可能希望省略任何敏感细节,如身份验证令牌、路径名等。) -
@MattH 我已经更新了问题以包含附加信息,然后按照 Joo Wan Ro 的建议删除和导入。
标签: powershell json.net azure-data-lake u-sql azure-automation