Home > Net >  Job Suspended Run Login-AzureRmAccount to login using Azure AutomationAccounts System Managed Identi
Job Suspended Run Login-AzureRmAccount to login using Azure AutomationAccounts System Managed Identi

Time:06-07

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 ( enter image description here

CodePudding user response:

According to the enter image description here

For more information please refer the below links:-

CodePudding user response:

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.
  • Related