2

I'm trying to start an azure runbook from a MVC app.

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>) 

I get this error:

AuthenticationFailed: Authentication failed. The 'Authorization' header is missing.

I got this code from MSDN but I can't seem to make it work. (The certificate is the one downloaded from here ).

I tried using TokenCloudCredentials from a Console app and that seems to work fine but I'm not sure if I can use those in the MVC app.

Any ideas how I should use AutomationManagementClient with certificate credentials? Or how to use TokenCloudCredentials in the web app?

1
  • Where do you get "CertBase64String"? Commented Mar 14, 2018 at 18:52

1 Answer 1

1

The Automation SDK you are attempting to use uses Azure Resource Manager APIs, which do not support management certificate-based authentication. You will need to authenticate via TokenCloudCredentials. The documentation that shows management certificate support is incorrect and we will update it shortly.

Sign up to request clarification or add additional context in comments.

3 Comments

Do you have an example for using this from a webapp?
No, but I think it should work. Even if it doesn't you could use webhooks to start runbooks instead. See azure.microsoft.com/en-us/documentation/articles/… for more details
Joe, thank you for clarification. However, MSDN states that management certificate-based auth should work (msdn.microsoft.com/en-us/library/azure/mt465763.aspx): "If you are plan to use certificate-based authentication, update the SubscriptionId and CertBase64Stringvalues. Both these values are available in PublishSettings file." It would be great if MSDN docs could be updated accordingly.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.