Cannot update or install modules in Azure Automation

Chester Camlin 0 Reputation points
2024-05-18T02:35:05.1733333+00:00

I am having issues updating or installing modules in Azure Automation. Every time I initiate the import process, it never finishes. Even when I delete the imported job and try again, the results are still the same. This has persisted for a week now, and the last successful import was on 5/9/2024. I only see modules with the status "Accepted" and "Started." Even when upgrading an existing module, the process fails, and the import process seems blocked. I have tried different methods, such as importing via PowerShell Gallery or a local file, but the problem remains unsolved. What could be the issue here?

Actions I have tried.
Delete and attempt to re-import with the portal

Install using PowerShell

Created a new Azure Automation account.

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

1 answer

Sort by: Most helpful
  1. Sina Salam 4,546 Reputation points
    2024-05-19T19:56:49.1433333+00:00

    Hello Chester Camlin,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Problem

    I understand that you have been facing ongoing problems with updating or installing modules in Azure Automation. Whether using the Azure portal or PowerShell, the modules remain stuck at the "Accepted" and "Started" stages. Despite trying various troubleshooting methods, such as deleting and re-importing modules, the import process remains blocked.

    Scenario

    Based on your posted questions: As an IT administrator overseeing Azure Automation accounts, you have been unable to update or install modules for over a week. Attempts to import modules through both the Azure portal and PowerShell result in the modules getting stuck at the "Accepted" and "Started" stages without completing. Creating a new Automation account did not solve the issue, suggesting it is not limited to a single account. The last successful module import was on May 9, 2024, and all attempts since then have failed.

    Solution

    This prescribed solution was based on the scenario given and your questions, while focusing on the problem statement. There are many things you can do to further troubleshoot it.

    1. About Module Import Issues, there could be an issue with the contents of the module that results in PowerShell's not being able to load it. Please verify that the module imports successfully in a local PowerShell session, correct any issues, and then try importing again.
    2. About the Stuck Module, if a module is stuck during the import process, it can block other imports. To resolve this issue, you must remove the module that is stuck by using the Remove-AzAutomationModule cmdlet. You can then retry importing the module. The sample code is here for your use:
         Remove-AzAutomationModule -ResourceGroupName $resourceGroupName -AutomationAccountName $automationAccountName -Name "ModuleName"
      
    3. About the Automation Sandbox Limitations, Azure Automation uses sandboxes to execute runbook and DSC compilation jobs. Some cmdlets may make unsupported calls due to sandbox limitations. If you're using such cmdlets, consider deploying a Hybrid Runbook Worker or use Azure Functions.

    Finally

    If you're using both AzureRM and Az modules in your Automation account, conflicts can occur. Azure recommends using the Az module with Azure. You can update your modules to the latest Az module in the Azure portal.

    If you're using graphical PowerShell runbooks, note that it's no longer possible to use cmdlets from imported non-default modules in these runbooks. For new runbooks using non-default PowerShell modules, Microsoft recommends using textual runbooks instead.

    Also, remember to always test your modules in a local PowerShell session before importing them into Azure Automation. Below references are documentation and direct source for this solution for your review.

    References

    Source: Troubleshoot Azure Automation shared resource issues. Accessed, 5/19/2024.

    Source: Manage modules in Azure Automation. Accessed, 5/19/2024.

    Source: Update Azure PowerShell modules in Azure Automation. Accessed, 5/19/2024.

    Source: Troubleshoot Azure Automation runbook issues. Accessed, 5/19/2024.

    Accept Answer

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam

    NOTE: Please, this is my personal way of answering technical questions, and my unique formatting style adopted for clarity and future usage. I am not AI and if I use AI contents, I will cite the source of content in my references as recommended by Microsoft Q&A policy. Thank you.

    0 comments No comments