Giter VIP home page Giter VIP logo

azure-auto-shutdown's Introduction

Azure Auto Shutdown

This project has as a goal to have one auto shutdown script for azure. The idea of this script it is to be a simple but parallel script that can be executed anywhere ( hence it being a .Net core project)

This working by checking the AutoShutdownTag on the virtual machines and if it is present and the time falls withing the range it stop the virtual machine is outside of the range it starts the virtual machine. To use it put this script to run as a cron job inside any of the services ( you can even deploy it as an azurewejob on a free tier and use it for free)

Requirements

You will need to have 2 files in the same folder to use this application

cred.azure

This is the authentication file to connect to the azure account. You should be suing a server principal to authenticate to this account.

Format

subscription=[subscriptionid]
client=[serverPrincipalId]
key=[serverPrincipalPassword]
tenant=[tennatId]

You can have more details about how to create the authentication key here

base.config.azure

This is the file with the configuration used to run the application.

Format

{
    "subscriptions" : [
        {
            "subscriptionId": [string],
            "simulate": [bool],
            "defaultToOff": [bool],
            "name": [string]
        }
    ],
    "simulate": [bool],
    "sendSlackInfo": [bool],
    "defaultToOff": [bool],
    "slackUrl": [string]
}

If you run with simulate=true It will simulate it but will not actually run shutdown or start any machine. ( useful to test what you are going to do)

How to setup the schedules

Description Tag value
Shut down from 10PM to 6 AM UTC every day 10pm -> 6am
Shut down from 10PM to 6 AM UTC every day
(different format, same result as above)
22:00 -> 06:00
Shut down from 8PM to 12AM and from 2AM to 7AM UTC every day
(bringing online from 12-2AM for maintenance in between)
8PM -> 12AM, 2AM -> 7AM
Shut down all day Saturday and Sunday
(midnight to midnight)
Saturday, Sunday
Shut down from 2AM to 7AM UTC every day
and all day on weekends
2:00 -> 7:00, Saturday, Sunday
Shut down on Christmas Day and New Year’s Day December 25, January 1
Shut down from 2AM to 7AM UTC every day,
and all day on weekends, and on Christmas Day
2:00 -> 7:00, Saturday, Sunday, December 25
Shut down always – I don’t want this VM online, ever 00:00 -> 23:59:59

azure-auto-shutdown's People

Contributors

artberri avatar nepomuceno avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.