SOLVED: Azure Runbook error - The term 'Connect-ExchangeOnline' is not recognized as a name of a cmdlet
SOLVED: Azure Runbook error - The term 'Connect-ExchangeOnline' is not recognized as a name of a cmdlet. Import Exchange Online PowerShell module to Automation Account and check PowerShell module version matches the Azure Runbook version.
Problem: Azure Runbook error - The term 'Connect-ExchangeOnline' is not recognized as a name of a cmdlet
Error when connecting to Exchange Online from an Azure PowerShell Runbook:
The term 'Connect-ExchangeOnline' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Solution 1: Import Exchange Online PowerShell module to Automation Account
The Automation Account is missing the Exchange Online Management PowerShell module
Automation Account - Modules - Add a module
Browse from gallery
Click here to browse from gallery
Search for exchange and select Exchange Online Management
Click Select
Runtime version: 5.1
Click Import
Filter by status "importing" and wait until the module has finished importing
Solution 2: Azure Runbook and PowerShell module versions
This error can also be caused by a mismatch in the Azure Runbook and PowerShell Module versions
In this case, the runbook is version 7.2 and the Exchange Online module is 5.1
The solution is to delete the version 7.2 PowerShell runbook and create a version 5.1 one
Solution 3: Import dependant PowerShell modules
The Exchange Online Management PowerShell module requires other PowerShell modules to be installed
See these guides for all the details and step-by-step instructions for importing PowerShell modules and dependancies
by Author
Solution 4: Delete and re-create PowerShell runbook
If your PowerShell Runbook still isn't working and you've been troubleshooting by changing the Automation Account PowerShell modules. You can try deleting and re-creating the PowerShell Runbook.
Comments