Get the App
SLTechnology News&Howtos  ›  Servers  › 

Azure Automation Automation-automatically shuts down Azure

Shulou Source: shulou.com Published: 2022-06-03 09:28:49 09月21日 Update

Azure Automation can provide some automation features, such as we can specify that the virtual machine is turned on at 6: 00 in the morning and turned off at 8: 00 in the evening.

At the same time, it also provides some automatic configuration based on monitoring parameters. Today's main content is to introduce the implementation of timing through Automation to power on and off the virtual machine.

Azure charges virtual machines in different states:

Workflow startVM {$Cred = Get-AutomationPSCredential-Name "test-cred"; Add-AzureRmAccount-Credential $Cred-EnvironmentName AzureChinaCloud; Select-AzureRmSubscription-SubscriptionId "xxxx-xxxx-xxxx" Start-AzureRmVM-ResourceGroupName "seanyutest"-Name "testvm"} workflow stopVM {$Cred = Get-AutomationPSCredential-Name "test-cred"; Add-AzureRmAccount-Credential $Cred-EnvironmentName AzureChinaCloud; Select-AzureRmSubscription-SubscriptionId "xxxx-xxxx-xxxx" Stop-AzureRmVM-ResourceGroupName "seanyutest"-Name "testvm"-Force} Note that the parameter-Force should be added when shutting down, because there will be interaction when performing shutdown in powershell, and you need to type YES from the keyboard to perform shutdown. When we perform shutdown through Automation, you should force shutdown.

Currently, there are several types of Runbook supported:

Azure automation can be managed throughout the lifecycle of infrastructure and applications. Knowledge about how an organization delivers and maintains workloads can be transferred to the system; the following can be achieved:

Generate / deploy resources-deploy VM in a mixed environment using Runbook and Azure Explorer templates. Integrated into development tools such as Jenkins.

Configure VM-evaluate and configure Windows and Linux computers using the required configurations for infrastructure and applications.

Monitor-identify the changes on the computer that are causing the problem, remedy them accordingly, or upgrade them to the management system.

Protection-isolate the VM if a security alert has been raised. Set intra-guest requirements.

Control-set up role-based access control for the team. Restore unused resources.

Tags: Configuration automation content resources management parameters foundations applications situations programs systems structures computers applications differences security functions and at the same time cycles teams Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Linux MariaDB Docker Microsoft