skip to Main Content

I am trying to shutdown the VM using Azure Automation Account System Managed identity option.

However I am ending up with below error.

enter image description here

As per the other articles it is mentioned to upgrade the module Update-ModulesInAutomationToLatestVersion but I could not update due to below error. I am not sure what is the issue in the script. Same script works with AzureRunAsConnection option without issues ( script ).I even checked with simple login with System Managed Identity it successfully login and fetches the resource group names.

enter image description here

2

Answers


  1. According to the MICROSOFT DOCUMENTATION and looking at your script the Azure Rm module is not supported and it has been updated to the latest version of Az module.

    enter image description here

    For more information please refer the below links:-

    Login or Signup to reply.
  2. I have tested the above shared script in my automation account. Below are
    the couple of observations:

    1. You need to use Connect-AzureRMAccount -Identity cmdlet instead of ‘connect-AzAccount` to connect to your subscription because the rest of the script that you have written using Azure RM cmdlets.
    2. If we use AzureRM cmdlets in your run book script the job is getting suspended stating that Azure RM is going to retired and suggesting us to use Az Module in your workflow.
    3. You can refer to this documentation on how to migrate your PowerShell scripts automatically from AzureRM to AZ modules.
    4. If you want to perform start/stop on your virtual Machines you can leverage the Azure Automation start/stop during the off hours feature.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search