我遵循以下指南: https://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-arm-deployment/
设置azure广告应用。
但它似乎不适用于azure调度程序。 var cred = new TokenCloudCredentials(_options.SubscriptionId,_options.Token);
using (var schedulerServiceClient = new Microsoft.WindowsAzure.Management.Scheduler.CloudServiceManagementClient(cred))
{
var services = await schedulerServiceClient.CloudServices.ListAsync(token);
}
错误和输出可以参见下文。我的问题是,一个天蓝色的广告应用程序是否不适用于所有azure服务?
我尝试了一些代表我自己使用azure令牌而不是使用azure应用程序的东西,然后它就可以了。
Test Name: TestMethod1
Test Outcome: Failed
Result Message:
Test method Ascend.Scheduler.Tests.UnitTest1.TestMethod1 threw exception:
Hyak.Common.CloudException: ForbiddenError: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.
Result StandardOutput:
Debug Trace:
te.processhost.managed.exe Information: 0 : 12/6/2015 9:36:25 PM: - AuthenticationContext: ADAL .NET with assembly version '2.19.0.0', file version '2.19.20802.0213' and informational version 'f719a3fb5ab2559980bb7e75ee78bc15068282fa' is running...
te.processhost.managed.exe Information: 0 : 12/6/2015 9:36:25 PM: e9d31ff5-f1ed-4bf6-b1d7-a180841409d6 - AcquireTokenHandlerBase: === Token Acquisition started:
Authority: https://login.windows.net/ascend.xyz/
Resource: https://management.core.windows.net/
ClientId: 5519b0a9-aeef-4ff8-b41b-2598a6888687
CacheType: Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache (0 items)
Authentication Target: Client
te.processhost.managed.exe Information: 0 : 12/6/2015 9:36:25 PM: e9d31ff5-f1ed-4bf6-b1d7-a180841409d6 - TokenCache: Looking up cache for a token...
te.processhost.managed.exe Information: 0 : 12/6/2015 9:36:25 PM: e9d31ff5-f1ed-4bf6-b1d7-a180841409d6 - TokenCache: No matching token was found in the cache
te.processhost.managed.exe Information: 0 : 12/6/2015 9:36:26 PM: e9d31ff5-f1ed-4bf6-b1d7-a180841409d6 - TokenCache: Storing token in the cache...
te.processhost.managed.exe Information: 0 : 12/6/2015 9:36:26 PM: e9d31ff5-f1ed-4bf6-b1d7-a180841409d6 - TokenCache: An item was stored in the cache
te.processhost.managed.exe Information: 0 : 12/6/2015 9:36:26 PM: e9d31ff5-f1ed-4bf6-b1d7-a180841409d6 - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
Access Token Hash: JMsx9YOCod0W2iHyyRwr6n3FBo8qp/X/iGNGmZxlvbw=
Refresh Token Hash: [No Refresh Token]
Expiration Time: 12/6/2015 10:36:25 PM +00:00
User Hash: null
答案 0 :(得分:0)
我遇到了同样的问题。我认为这不适用于ARM APi ......
答案 1 :(得分:0)
Azure Scheduler支持服务管理和资源管理端点。服务管理端点(https://management.core.windows.net/)使用证书,资源管理(https://management.azure.com/)端点使用OAuth。 您可以使用使用OAuth进行身份验证的Azure Resource Manager Scheduler SDK(https://www.nuget.org/packages/Microsoft.Azure.Management.Scheduler)来管理您的Scheduler作业。
此致 Kevin Lam