Search code examples
azureazure-powershellazure-automationrunbook

Add-AzureAccount in Azure-runbook fails with: The given key was not present in the dictionary


The two lines of code worked perfectly in one of my Azure-Powershell-Workflow runbook until recently.

$azureCredential = Get-AutomationPSCredential –Name "<asset-name>"
Add-AzureAccount -credential $azureCredential

Now it fails with the error-message Add-AzureAccount : The given key was not present in the dictionary. The inspection of the $azureCredential did not bring up anything suspicious.

Q What must I do to get it going again?


Solution

  • This error can happen in Add-AzureAccount if the credential doesn't have access to any RDFE (Azure Service Management) subscriptions. You can follow the directions here to add the credential to an RDFE subscription.