简体   繁体   English

使用 PowerShell Automation 在周末降级 Azure 资源

[英]Downgrading Azure Resources during weekends using PowerShell Automation

In order to save expenses in Azure DevOps, I'm trying to scale the resources, which can scale depending on the requirement.为了节省 Azure DevOps 的开支,我正在尝试扩展资源,这可以根据需要进行扩展。 Team leads will update the resource requirements in SharePoint, and the runbook needs to be executed with SharePoint datat .团队负责人将更新 SharePoint 中的资源需求,并且需要使用SharePoint 数据执行 runbook。 Team leads will update the resource requirements in SharePoint, and the runbook needs to be executed with SharePoint data.团队负责人将更新 SharePoint 中的资源需求,并且需要使用 SharePoint 数据执行运行手册。 If such resources are not required on weekends but must be operational on weekdays, they should be stopped or reduced in size.如果这些资源在周末不需要,但必须在工作日运行,则应停止或减少它们的规模。 I need to use automation to do it for all of the VMs and App Services at a subscription level every Friday.我需要在每个星期五以订阅级别使用自动化为所有 VM 和应用程序服务执行此操作。 If there is a method to automate this procedure using PowerShell .如果有一种方法可以使用PowerShell自动执行此过程。

I'm glad to receive input.我很高兴收到意见。 Thanks in advance.提前致谢。 I'm looking for feedback on Start/Stop VMs and Scaling Azure App Services .我正在寻找有关启动/停止 VM缩放 Azure 应用服务的反馈。 On weekends, the same may be said for other relevant resources.在周末,其他相关资源也可以这样说。 How can we accomplish this with Azure PowerShell?我们如何使用 Azure PowerShell 实现这一目标?

The best way to do is by using 'Azure Automation Runbook' scheduled to run every specified day or date by time.最好的方法是使用计划在每个指定日期或日期按时间运行的“Azure Automation Runbook”。 To target the VM's, Azure Tags will be much helpful.要以 VM 为目标,Azure 标签会很有帮助。 Your script must check:您的脚本必须检查:

  1. A VM has a specific Tags (eg, StopVM:Friday 11:00PM) VM 具有特定的标签(例如,StopVM:Friday 11:00PM)
  2. Maintenance Enabled in your monitoring solution在您的监控解决方案中启用维护
  3. VM is stopped already or not. VM 是否已停止。
  4. Backup required?需要备份吗?
  5. Confirm the VM is Deallocated (not stopped)确认虚拟机已解除分配(未停止)

Auto-Shutdown option is also available to do this activity.自动关机选项也可用于执行此活动。

Because sometime all you need is a quick and dirty way to save money:因为有时您需要的只是一种快速而肮脏的省钱方式:

在此处输入图像描述

And if you wan't to build something there's an API to shutdown and start VMs如果你不想构建一些东西,有一个 API 可以关闭启动虚拟机

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM