将 AutomationManagementClient 与 CertificateCloudCredentials 一起使用时出错
Error using AutomationManagementClient with CertificateCloudCredentials
我正在尝试从 MVC 应用启动 azure runbook。
var cert = new X509Certificate2(Convert.FromBase64String(ConfigurationManager.AppSettings["CertBase64String"]));
var creds = new CertificateCloudCredentials(ConfigurationManager.AppSettings["SubscriptionId"], cert);
AutomationManagementClient automationManagementClient = new AutomationManagementClient(creds);
var content = automationManagementClient.Runbooks.GetAsync(<Resource group name>, ConfigurationManager.AppSettings["AutomationAccount"], <Runbook name>)
我收到此错误:
AuthenticationFailed: Authentication failed. The 'Authorization' header is missing.
我从 MSDN 那里得到了这段代码,但我似乎无法让它工作。
(证书是从 here 下载的)。
我尝试在控制台应用程序中使用 TokenCloudCredentials
,这似乎工作正常,但我不确定我是否可以在 MVC 应用程序中使用它们。
我应该如何将 AutomationManagementClient
与证书凭据一起使用?或者如何在网络应用程序中使用TokenCloudCredentials
?
您尝试使用的自动化 SDK 使用 Azure 资源管理器 API,它不支持基于管理证书的身份验证。您将需要通过 TokenCloudCredentials
进行身份验证。显示管理证书支持的文档不正确,我们将尽快更新。
我正在尝试从 MVC 应用启动 azure runbook。
var cert = new X509Certificate2(Convert.FromBase64String(ConfigurationManager.AppSettings["CertBase64String"]));
var creds = new CertificateCloudCredentials(ConfigurationManager.AppSettings["SubscriptionId"], cert);
AutomationManagementClient automationManagementClient = new AutomationManagementClient(creds);
var content = automationManagementClient.Runbooks.GetAsync(<Resource group name>, ConfigurationManager.AppSettings["AutomationAccount"], <Runbook name>)
我收到此错误:
AuthenticationFailed: Authentication failed. The 'Authorization' header is missing.
我从 MSDN 那里得到了这段代码,但我似乎无法让它工作。 (证书是从 here 下载的)。
我尝试在控制台应用程序中使用 TokenCloudCredentials
,这似乎工作正常,但我不确定我是否可以在 MVC 应用程序中使用它们。
我应该如何将 AutomationManagementClient
与证书凭据一起使用?或者如何在网络应用程序中使用TokenCloudCredentials
?
您尝试使用的自动化 SDK 使用 Azure 资源管理器 API,它不支持基于管理证书的身份验证。您将需要通过 TokenCloudCredentials
进行身份验证。显示管理证书支持的文档不正确,我们将尽快更新。