最新版本的Azure Scheduler sdk for .NET has some limited documentation如何使用AD凭据开始使用它,但有关如何设置该文档的文档并不是最新的。
我想让这更容易,如何使用SchedulerManagementClient
初始化CertificateCredentials
类?使用以下代码导致:
Microsoft.Rest.Azure.CloudException : Authentication failed. The 'Authorization' header is missing.`
var store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadWrite);
var certificate = store.Certificates.Find(X509FindType.FindByThumbprint, "FD29EECE44EA71F31C20AB4EA0501E576CFB6B79", false)[0];
store.Close();
var cloudCreds = new CertificateCredentials(certificate);
_scheduler = new SchedulerManagementClient(cloudCreds)
{
SubscriptionId = "[my subscription id]"
};