How to Automatically Start and Stop Azure VMs using Azure Automation Account

Поделиться
HTML-код
  • Опубликовано: 3 фев 2025

Комментарии • 8

  • @lessonzilla
    @lessonzilla  2 месяца назад

    Script used in this tutorial is listed below.
    param(
    [string]$ResourceGroupName = "ResourceGroup",
    [string]$VMName = "VMname"
    )
    # "Logging in to Azure..."
    Connect-AzAccount -Identity
    # Set the context to a specific subscription
    Set-AzContext -SubscriptionId "subscriptionid"
    # Start the VM
    Start-AzVM -ResourceGroupName $ResourceGroupName -Name $VMName
    param(
    [string]$ResourceGroupName = "ResourceGroup",
    [string]$VMName = "VMName"
    )
    # "Logging in to Azure..."
    Connect-AzAccount -Identity
    # Set the context to a specific subscription
    Set-AzContext -SubscriptionId "Subscriptionid"
    # Stop the VM
    Stop-AzVM -ResourceGroupName $ResourceGroupName -Name $VMName -Force

  • @techtest5490
    @techtest5490 3 месяца назад

    Very helpful tutorial. Thanks!

  • @QuizzyDays
    @QuizzyDays 3 месяца назад

    👍👍

  • @AhmedKhaledAbdelfattah
    @AhmedKhaledAbdelfattah Месяц назад

    Failed to create automation task 'test' : 'The template validation failed: 'The value for the workflow parameter 'EmailID' at line '1' and column '8405' is not provided.'.'.
    I have done all the steps but when i'm trying to create the task it gives me the error above any suggestion how to solve it
    Note: i didn't put an email in the notify me section because it's not mandatory

  • @bijun784
    @bijun784 2 месяца назад

    Where is the script for Start and Stop - not pasted in here?

    • @lessonzilla
      @lessonzilla  2 месяца назад

      Check the Pinned Comment for the script