Skip to content

Instantly share code, notes, and snippets.

@adamdriscoll
Created February 5, 2016 16:13
Show Gist options
  • Save adamdriscoll/63fad1ab7956fe79af9b to your computer and use it in GitHub Desktop.
Save adamdriscoll/63fad1ab7956fe79af9b to your computer and use it in GitHub Desktop.
Azure Automation Exception
public void Authenticate()
{
SubscriptionCloudCredentials cred;
var cert = new X509Certificate2(Convert.FromBase64String(AzureSettings.ManagementCertificate));
cred = new CertificateCloudCredentials(AzureSettings.Id, cert);
var automationManagementClient = new AutomationManagementClient(cred);
var content = automationManagementClient.Runbooks.Content("<resource group>", "<automation account>", "<runbook>");
}
/* Returns the following exception
An unhandled exception of type 'Hyak.Common.CloudException' occurred in Microsoft.Threading.Tasks.dll
Additional information: AuthenticationFailed: Authentication failed. The 'Authorization' header is missing.*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment