Connect to an Azure Subscription using Certificates

This PowerShell Workflow runbook sets up a connection to an Azure subscription by placing the Azure management certificate into the local machine store and setting the connection to the subscription. Warning: this runbook is deprecated.

4.7 Star
8,691 times
Add to favorites
Windows Azure
E-mail Twitter Digg Facebook
  • Automation certificates deprecated?
    1 Posts | Last post May 27, 2016
      I can see a warning in this version of the script mentioning that certificate authentication in runbooks is no longer supported, was there a reason for this from the product team? It feels like a fundamental feature of Azure Automation.
      Thanks in advance,
  • Error while running the script
    2 Posts | Last post July 10, 2014
    • Getting the below error while running script provided in
      Windows PowerShell Workflow is not supported in a Windows PowerShell x86-based console. Open a Windows PowerShell
      x64-based console, and then try again.
      At line:1 char:1
      + workflow Connect-Azure
      + ~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : OperationStopped: (:) [], NotSupportedException
          + FullyQualifiedErrorId : System.NotSupportedException
    • Are you running this in PowerShell ISE?  This sample is for Azure Automation and will not run in the ISE.
      If you are trying to connect to Azure from PowerShell, you will just want to use: 
      $cert = Get-ChildItem -path Cert:\CurrentUser\My | where {$_.Subject -mathc "yourcertname"
      Set-AzureSubscription -SubscriptionName "MySubscription" -SubscriptionID "YourIDHere" -Certificate $cert
      Select-AzureSubscription -SubscriptionName "MySubscription"