Error de inicio automático de VM

Renato Espinoza 0 Reputation points
2025-10-10T15:41:01.2033333+00:00

No se puede iniciar automáticamente la VM, hemos configurar un Runbook pero no funciona y la VM no se inicia automáticamente.

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
{count} votes

2 answers

Sort by: Most helpful
  1. Renato Espinoza 0 Reputation points
    2025-10-10T18:31:41.0866667+00:00

    En los registros de actividad de la VM está todo OK, porque lo estamos levantando manualmente todos los días la VM.

    El problema es que el RunBook que prende en automático la VM todos los días a las 6am no está funcionando y en el Activity Log del RunBook está vacío, pero no se está ejecutando porque tenemos que hacerlo manualmente de manera diaria.

    0 comments No comments

  2. Suchitra Suregaunkar 1,890 Reputation points Microsoft External Staff Moderator
    2025-10-10T19:28:07.5366667+00:00

    Hello Renato Espinoza,

    The most common reasons why an Azure Automation Runbook fails to start a VM on schedule (with empty job logs) are:

    1. Schedule Not Linked to Runbook: If the schedule is created but not properly associated with the runbook, the job will never trigger. This often happens after portal changes or if the linkage was broken during updates.
    2. Authentication Failure: The Automation Account’s identity (Run As Account or Managed Identity) may lack permissions like Microsoft.Compute/virtualMachines/start on the VM or resource group. When authentication fails silently, no job logs are generated.
    3. Expired Run As Account Certificate: If you’re using a Run As Account, its certificate expires after 1 year unless renewed. An expired certificate prevents authentication.
    4. Context Handling in PowerShell: Runbooks that rely on AzContext without explicitly setting it (Disable-AzContextAutosave and Connect-AzAccount) can fail when triggered by schedule.

    As a workaround could you please try below checks:

    1. Verify Schedule Association
      • Go to Automation Account → Runbooks → [Your Runbook] → Schedules.
      • Ensure the schedule is linked and active.
    2. Check Job History
      • Navigate to Automation Account → Jobs.
      • If there are no jobs at all, the schedule linkage is broken.
    3. Validate Authentication
      • If using Managed Identity, confirm it has Virtual Machine Contributor role on the VM’s resource group.
      • If using Run As Account, check certificate expiry under Automation Account → Run As Accounts.
    4. Update Runbook Script
      • Add explicit authentication:
             Disable-AzContextAutosave -Scope Process
             Connect-AzAccount -Identity   # For Managed Identity
             Start-AzVM -Name "VMNAME" -ResourceGroupName "RGNAME"
        
      • Test in Test Pane before relying on schedule.
    5. Enable Logging
      • Add Write-Output statements in the runbook.
      • Enable Log Analytics integration for better diagnostics.
    6. You can manually trigger the runbook daily using:
         
         Start-AzAutomationRunbook -AutomationAccountName "YourAccount" `
         -Name "YourRunbook" -ResourceGroupName "RGNAME"
      

    Reference:
    1.https://free.blessedness.top/en-us/azure/automation/shared-resources/schedules
    2.https://free.blessedness.top/en-us/azure/automation/learn/automation-tutorial-runbook-textual

    3.https://free.blessedness.top/en-us/azure/automation/enable-managed-identity-for-automation#enable-using-the-azure-portal

    If the above steps don’t resolve the issue, could you please share us the below details for further investigation?

    1. Is the schedule actually linked to the runbook? (Check under Runbook → Schedules)
    2. Are there any jobs listed under Automation Account → Jobs? If yes, what is their status?
    3. Which authentication method are you using? (Managed Identity or Run As Account)
    4. Has the Run As Account certificate expired? (If applicable)
    5. What runtime version is the runbook using? (PowerShell 5.1 or 7.2)
    6. Does the runbook execute successfully in Test Pane?
    7. Is the Automation Account in the same region as the VM? (Cross-region setups can fail silently)

    Thanks,

    Suchitra.

    0 comments No comments

Your answer

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