Azure Automation fails with error "module could not be loaded"

AurelienBAUX-1854 0 Reputation points
2025-06-18T12:17:22.3666667+00:00

Hi,

We have an azure automation that was running smoothly but is now failing regularly with the following error:

Get-AzAnalysisServicesServer: Line | 48 | $myAzureAnalysisServer = Get-AzAnalysisServicesServer -ResourceGroupN … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The 'Get-AzAnalysisServicesServer' command was found in the module 'Az.AnalysisServices', but the module could not be loaded. For more information, run 'Import-Module Az.AnalysisServices'.

We didn’t change anything on our side ... i re-imported the package in the runtime environment, and it did solve the issue for a few days, but it came back ... I honestly dont understand what could be the root cause for this strange issue and would appreciate any help ;)

Thanks!

Runtime Environment:

Powershell 7.2

Az 11.2.0

Azure CLI 2.56.0

Az.AnalysisServices 1.2.0

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,366 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ashok Gandhi Kotnana 10,035 Reputation points Microsoft External Staff Moderator
    2025-06-18T13:24:41.4433333+00:00

    Hi @AurelienBAUX-1854

    The error is typically caused by module dependency mismatches, runtime environment inconsistencies, or token refresh failures.

     I encountered the same error previously when the required modules were not properly updated. Please find the reference screenshot below.

    User's image

    Subsequently, I updated the Az.AnalysisServices, Az.Accounts, and Az.Resources modules using a PowerShell 7.2 runbook. Refer to the screenshots below for details.

    User's image

    User's image

    User's image

    After updating the modules, I was able to successfully retrieve the output of the

    Get-AzAnalysisServicesServer 
    

    command. Please see the final screenshot for reference.

    User's image

    Hope this helps!

    let us know if any help, we will always help as you needed.!

    User's image

    Please do not forget to "Accept the answer” and upvote it wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.